Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions apps/dashboard/components/charts/use-dynamic-dasharray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ interface UseDynamicDasharrayProps {
defaultDashPattern?: number[];
curveAdjustment?: number;
chartType?:
| "linear"
| "monotone"
| "natural"
| "step"
| "stepBefore"
| "stepAfter";
| "linear"
| "monotone"
| "natural"
| "step"
| "stepBefore"
| "stepAfter";
}

export type LineDasharray = {
Expand All @@ -57,9 +57,9 @@ export function useDynamicDasharray({
curveAdjustment = 1,
chartType = "linear",
}: UseDynamicDasharrayProps): [
(props: CustomizedChartProps) => null,
LineDasharray,
] {
(props: CustomizedChartProps) => null,
LineDasharray,
] {
const [lineDasharrays, setLineDasharrays] = useState<LineDasharray>([]);

const DasharrayCalculator = useCallback(
Expand Down Expand Up @@ -95,7 +95,7 @@ export function useDynamicDasharray({

const lineName = line?.item?.props?.dataKey;
const lineConfig = lineConfigs?.find(
(config) => config?.name === lineName,
(config) => config?.name === lineName
);
const lineSplitIndex = lineConfig?.splitIndex ?? splitIndex;
const dashedSegment = points?.slice(lineSplitIndex);
Expand All @@ -121,11 +121,11 @@ export function useDynamicDasharray({
const repetitions = Math.ceil(dashedLength / patternSegmentLength);
const dashedPatternSegments = Array.from(
{ length: repetitions },
() => targetDashPattern.join(" "),
() => targetDashPattern.join(" ")
);

const finalDasharray = `${solidDasharrayPart} ${dashedPatternSegments.join(
" ",
" "
)}`;
newLineDasharrays.push({
name: lineName,
Expand All @@ -149,7 +149,7 @@ export function useDynamicDasharray({
dashPattern,
lineDasharrays,
chartType,
],
]
);

return [DasharrayCalculator, lineDasharrays];
Expand Down
Loading