diff --git a/packages/bar/src/Bar.tsx b/packages/bar/src/Bar.tsx index 797b559e4..0513bd8bc 100644 --- a/packages/bar/src/Bar.tsx +++ b/packages/bar/src/Bar.tsx @@ -133,6 +133,7 @@ const InnerBar = ({ toggleSerie, legendsWithData, barTotals, + getColor, } = useBar({ indexBy, label, @@ -409,6 +410,7 @@ const InnerBar = ({ onClick, onMouseEnter, onMouseLeave, + getColor, }), [ commonProps, @@ -427,6 +429,7 @@ const InnerBar = ({ onClick, onMouseEnter, onMouseLeave, + getColor, ] ) diff --git a/packages/bar/src/BarCanvas.tsx b/packages/bar/src/BarCanvas.tsx index 27459641e..38e93a664 100644 --- a/packages/bar/src/BarCanvas.tsx +++ b/packages/bar/src/BarCanvas.tsx @@ -218,6 +218,7 @@ const InnerBarCanvas = ({ shouldRenderBarLabel, legendsWithData, barTotals, + getColor, } = useBar({ indexBy, label, @@ -292,6 +293,7 @@ const InnerBarCanvas = ({ onClick, onMouseEnter, onMouseLeave, + getColor, }), [ borderRadius, @@ -314,6 +316,7 @@ const InnerBarCanvas = ({ onClick, onMouseEnter, onMouseLeave, + getColor, ] ) diff --git a/packages/bar/src/types.ts b/packages/bar/src/types.ts index 22a4ab575..c5bfcefc4 100644 --- a/packages/bar/src/types.ts +++ b/packages/bar/src/types.ts @@ -12,7 +12,7 @@ import { Theme, ValueFormat, } from '@nivo/core' -import { InheritedColorConfig, OrdinalColorScaleConfig } from '@nivo/colors' +import { InheritedColorConfig, OrdinalColorScale, OrdinalColorScaleConfig } from '@nivo/colors' import { LegendProps } from '@nivo/legends' import { AnyScale, ScaleSpec, ScaleBandSpec } from '@nivo/scales' import { SpringValues } from '@react-spring/web' @@ -124,6 +124,7 @@ interface BarCustomLayerBaseProps xScale: AnyScale yScale: AnyScale + getColor: OrdinalColorScale> } export interface BarCustomLayerProps