@centreon/ui 23.10.18-MON-17793-create-graph-component-centreon-ui.0 → 23.10.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/src/Graph/Axes/UnitLabel.tsx +0 -20
- package/src/Graph/Axes/index.tsx +0 -99
- package/src/Graph/Axes/models.ts +0 -26
- package/src/Graph/Axes/useAxisY.ts +0 -100
- package/src/Graph/Graph.tsx +0 -231
- package/src/Graph/Grids/index.tsx +0 -20
- package/src/Graph/Header/index.tsx +0 -34
- package/src/Graph/InteractionWithGraph/AnchorPoint/RegularAnchorPoint.tsx +0 -88
- package/src/Graph/InteractionWithGraph/AnchorPoint/StackedAnchorPoint.tsx +0 -97
- package/src/Graph/InteractionWithGraph/AnchorPoint/index.tsx +0 -56
- package/src/Graph/InteractionWithGraph/AnchorPoint/models.ts +0 -25
- package/src/Graph/InteractionWithGraph/AnchorPoint/useAnchorPoint.ts +0 -109
- package/src/Graph/InteractionWithGraph/Bar.tsx +0 -21
- package/src/Graph/InteractionWithGraph/ZoomPreview/index.tsx +0 -38
- package/src/Graph/InteractionWithGraph/ZoomPreview/models.ts +0 -17
- package/src/Graph/InteractionWithGraph/ZoomPreview/useZoomPreview.ts +0 -101
- package/src/Graph/InteractionWithGraph/ZoomPreview/zoomPreviewAtoms.ts +0 -5
- package/src/Graph/InteractionWithGraph/index.tsx +0 -93
- package/src/Graph/InteractionWithGraph/interactionWithGraphAtoms.ts +0 -7
- package/src/Graph/InteractionWithGraph/mouseTimeValueAtoms.ts +0 -49
- package/src/Graph/Lines/RegularLines/index.tsx +0 -99
- package/src/Graph/Lines/RegularLines/useRegularLines.ts +0 -15
- package/src/Graph/Lines/StackedLines/index.tsx +0 -74
- package/src/Graph/Lines/StackedLines/useStackedLines.ts +0 -39
- package/src/Graph/Lines/index.tsx +0 -153
- package/src/Graph/Lines/models.ts +0 -32
- package/src/Graph/LoadingProgress.tsx +0 -46
- package/src/Graph/common/index.ts +0 -33
- package/src/Graph/data.json +0 -1338
- package/src/Graph/helpers/doc.ts +0 -323
- package/src/Graph/helpers/index.ts +0 -15
- package/src/Graph/index.stories.tsx +0 -30
- package/src/Graph/index.tsx +0 -66
- package/src/Graph/models.ts +0 -68
- package/src/Graph/timeSeries/index.test.ts +0 -484
- package/src/Graph/timeSeries/index.ts +0 -512
- package/src/Graph/timeSeries/models.ts +0 -119
- package/src/Graph/useGraphData.ts +0 -117
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +0 -57
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.tsx +0 -78
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/ErrorText.tsx +0 -14
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +0 -169
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/index.tsx +0 -76
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -61
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/usePickersStartEndDate.ts +0 -91
- package/src/TimePeriods/CustomTimePeriod/index.tsx +0 -63
- package/src/TimePeriods/DateTimePickerInput.tsx +0 -99
- package/src/TimePeriods/SelectedTimePeriod.tsx +0 -99
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +0 -497
- package/src/TimePeriods/helpers/index.ts +0 -25
- package/src/TimePeriods/index.stories.tsx +0 -74
- package/src/TimePeriods/index.tsx +0 -77
- package/src/TimePeriods/models.ts +0 -103
- package/src/TimePeriods/timePeriods.styles.ts +0 -20
- package/src/TimePeriods/timePeriodsAtoms.ts +0 -113
- package/src/TimePeriods/useDateTimePickerAdapter.ts +0 -329
- package/src/TimePeriods/useSortTimePeriods.ts +0 -24
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { memo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Curve, Shape } from '@visx/visx';
|
|
4
|
-
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
5
|
-
import { equals, isNil, prop } from 'ramda';
|
|
6
|
-
|
|
7
|
-
import { getTime } from '../../timeSeries';
|
|
8
|
-
import { TimeValue } from '../../timeSeries/models';
|
|
9
|
-
import { getFillColor } from '../../common';
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
areaColor: string;
|
|
13
|
-
filled: boolean;
|
|
14
|
-
graphHeight: number;
|
|
15
|
-
highlight?: boolean;
|
|
16
|
-
lineColor: string;
|
|
17
|
-
metric: string;
|
|
18
|
-
shapeAreaClosed?: Record<string, unknown>;
|
|
19
|
-
shapeLinePath?: Record<string, unknown>;
|
|
20
|
-
timeSeries: Array<TimeValue>;
|
|
21
|
-
transparency: number;
|
|
22
|
-
unit: string;
|
|
23
|
-
xScale: ScaleTime<number, number>;
|
|
24
|
-
yScale: ScaleLinear<number, number>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const RegularLine = ({
|
|
28
|
-
filled,
|
|
29
|
-
timeSeries,
|
|
30
|
-
highlight,
|
|
31
|
-
metric,
|
|
32
|
-
lineColor,
|
|
33
|
-
unit,
|
|
34
|
-
yScale,
|
|
35
|
-
xScale,
|
|
36
|
-
areaColor,
|
|
37
|
-
transparency,
|
|
38
|
-
graphHeight
|
|
39
|
-
}: Props): JSX.Element => {
|
|
40
|
-
const isHighlighted = highlight ? 2 : 0.8;
|
|
41
|
-
|
|
42
|
-
const props = {
|
|
43
|
-
curve: Curve.curveLinear,
|
|
44
|
-
data: timeSeries,
|
|
45
|
-
defined: (value): boolean => !isNil(value[metric]),
|
|
46
|
-
opacity: highlight === false ? 0.3 : 1,
|
|
47
|
-
stroke: lineColor,
|
|
48
|
-
strokeWidth: isHighlighted,
|
|
49
|
-
unit,
|
|
50
|
-
x: (timeValue): number => xScale(getTime(timeValue)) as number,
|
|
51
|
-
y: (timeValue): number => yScale(prop(metric, timeValue)) ?? null
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
if (filled) {
|
|
55
|
-
return (
|
|
56
|
-
<Shape.AreaClosed<TimeValue>
|
|
57
|
-
fill={getFillColor({ areaColor, transparency })}
|
|
58
|
-
fillRule="nonzero"
|
|
59
|
-
key={metric}
|
|
60
|
-
y0={Math.min(yScale(0), graphHeight)}
|
|
61
|
-
yScale={yScale}
|
|
62
|
-
{...props}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return <Shape.LinePath<TimeValue> {...props} />;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default memo(RegularLine, (prevProps, nextProps) => {
|
|
71
|
-
const {
|
|
72
|
-
timeSeries: prevTimeSeries,
|
|
73
|
-
graphHeight: prevGraphHeight,
|
|
74
|
-
highlight: prevHighlight,
|
|
75
|
-
xScale: prevXScale,
|
|
76
|
-
shapeLinePath: prevShapeLinePath,
|
|
77
|
-
shapeAreaClosed: prevShapeAreaClosed
|
|
78
|
-
} = prevProps;
|
|
79
|
-
const {
|
|
80
|
-
timeSeries: nextTimeSeries,
|
|
81
|
-
graphHeight: nextGraphHeight,
|
|
82
|
-
highlight: nextHighlight,
|
|
83
|
-
xScale: nextXScale,
|
|
84
|
-
shapeLinePath: nextShapeLinePath,
|
|
85
|
-
shapeAreaClosed: nextShapeAreaClosed
|
|
86
|
-
} = nextProps;
|
|
87
|
-
|
|
88
|
-
const prevXScaleRange = prevXScale.range();
|
|
89
|
-
const nextXScaleRange = nextXScale.range();
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
equals(prevTimeSeries, nextTimeSeries) &&
|
|
93
|
-
equals(prevGraphHeight, nextGraphHeight) &&
|
|
94
|
-
equals(prevHighlight, nextHighlight) &&
|
|
95
|
-
equals(prevXScaleRange, nextXScaleRange) &&
|
|
96
|
-
equals(prevShapeAreaClosed, nextShapeAreaClosed) &&
|
|
97
|
-
equals(prevShapeLinePath, nextShapeLinePath)
|
|
98
|
-
);
|
|
99
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { difference } from 'ramda';
|
|
2
|
-
|
|
3
|
-
import { Line } from '../../timeSeries/models';
|
|
4
|
-
import { getSortedStackedLines } from '../../timeSeries';
|
|
5
|
-
|
|
6
|
-
interface RegularLines {
|
|
7
|
-
regularLines: Array<Line>;
|
|
8
|
-
}
|
|
9
|
-
const useRegularLines = ({ lines }): RegularLines => {
|
|
10
|
-
const stackedLines = getSortedStackedLines(lines);
|
|
11
|
-
|
|
12
|
-
return { regularLines: difference(lines, stackedLines) };
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default useRegularLines;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import { map, nth, pipe, path, all, not, isNil, prop } from 'ramda';
|
|
4
|
-
import { Shape, Curve } from '@visx/visx';
|
|
5
|
-
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
6
|
-
|
|
7
|
-
import { Line, TimeValue } from '../../timeSeries/models';
|
|
8
|
-
import { getTime } from '../../timeSeries';
|
|
9
|
-
import { getFillColor } from '../../common';
|
|
10
|
-
import { StackedAnchorPoint } from '../../InteractionWithGraph/AnchorPoint/models';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
lines: Array<Line>;
|
|
14
|
-
renderStackedAnchorPoint: (args: StackedAnchorPoint) => ReactNode;
|
|
15
|
-
timeSeries: Array<TimeValue>;
|
|
16
|
-
xScale: ScaleTime<number, number>;
|
|
17
|
-
yScale: ScaleLinear<number, number>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const StackLines = ({
|
|
21
|
-
timeSeries,
|
|
22
|
-
lines,
|
|
23
|
-
yScale,
|
|
24
|
-
xScale,
|
|
25
|
-
renderStackedAnchorPoint
|
|
26
|
-
}: Props): JSX.Element => {
|
|
27
|
-
return (
|
|
28
|
-
<Shape.AreaStack
|
|
29
|
-
curve={Curve.curveLinear}
|
|
30
|
-
data={timeSeries}
|
|
31
|
-
defined={(d): boolean => {
|
|
32
|
-
return pipe(
|
|
33
|
-
map(prop('metric')) as (lines) => Array<string>,
|
|
34
|
-
all((metric) => pipe(path(['data', metric]), isNil, not)(d))
|
|
35
|
-
)(lines);
|
|
36
|
-
}}
|
|
37
|
-
keys={map(prop('metric'), lines)}
|
|
38
|
-
x={(d): number => xScale(getTime(d.data)) ?? 0}
|
|
39
|
-
y0={(d): number => yScale(d[0]) ?? 0}
|
|
40
|
-
y1={(d): number => yScale(d[1]) ?? 0}
|
|
41
|
-
>
|
|
42
|
-
{({ stacks, path: linePath }): Array<JSX.Element> => {
|
|
43
|
-
return stacks.map((stack, index) => {
|
|
44
|
-
const { areaColor, transparency, lineColor, highlight } = nth(
|
|
45
|
-
index,
|
|
46
|
-
lines
|
|
47
|
-
) as Line;
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<g key={`stack-${prop('key', stack)}`}>
|
|
51
|
-
{renderStackedAnchorPoint?.({
|
|
52
|
-
areaColor,
|
|
53
|
-
lineColor,
|
|
54
|
-
stack,
|
|
55
|
-
transparency,
|
|
56
|
-
xScale,
|
|
57
|
-
yScale
|
|
58
|
-
})}
|
|
59
|
-
<path
|
|
60
|
-
d={linePath(stack) || ''}
|
|
61
|
-
fill={getFillColor({ areaColor, transparency })}
|
|
62
|
-
opacity={highlight === false ? 0.3 : 1}
|
|
63
|
-
stroke={lineColor}
|
|
64
|
-
strokeWidth={highlight ? 2 : 1}
|
|
65
|
-
/>
|
|
66
|
-
</g>
|
|
67
|
-
);
|
|
68
|
-
});
|
|
69
|
-
}}
|
|
70
|
-
</Shape.AreaStack>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export default StackLines;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getInvertedStackedLines,
|
|
3
|
-
getNotInvertedStackedLines,
|
|
4
|
-
getTimeSeriesForLines
|
|
5
|
-
} from '../../timeSeries';
|
|
6
|
-
import { LinesData } from '../models';
|
|
7
|
-
|
|
8
|
-
interface StackedLines {
|
|
9
|
-
invertedStackedLinesData: LinesData;
|
|
10
|
-
stackedLinesData: LinesData;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const useStackedLines = ({ lines, timeSeries }): StackedLines => {
|
|
14
|
-
const regularStackedLines = getNotInvertedStackedLines(lines);
|
|
15
|
-
|
|
16
|
-
const regularStackedTimeSeries = getTimeSeriesForLines({
|
|
17
|
-
lines: regularStackedLines,
|
|
18
|
-
timeSeries
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const invertedStackedLines = getInvertedStackedLines(lines);
|
|
22
|
-
const invertedStackedTimeSeries = getTimeSeriesForLines({
|
|
23
|
-
lines: invertedStackedLines,
|
|
24
|
-
timeSeries
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
invertedStackedLinesData: {
|
|
29
|
-
lines: invertedStackedLines,
|
|
30
|
-
timeSeries: invertedStackedTimeSeries
|
|
31
|
-
},
|
|
32
|
-
stackedLinesData: {
|
|
33
|
-
lines: regularStackedLines,
|
|
34
|
-
timeSeries: regularStackedTimeSeries
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default useStackedLines;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import { isEmpty, isNil } from 'ramda';
|
|
4
|
-
|
|
5
|
-
import { getStackedYScale, getUnits, getYScale } from '../timeSeries';
|
|
6
|
-
import { Line } from '../timeSeries/models';
|
|
7
|
-
import {
|
|
8
|
-
RegularLinesAnchorPoint,
|
|
9
|
-
StackedAnchorPoint
|
|
10
|
-
} from '../InteractionWithGraph/AnchorPoint/models';
|
|
11
|
-
|
|
12
|
-
import RegularLine from './RegularLines';
|
|
13
|
-
import StackedLines from './StackedLines';
|
|
14
|
-
import { Shape } from './models';
|
|
15
|
-
|
|
16
|
-
interface AnchorPoint {
|
|
17
|
-
renderRegularLinesAnchorPoint: (args: RegularLinesAnchorPoint) => ReactNode;
|
|
18
|
-
renderStackedAnchorPoint: (args: StackedAnchorPoint) => ReactNode;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Props {
|
|
22
|
-
anchorPoint: AnchorPoint;
|
|
23
|
-
height: number;
|
|
24
|
-
shape: Shape;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const Lines = ({ height, shape, anchorPoint }: Props): JSX.Element => {
|
|
28
|
-
const { areaRegularLines, areaStackedLines } = shape;
|
|
29
|
-
|
|
30
|
-
const { renderRegularLinesAnchorPoint, renderStackedAnchorPoint } =
|
|
31
|
-
anchorPoint;
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
lines: regularLines,
|
|
35
|
-
timeSeries: regularLinesTimeSeries,
|
|
36
|
-
display: displayAreaRegular
|
|
37
|
-
} = areaRegularLines;
|
|
38
|
-
|
|
39
|
-
const { stackedLinesData, invertedStackedLinesData } = areaStackedLines;
|
|
40
|
-
|
|
41
|
-
const {
|
|
42
|
-
lines: regularStackedLines,
|
|
43
|
-
timeSeries: regularStackedLinesTimeSeries
|
|
44
|
-
} = stackedLinesData;
|
|
45
|
-
|
|
46
|
-
const {
|
|
47
|
-
lines: invertedStackedLines,
|
|
48
|
-
timeSeries: invertedStackedLinesTimeSeries
|
|
49
|
-
} = invertedStackedLinesData;
|
|
50
|
-
|
|
51
|
-
const displayArea = (data: unknown): boolean =>
|
|
52
|
-
!isEmpty(data) && !isNil(data);
|
|
53
|
-
|
|
54
|
-
const displayAreaStackedLines =
|
|
55
|
-
areaStackedLines.display && displayArea(regularStackedLines);
|
|
56
|
-
|
|
57
|
-
const displayAreaInvertedStackedLines =
|
|
58
|
-
areaStackedLines.display && displayArea(invertedStackedLines);
|
|
59
|
-
|
|
60
|
-
const displayAreaRegularLines =
|
|
61
|
-
displayAreaRegular && displayArea(regularLines);
|
|
62
|
-
|
|
63
|
-
const stackedYScale = getStackedYScale({
|
|
64
|
-
leftScale: areaStackedLines?.leftScale,
|
|
65
|
-
rightScale: areaStackedLines?.rightScale
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const leftScaleRegularLines = areaRegularLines?.leftScale;
|
|
69
|
-
const rightScaleRegularLines = areaRegularLines?.rightScale;
|
|
70
|
-
const xScaleRegularLines = areaRegularLines?.xScale;
|
|
71
|
-
|
|
72
|
-
const commonStackedLinesProps = {
|
|
73
|
-
xScale: areaStackedLines?.xScale,
|
|
74
|
-
yScale: stackedYScale
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<g>
|
|
79
|
-
{displayAreaStackedLines && (
|
|
80
|
-
<StackedLines
|
|
81
|
-
lines={regularStackedLines}
|
|
82
|
-
renderStackedAnchorPoint={renderStackedAnchorPoint}
|
|
83
|
-
timeSeries={regularStackedLinesTimeSeries}
|
|
84
|
-
{...commonStackedLinesProps}
|
|
85
|
-
/>
|
|
86
|
-
)}
|
|
87
|
-
{displayAreaInvertedStackedLines && (
|
|
88
|
-
<StackedLines
|
|
89
|
-
lines={invertedStackedLines}
|
|
90
|
-
renderStackedAnchorPoint={renderStackedAnchorPoint}
|
|
91
|
-
timeSeries={invertedStackedLinesTimeSeries}
|
|
92
|
-
{...commonStackedLinesProps}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
|
|
96
|
-
{displayAreaRegularLines
|
|
97
|
-
? regularLines.map(
|
|
98
|
-
({
|
|
99
|
-
metric,
|
|
100
|
-
areaColor,
|
|
101
|
-
transparency,
|
|
102
|
-
lineColor,
|
|
103
|
-
filled,
|
|
104
|
-
unit,
|
|
105
|
-
highlight,
|
|
106
|
-
invert
|
|
107
|
-
}) => {
|
|
108
|
-
const [, secondUnit, thirdUnit] = getUnits(
|
|
109
|
-
regularLines as Array<Line>
|
|
110
|
-
);
|
|
111
|
-
const yScale = getYScale({
|
|
112
|
-
hasMoreThanTwoUnits: !isNil(thirdUnit),
|
|
113
|
-
invert,
|
|
114
|
-
leftScale: leftScaleRegularLines,
|
|
115
|
-
rightScale: rightScaleRegularLines,
|
|
116
|
-
secondUnit,
|
|
117
|
-
unit
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<g key={metric}>
|
|
122
|
-
{renderRegularLinesAnchorPoint?.({
|
|
123
|
-
areaColor,
|
|
124
|
-
lineColor,
|
|
125
|
-
metric,
|
|
126
|
-
timeSeries: regularLinesTimeSeries,
|
|
127
|
-
transparency,
|
|
128
|
-
xScale: xScaleRegularLines,
|
|
129
|
-
yScale
|
|
130
|
-
})}
|
|
131
|
-
<RegularLine
|
|
132
|
-
areaColor={areaColor}
|
|
133
|
-
filled={filled}
|
|
134
|
-
graphHeight={height}
|
|
135
|
-
highlight={highlight}
|
|
136
|
-
lineColor={lineColor}
|
|
137
|
-
metric={metric}
|
|
138
|
-
timeSeries={regularLinesTimeSeries}
|
|
139
|
-
transparency={transparency}
|
|
140
|
-
unit={unit}
|
|
141
|
-
xScale={xScaleRegularLines}
|
|
142
|
-
yScale={yScale}
|
|
143
|
-
/>
|
|
144
|
-
</g>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
)
|
|
148
|
-
: null}
|
|
149
|
-
</g>
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export default Lines;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ScaleLinear } from 'd3-scale';
|
|
2
|
-
|
|
3
|
-
import { Line, TimeValue } from '../timeSeries/models';
|
|
4
|
-
|
|
5
|
-
export interface ShapeGraphData {
|
|
6
|
-
[x: string]: unknown;
|
|
7
|
-
display: boolean;
|
|
8
|
-
leftScale?: ScaleLinear<number, number>;
|
|
9
|
-
rightScale?: ScaleLinear<number, number>;
|
|
10
|
-
xScale?: ScaleLinear<number, number>;
|
|
11
|
-
yScale?: ScaleLinear<number, number>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface LinesData {
|
|
15
|
-
lines: Array<Line>;
|
|
16
|
-
timeSeries: Array<TimeValue>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface AreaStackedLines extends ShapeGraphData {
|
|
20
|
-
invertedStackedLinesData: LinesData;
|
|
21
|
-
stackedLinesData: LinesData;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface AreaRegularLines extends ShapeGraphData {
|
|
25
|
-
lines: Array<Line>;
|
|
26
|
-
timeSeries: Array<TimeValue>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface Shape {
|
|
30
|
-
areaRegularLines: AreaRegularLines;
|
|
31
|
-
areaStackedLines: AreaStackedLines;
|
|
32
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { makeStyles } from 'tss-react/mui';
|
|
2
|
-
|
|
3
|
-
import { CircularProgress, alpha } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
interface StyleProps {
|
|
6
|
-
height: number;
|
|
7
|
-
width: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const useStyles = makeStyles<StyleProps>()((theme, { height, width }) => ({
|
|
11
|
-
graphLoader: {
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
backgroundColor: alpha(theme.palette.common.white, 0.5),
|
|
14
|
-
display: 'flex',
|
|
15
|
-
height,
|
|
16
|
-
justifyContent: 'center',
|
|
17
|
-
position: 'absolute',
|
|
18
|
-
width
|
|
19
|
-
}
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
interface LoadingProgress {
|
|
23
|
-
display: boolean;
|
|
24
|
-
height: number;
|
|
25
|
-
width: number;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const LoadingProgress = ({
|
|
29
|
-
display,
|
|
30
|
-
height,
|
|
31
|
-
width
|
|
32
|
-
}: LoadingProgress): JSX.Element | null => {
|
|
33
|
-
const { classes } = useStyles({ height, width });
|
|
34
|
-
|
|
35
|
-
if (!display) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div className={classes.graphLoader}>
|
|
41
|
-
<CircularProgress />
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default LoadingProgress;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { alpha } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
const commonTickLabelProps = {
|
|
4
|
-
fontFamily: 'Roboto, sans-serif',
|
|
5
|
-
fontSize: 10,
|
|
6
|
-
textAnchor: 'middle'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const margin = { bottom: 30, left: 45, right: 45, top: 30 };
|
|
10
|
-
|
|
11
|
-
interface FillColor {
|
|
12
|
-
areaColor: string;
|
|
13
|
-
transparency: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const getFillColor = ({
|
|
17
|
-
transparency,
|
|
18
|
-
areaColor
|
|
19
|
-
}: FillColor): string | undefined =>
|
|
20
|
-
transparency ? alpha(areaColor, 1 - transparency * 0.01) : undefined;
|
|
21
|
-
|
|
22
|
-
const dateFormat = 'L';
|
|
23
|
-
const timeFormat = 'LT';
|
|
24
|
-
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
commonTickLabelProps,
|
|
28
|
-
margin,
|
|
29
|
-
getFillColor,
|
|
30
|
-
dateFormat,
|
|
31
|
-
timeFormat,
|
|
32
|
-
dateTimeFormat
|
|
33
|
-
};
|