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
17 lines
587 B
TypeScript
17 lines
587 B
TypeScript
export const TEXT_LINE_HEIGHT = 12;
|
|
export const PADDING = 16;
|
|
export const LINE_SPACE = 10;
|
|
export const POINT_SIZE = 16;
|
|
export const LABEL_WIDTH = 80;
|
|
|
|
export const calculateContainerHeight = (seriesNum: number, isIncomplete?: boolean) => {
|
|
const linesNum = isIncomplete ? seriesNum + 2 : seriesNum + 1;
|
|
|
|
return 2 * PADDING + linesNum * TEXT_LINE_HEIGHT + (linesNum - 1) * LINE_SPACE;
|
|
};
|
|
|
|
export const calculateRowTransformValue = (rowNum: number) => {
|
|
const top = Math.max(0, PADDING + rowNum * (LINE_SPACE + TEXT_LINE_HEIGHT));
|
|
return `translate(${ PADDING },${ top })`;
|
|
};
|