Files
explore/ui/shared/chart/utils/formatters.ts
T
tom goriunovandGitHub e9aa8a3c2f Stats: give emphasis to incomplete data days (#2085)
* draw dotted line for incomplete data

* add title to tooltip

* refactor parts into separate components

* move utils

* refactor render logic of tooltip

* more refactoring

* fix issue in safari

* tweaks

* test

* make an approximation as a straight line.

* update screenshots

* fix the tooltip hiding behavior.

* add prop for disabling animation
2024-07-22 14:41:18 +02:00

20 lines
555 B
TypeScript

import type { TimeChartItem } from '../types';
export const getIncompleteDataLineSource = (data: Array<TimeChartItem>): Array<TimeChartItem> => {
const result: Array<TimeChartItem> = [];
for (let index = 0; index < data.length; index++) {
const current = data[index];
if (current.isApproximate) {
const prev = data[index - 1];
const next = data[index + 1];
prev && !prev.isApproximate && result.push(prev);
result.push(current);
next && !next.isApproximate && result.push(next);
}
}
return result;
};