Skip to content

Commit 0cfc974

Browse files
committed
feat: Smaller enhancements
1 parent b838383 commit 0cfc974

6 files changed

Lines changed: 14 additions & 7 deletions

File tree

app/charts/area/areas-state.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {
4343
CommonChartState,
4444
InteractiveXTimeRangeState,
4545
} from "@/charts/shared/chart-state";
46+
import { DEFAULT_ANNOTATION_CIRCLE_COLOR } from "@/charts/shared/interaction/annotation-circle";
4647
import { TooltipInfo, TooltipValue } from "@/charts/shared/interaction/tooltip";
4748
import {
4849
getCenteredTooltipPlacement,
@@ -432,10 +433,10 @@ const useAreasState = (
432433
return {
433434
x,
434435
y,
435-
color: segment ? colors(segment) : undefined,
436+
color: DEFAULT_ANNOTATION_CIRCLE_COLOR,
436437
};
437438
},
438-
[xScale, getX, series, xKey, getXAsString, yScale, getY, colors]
439+
[xScale, getX, series, xKey, getXAsString, yScale, getY]
439440
);
440441

441442
const getTooltipInfo = useCallback(

app/charts/bar/bars-state.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
CommonChartState,
3939
InteractiveYTimeRangeState,
4040
} from "@/charts/shared/chart-state";
41+
import { DEFAULT_ANNOTATION_CIRCLE_COLOR } from "@/charts/shared/interaction/annotation-circle";
4142
import { TooltipInfo } from "@/charts/shared/interaction/tooltip";
4243
import {
4344
getCenteredTooltipPlacement,
@@ -319,6 +320,7 @@ const useBarsState = (
319320
return {
320321
x,
321322
y,
323+
color: DEFAULT_ANNOTATION_CIRCLE_COLOR,
322324
};
323325
};
324326

app/charts/column/columns-state.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
CommonChartState,
3535
InteractiveXTimeRangeState,
3636
} from "@/charts/shared/chart-state";
37+
import { DEFAULT_ANNOTATION_CIRCLE_COLOR } from "@/charts/shared/interaction/annotation-circle";
3738
import { TooltipInfo } from "@/charts/shared/interaction/tooltip";
3839
import {
3940
getCenteredTooltipPlacement,
@@ -322,6 +323,7 @@ const useColumnsState = (
322323
return {
323324
x,
324325
y,
326+
color: DEFAULT_ANNOTATION_CIRCLE_COLOR,
325327
};
326328
},
327329
[xScale, yScale, getY, getX]

app/charts/line/lines-state.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
CommonChartState,
3232
InteractiveXTimeRangeState,
3333
} from "@/charts/shared/chart-state";
34+
import { DEFAULT_ANNOTATION_CIRCLE_COLOR } from "@/charts/shared/interaction/annotation-circle";
3435
import { TooltipInfo, TooltipValue } from "@/charts/shared/interaction/tooltip";
3536
import {
3637
getCenteredTooltipPlacement,
@@ -310,17 +311,17 @@ const useLinesState = (
310311
const isMobile = useIsMobile();
311312

312313
const getAnnotationInfo = useCallback(
313-
(datum: Observation, segment: string) => {
314+
(datum: Observation) => {
314315
const x = xScale(getX(datum));
315316
const y = yScale(getY(datum) ?? 0);
316317

317318
return {
318319
x,
319320
y,
320-
color: colors(segment),
321+
color: DEFAULT_ANNOTATION_CIRCLE_COLOR,
321322
};
322323
},
323-
[colors, getX, getY, xScale, yScale]
324+
[getX, getY, xScale, yScale]
324325
);
325326

326327
const getTooltipInfo = (datum: Observation): TooltipInfo => {

app/charts/shared/annotations.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ type AnnotationPosition = {
9393
focused: boolean;
9494
};
9595

96-
export const ANNOTATION_SINGLE_SEGMENT_OFFSET = 16;
96+
export const ANNOTATION_SINGLE_SEGMENT_OFFSET = 12;

app/charts/shared/interaction/annotation-circle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
export const AnnotationCircle = ({
1111
x,
1212
y,
13-
color = "#6B7280",
13+
color = DEFAULT_ANNOTATION_CIRCLE_COLOR,
1414
focused = false,
1515
}: {
1616
x: number;
@@ -30,6 +30,7 @@ export const AnnotationCircle = ({
3030
);
3131
};
3232

33+
export const DEFAULT_ANNOTATION_CIRCLE_COLOR = "#6B7280";
3334
const SIZE = 16;
3435

3536
const useStyles = makeStyles((theme: Theme) => ({

0 commit comments

Comments
 (0)