Skip to content

Commit f27a919

Browse files
Update default dot color on LineChart
1 parent a87738d commit f27a919

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gratio/ui",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"author": "Gratio",
55
"license": "MIT",
66
"type": "module",

src/LineChart/LineChart.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ export const LineChart: FC<{
1919
formatLabel: (d: string | number | Date) => string;
2020
height?: number;
2121
lineColor?: Color;
22+
dotColor?: Color;
2223
xAxisLabel?: string;
2324
yAxisLabel?: string;
2425
valueFormatter?: (value: number) => string;
25-
}> = ({ data, formatLabel, height = 220, lineColor, xAxisLabel, yAxisLabel, valueFormatter }) => {
26+
}> = ({ data, formatLabel, height = 220, lineColor, dotColor, xAxisLabel, yAxisLabel, valueFormatter }) => {
2627
const [tooltip, setTooltip] = useState<TooltipData>(null);
2728
const themeCtx = useTheme();
2829

@@ -33,7 +34,7 @@ export const LineChart: FC<{
3334
const gradientEndColor = 'transparent';
3435
const gridColor = themeCtx?.theme?.main?.border || '#e0e0e0';
3536
const textColor = themeCtx?.theme?.text?.primary || '#606060';
36-
const dotColor = themeCtx?.theme?.main?.dark || '#83EC4A';
37+
const mainDotColor = dotColor ? dotColor : themeCtx?.theme?.main?.primary || '#83EC4A';
3738
const frameColor = 'transparent';
3839
const tooltipBackground = themeCtx?.theme?.background?.primary || '#ffffff';
3940
const tooltipTextColor = themeCtx?.theme?.text?.primary || '#000000';
@@ -249,7 +250,7 @@ export const LineChart: FC<{
249250
onMouseLeave={() => handlePointHover(null)}
250251
/>
251252
{/* Visible dot */}
252-
<circle cx={cx} cy={p.y} r="5" fill={dotColor} style={{ pointerEvents: 'none' }} />
253+
<circle cx={cx} cy={p.y} r="5" fill={mainDotColor} style={{ pointerEvents: 'none' }} />
253254
</g>
254255
);
255256
})}

0 commit comments

Comments
 (0)