Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions packages/propel/src/charts/bar-chart/bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface TShapeProps {
}

interface TBarProps extends TShapeProps {
fill: string | ((payload: any) => string);
fill: string;
stackKeys: string[];
textClassName?: string;
showPercentage?: boolean;
Expand Down Expand Up @@ -108,7 +108,7 @@ const CustomBar = React.memo((props: TBarProps) => {
<path
d={getBarPath(x, y, width, height, topBorderRadius, bottomBorderRadius)}
className="transition-opacity duration-200"
fill={typeof fill === "function" ? fill(payload) : fill}
fill={fill}
opacity={opacity}
/>
{showText && (
Expand All @@ -130,18 +130,12 @@ const CustomBarLollipop = React.memo((props: TBarProps) => {
y1={y + height}
x2={x + width / 2}
y2={y}
stroke={typeof fill === "function" ? fill(payload) : fill}
stroke={fill}
strokeWidth={DEFAULT_LOLLIPOP_LINE_WIDTH}
strokeLinecap="round"
strokeDasharray={dotted ? "4 4" : "0"}
/>
<circle
cx={x + width / 2}
cy={y}
r={DEFAULT_LOLLIPOP_CIRCLE_RADIUS}
fill={typeof fill === "function" ? fill(payload) : fill}
stroke="none"
/>
<circle cx={x + width / 2} cy={y} r={DEFAULT_LOLLIPOP_CIRCLE_RADIUS} fill={fill} stroke="none" />
{showPercentage && (
<PercentageText x={x + width / 2} y={y} percentage={currentBarPercentage} className={textClassName} />
)}
Expand Down
3 changes: 2 additions & 1 deletion packages/propel/src/charts/bar-chart/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ export const BarChart = React.memo(<K extends string, T extends string>(props: T
className="[&_path]:transition-opacity [&_path]:duration-200"
onMouseEnter={() => setActiveBar(bar.key)}
onMouseLeave={() => setActiveBar(null)}
fill={getBarColor(data, bar.key)}
/>
)),
[activeLegend, stackKeys, bars]
[activeLegend, stackKeys, bars, getBarColor, data]
);

return (
Expand Down
Loading