feat: update barchart color rendering to match original version

This commit is contained in:
TzeYiing authored and Ziinc committed 2023-03-01 19:37:06 +08:00
1 parent 720bc5b891
commit 34ff2e3f74
1 file changed
+5 -15
+5 -15
View File
@@ -90,12 +90,6 @@ const BarChart: React.FC<BarChartProps> = ({
}}
onMouseLeave={() => setFocusDataIndex(null)}
>
<defs>
<linearGradient id="colorUv" x1="0" y1="0" x2="0" y2="1">
<stop offset="5%" stopColor={CHART_COLORS.GREEN_1} stopOpacity={0.8} />
<stop offset="95%" stopColor={CHART_COLORS.GREEN_1} stopOpacity={0} />
</linearGradient>
</defs>
<XAxis
dataKey={xAxisKey}
interval={data.length - 2}
@@ -118,19 +112,15 @@ const BarChart: React.FC<BarChartProps> = ({
<Cell
key={`cell-${index}`}
className={`transition-all duration-300 ${onDatumClick ? 'cursor-pointer' : ''}`}
fill={focusDataIndex !== index ? CHART_COLORS.GREEN_1 : CHART_COLORS.GREEN_2}
fill={
focusDataIndex === index || focusDataIndex === null
? CHART_COLORS.GREEN_1
: CHART_COLORS.GREEN_2
}
enableBackground={12}
/>
))}
</Bar>
<Area
type="monotone"
dataKey={yAxisKey}
stroke={CHART_COLORS.GREEN_1}
fillOpacity={1}
fill="url(#colorUv)"
/>
</RechartBarChart>
</Container>
{data && (