mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-02 14:39:54 -05:00
Add a randomly generated gradientID to so each chart has a unique gradient
This commit is contained in:
@@ -85,6 +85,7 @@ const CustomAreaChart = ({
|
||||
customTooltip,
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
const gradientId = `gradient-${Math.random().toString(36).slice(2, 9)}`;
|
||||
return (
|
||||
<ResponsiveContainer
|
||||
width="100%"
|
||||
@@ -101,6 +102,7 @@ const CustomAreaChart = ({
|
||||
/>
|
||||
{gradient === true &&
|
||||
createGradient({
|
||||
id: gradientId,
|
||||
startColor: gradientStartColor,
|
||||
endColor: gradientEndColor,
|
||||
direction: gradientDirection,
|
||||
@@ -116,7 +118,7 @@ const CustomAreaChart = ({
|
||||
type="monotone"
|
||||
dataKey={dataKey}
|
||||
stroke={strokeColor}
|
||||
fill={gradient === true ? "url(#colorUv)" : fillColor}
|
||||
fill={gradient === true ? `url(#${gradientId})` : fillColor}
|
||||
/>
|
||||
|
||||
{customTooltip ? (
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
export const createGradient = ({
|
||||
id = "colorUv",
|
||||
id,
|
||||
startColor,
|
||||
endColor,
|
||||
startOpacity = 0.8,
|
||||
|
||||
Reference in New Issue
Block a user