Skip to content

Commit

Permalink
feat(ChartRangeArea): add formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hduprat committed Jan 16, 2024
1 parent 6c901cd commit c6cd244
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ export const ChartRangeArea = ({
series,
height,
colors,
formatter,
}: {
title: string;
series: RangeAreaSeriesType;
height: number;
showLegendForSingleSeries?: boolean;
colors: string[];
formatter?: (label: string) => string;
}) => {
const setVideoCurrentTimeOnMouseHover = useSetVideoTimeOnMouseHover({
lastX: getLastX(series),
Expand Down Expand Up @@ -62,7 +64,10 @@ export const ChartRangeArea = ({
xaxis: {
type: "numeric",
min: 0,
labels,
labels: {
...labels,
formatter: (label) => formatter?.(label ?? "") ?? label,
},
},
yaxis: { min: 0, labels },
colors,
Expand All @@ -74,7 +79,7 @@ export const ChartRangeArea = ({
strokeDashArray: 3,
},
}),
[title, series.length, colors, videoEnabled, setVideoCurrentTimeOnMouseHover]
[title, series.length, colors, videoEnabled, setVideoCurrentTimeOnMouseHover, formatter]
);

return <ReactApexChart options={options} series={series} type={"rangeArea"} height={height} />;
Expand Down

0 comments on commit c6cd244

Please sign in to comment.