mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* 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
20 lines
555 B
TypeScript
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;
|
|
};
|