Skip to content

Commit

Permalink
feat(calendar): add support for custom color scale (#703)
Browse files Browse the repository at this point in the history
  • Loading branch information
jashanbhullar authored and plouc committed Oct 19, 2019
1 parent 050f0a9 commit 484d308
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/calendar/src/enhance.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ const commonEnhancers = [
withTheme(),
withDimensions(),
withPropsOnChange(
['data', 'minValue', 'maxValue', 'colors'],
({ data, minValue, maxValue, colors }) => {
['data', 'minValue', 'maxValue', 'colors', 'colorScale'],
({ data, minValue, maxValue, colors, colorScale }) => {
if (colorScale) return { colorScale }
const domain = computeDomain(data, minValue, maxValue)

const colorScale = scaleQuantize()
const defaultColorScale = scaleQuantize()
.domain(domain)
.range(colors)

return { colorScale }
return { colorScale: defaultColorScale }
}
),
withPropsOnChange(
Expand Down

0 comments on commit 484d308

Please sign in to comment.