Skip to content

Commit

Permalink
fixes a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
askadityapandey authored Sep 15, 2024
1 parent c7df68f commit c9c8352
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions src/components/chart-elements/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,24 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
}
/>
) : null}
{categories.map((category) => {
return (
<defs key={category}>
{showGradient ? (
<linearGradient
className={
getColorClassNames(
categoryColors.get(category) ?? BaseColors.Gray,
colorPalette.text,
).textColor
}
id={categoryColors.get(category)}
x1="0"
y1="0"
x2="0"
y2="1"
>
{categories.map((category) => {
const gradientId = (categoryColors.get(category) ?? BaseColors.Gray).replace('#', '');
return (
<defs key={category}>
{showGradient ? (
<linearGradient
className={
getColorClassNames(
categoryColors.get(category) ?? BaseColors.Gray,
colorPalette.text,
).textColor
}
id={gradientId}
x1="0"
y1="0"
x2="0"
y2="1"
>
<stop
offset="5%"
stopColor="currentColor"
Expand All @@ -319,13 +320,13 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
</linearGradient>
) : (
<linearGradient
className={
className={
getColorClassNames(
categoryColors.get(category) ?? BaseColors.Gray,
colorPalette.text,
).textColor
}
id={categoryColors.get(category)}
id={gradientId}
x1="0"
y1="0"
x2="0"
Expand All @@ -342,14 +343,16 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
</defs>
);
})}
{categories.map((category) => (
{categories.map((category) => {
const gradientId = (categoryColors.get(category) ?? BaseColors.Gray).replace('#', '');
<Area
className={
getColorClassNames(
categoryColors.get(category) ?? BaseColors.Gray,
colorPalette.text,
).strokeColor
}
fill={`url(#${gradientId})`}
strokeOpacity={activeDot || (activeLegend && activeLegend !== category) ? 0.3 : 1}
activeDot={(props: any) => {
const { cx, cy, stroke, strokeLinecap, strokeLinejoin, strokeWidth, dataKey } =
Expand Down Expand Up @@ -466,4 +469,4 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)

AreaChart.displayName = "AreaChart";

export default AreaChart;
export default AreaChart;

0 comments on commit c9c8352

Please sign in to comment.