@centreon/ui 23.10.18-MON-17793-create-graph-component-centreon-ui.14 → 23.10.18-MON-17793-create-graph-component-centreon-ui.16
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 -1
- package/src/Graph/BasicComponents/Lines/index.tsx +3 -1
- package/src/Graph/Graph.tsx +16 -7
- package/src/Graph/Header/index.tsx +4 -1
- package/src/Graph/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +2 -7
- package/src/Graph/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +1 -6
- package/src/Graph/InteractiveComponents/Tooltip/index.tsx +0 -5
- package/src/Graph/InteractiveComponents/index.tsx +18 -15
- package/src/Graph/Legend/index.tsx +18 -5
- package/src/Graph/helpers/doc.ts +265 -52
- package/src/Graph/index.stories.tsx +1 -1
- package/src/Graph/models.ts +2 -1
- package/src/Graph/map.md +0 -51
- package/src/TimePeriods/map.md +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "23.10.18-MON-17793-create-graph-component-centreon-ui.
|
|
3
|
+
"version": "23.10.18-MON-17793-create-graph-component-centreon-ui.16",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
@@ -57,6 +57,8 @@ const Lines = ({
|
|
|
57
57
|
!isNil(areaThresholdLines?.factors?.currentFactorMultiplication) &&
|
|
58
58
|
!isNil(areaThresholdLines?.factors?.simulatedFactorMultiplication);
|
|
59
59
|
|
|
60
|
+
const displayCircles = areaThresholdLines?.displayCircles ?? true;
|
|
61
|
+
|
|
60
62
|
const currentFactorMultiplication = areaThresholdLines?.factors
|
|
61
63
|
?.currentFactorMultiplication as number;
|
|
62
64
|
|
|
@@ -135,7 +137,7 @@ const Lines = ({
|
|
|
135
137
|
xScale={xScale}
|
|
136
138
|
/>
|
|
137
139
|
)}
|
|
138
|
-
{displayEnvelopeThreshold && (
|
|
140
|
+
{displayEnvelopeThreshold && displayCircles && (
|
|
139
141
|
<AwesomeCircles
|
|
140
142
|
dataY0={dataY0 as Data}
|
|
141
143
|
dataY1={dataY1 as Data}
|
package/src/Graph/Graph.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MutableRefObject, useMemo, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Group } from '@visx/visx';
|
|
4
|
+
import { isNil } from 'ramda';
|
|
4
5
|
|
|
5
6
|
import { ClickAwayListener, Skeleton } from '@mui/material';
|
|
6
7
|
|
|
@@ -101,6 +102,9 @@ const Graph = ({
|
|
|
101
102
|
xScale
|
|
102
103
|
});
|
|
103
104
|
|
|
105
|
+
const displayLegend = legend?.display ?? true;
|
|
106
|
+
const displayTooltip = !isNil(tooltip?.renderComponent);
|
|
107
|
+
|
|
104
108
|
if (!isInViewport) {
|
|
105
109
|
return (
|
|
106
110
|
<Skeleton
|
|
@@ -177,13 +181,18 @@ const Graph = ({
|
|
|
177
181
|
/>
|
|
178
182
|
</Group.Group>
|
|
179
183
|
</svg>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
{displayTooltip && (
|
|
185
|
+
<GraphTooltip {...tooltip} {...graphTooltipData} />
|
|
186
|
+
)}
|
|
187
|
+
{displayLegend && (
|
|
188
|
+
<Legend
|
|
189
|
+
base={baseAxis}
|
|
190
|
+
displayAnchor={displayAnchor}
|
|
191
|
+
lines={newLines}
|
|
192
|
+
renderExtraComponent={legend?.renderExtraComponent}
|
|
193
|
+
timeSeries={timeSeries}
|
|
194
|
+
/>
|
|
195
|
+
)}
|
|
187
196
|
</div>
|
|
188
197
|
</ClickAwayListener>
|
|
189
198
|
</>
|
|
@@ -28,7 +28,10 @@ const Header = ({
|
|
|
28
28
|
const { classes } = useStyles();
|
|
29
29
|
const { toDateTime } = useLocaleDateTimeFormat();
|
|
30
30
|
|
|
31
|
-
const { timeTick } = useTickGraph({
|
|
31
|
+
const { timeTick } = useTickGraph({
|
|
32
|
+
timeSeries,
|
|
33
|
+
xScale
|
|
34
|
+
});
|
|
32
35
|
const time =
|
|
33
36
|
displayTimeTick && !isNil(timeTick) ? toDateTime(timeTick) : null;
|
|
34
37
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
2
|
-
import { isNil,
|
|
2
|
+
import { isNil, prop } from 'ramda';
|
|
3
3
|
|
|
4
4
|
import { bisectDate, getDates } from '../../timeSeries';
|
|
5
5
|
import { TimeValue } from '../../timeSeries/models';
|
|
@@ -10,7 +10,6 @@ import AnchorPoint from '.';
|
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
areaColor: string;
|
|
13
|
-
displayTimeValues?: boolean;
|
|
14
13
|
graphHeight: number;
|
|
15
14
|
graphWidth: number;
|
|
16
15
|
lineColor: string;
|
|
@@ -44,7 +43,6 @@ const RegularAnchorPoint = ({
|
|
|
44
43
|
areaColor,
|
|
45
44
|
transparency,
|
|
46
45
|
lineColor,
|
|
47
|
-
displayTimeValues = true,
|
|
48
46
|
...rest
|
|
49
47
|
}: Props): JSX.Element | null => {
|
|
50
48
|
const { timeTick, positionX, positionY } = useTickGraph({
|
|
@@ -52,13 +50,10 @@ const RegularAnchorPoint = ({
|
|
|
52
50
|
xScale
|
|
53
51
|
});
|
|
54
52
|
|
|
55
|
-
if (isNil(timeTick)
|
|
53
|
+
if (isNil(timeTick)) {
|
|
56
54
|
return null;
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
if (isNil(timeTick) || not(displayTimeValues)) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
57
|
const xAnchorPoint = xScale(timeTick);
|
|
63
58
|
|
|
64
59
|
const yAnchorPoint = getYAnchorPoint({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
2
|
-
import { isNil, map,
|
|
2
|
+
import { isNil, map, pipe } from 'ramda';
|
|
3
3
|
|
|
4
4
|
import { bisectDate } from '../../timeSeries';
|
|
5
5
|
|
|
@@ -9,7 +9,6 @@ import AnchorPoint from '.';
|
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
areaColor: string;
|
|
12
|
-
displayTimeValues?: boolean;
|
|
13
12
|
graphHeight: number;
|
|
14
13
|
graphWidth: number;
|
|
15
14
|
lineColor: string;
|
|
@@ -50,12 +49,8 @@ const StackedAnchorPoint = ({
|
|
|
50
49
|
areaColor,
|
|
51
50
|
transparency,
|
|
52
51
|
lineColor,
|
|
53
|
-
displayTimeValues = true,
|
|
54
52
|
...rest
|
|
55
53
|
}: Props): JSX.Element | null => {
|
|
56
|
-
if (isNil(timeTick) || not(displayTimeValues)) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
54
|
if (isNil(timeTick)) {
|
|
60
55
|
return null;
|
|
61
56
|
}
|
|
@@ -17,7 +17,6 @@ const GraphTooltip = ({
|
|
|
17
17
|
tooltipLeft,
|
|
18
18
|
tooltipTop,
|
|
19
19
|
tooltipData,
|
|
20
|
-
enable = true,
|
|
21
20
|
renderComponent,
|
|
22
21
|
tooltipOpen
|
|
23
22
|
}: Props): JSX.Element | null => {
|
|
@@ -35,10 +34,6 @@ const GraphTooltip = ({
|
|
|
35
34
|
};
|
|
36
35
|
}, []);
|
|
37
36
|
|
|
38
|
-
if (!enable) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
37
|
if (!tooltipOpen) {
|
|
43
38
|
return null;
|
|
44
39
|
}
|
|
@@ -2,9 +2,9 @@ import { MutableRefObject } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Event } from '@visx/visx';
|
|
4
4
|
import { ScaleTime } from 'd3-scale';
|
|
5
|
-
import { useSetAtom
|
|
6
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
|
+
import { useSetAtom } from 'jotai';
|
|
7
6
|
import { isEmpty, isNil } from 'ramda';
|
|
7
|
+
import { makeStyles } from 'tss-react/mui';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
AnnotationEvent,
|
|
@@ -15,18 +15,18 @@ import {
|
|
|
15
15
|
import { getTimeValue } from '../timeSeries';
|
|
16
16
|
import { TimeValue } from '../timeSeries/models';
|
|
17
17
|
|
|
18
|
+
import Annotations from './Annotations';
|
|
19
|
+
import { TimelineEvent } from './Annotations/models';
|
|
18
20
|
import Bar from './Bar';
|
|
19
21
|
import TimeShiftZones from './TimeShiftZones';
|
|
20
22
|
import ZoomPreview from './ZoomPreview';
|
|
21
23
|
import {
|
|
24
|
+
MousePosition,
|
|
25
|
+
changeMousePositionAndTimeValueDerivedAtom,
|
|
22
26
|
eventMouseDownAtom,
|
|
23
|
-
eventMouseUpAtom,
|
|
24
27
|
eventMouseLeaveAtom,
|
|
25
|
-
|
|
26
|
-
MousePosition
|
|
28
|
+
eventMouseUpAtom
|
|
27
29
|
} from './interactionWithGraphAtoms';
|
|
28
|
-
import Annotations from './Annotations';
|
|
29
|
-
import { TimelineEvent } from './Annotations/models';
|
|
30
30
|
|
|
31
31
|
const useStyles = makeStyles()(() => ({
|
|
32
32
|
overlay: {
|
|
@@ -62,7 +62,7 @@ const InteractionWithGraph = ({
|
|
|
62
62
|
}: Props): JSX.Element => {
|
|
63
63
|
const { classes } = useStyles();
|
|
64
64
|
|
|
65
|
-
const
|
|
65
|
+
const setEventMouseDown = useSetAtom(eventMouseDownAtom);
|
|
66
66
|
const setEventMouseUp = useSetAtom(eventMouseUpAtom);
|
|
67
67
|
const setEventMouseLeave = useSetAtom(eventMouseLeaveAtom);
|
|
68
68
|
|
|
@@ -73,10 +73,11 @@ const InteractionWithGraph = ({
|
|
|
73
73
|
const { graphHeight, graphWidth, graphSvgRef, xScale, timeSeries } =
|
|
74
74
|
commonData;
|
|
75
75
|
|
|
76
|
-
const displayZoomPreview =
|
|
77
|
-
|
|
76
|
+
const displayZoomPreview = zoomData?.enable ?? true;
|
|
77
|
+
|
|
78
78
|
const displayEventAnnotations =
|
|
79
79
|
!isNil(annotationData?.data) && !isEmpty(annotationData?.data);
|
|
80
|
+
const displayTimeShiftZones = timeShiftZonesData?.enable ?? true;
|
|
80
81
|
|
|
81
82
|
const mouseLeave = (event): void => {
|
|
82
83
|
setEventMouseLeave(event);
|
|
@@ -141,11 +142,13 @@ const InteractionWithGraph = ({
|
|
|
141
142
|
xScale={xScale}
|
|
142
143
|
/>
|
|
143
144
|
)}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
{displayTimeShiftZones && (
|
|
146
|
+
<TimeShiftZones
|
|
147
|
+
graphHeight={graphHeight}
|
|
148
|
+
graphWidth={graphWidth}
|
|
149
|
+
{...timeShiftZonesData}
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
149
152
|
<Bar
|
|
150
153
|
className={classes.overlay}
|
|
151
154
|
fill="transparent"
|
|
@@ -24,6 +24,7 @@ import LegendContent from './LegendContent';
|
|
|
24
24
|
|
|
25
25
|
interface Props {
|
|
26
26
|
base: number;
|
|
27
|
+
displayAnchor?: boolean;
|
|
27
28
|
limitLegendRows?: boolean;
|
|
28
29
|
lines: Array<Line>;
|
|
29
30
|
renderExtraComponent?: ReactNode;
|
|
@@ -37,7 +38,8 @@ const MainLegend = ({
|
|
|
37
38
|
base,
|
|
38
39
|
toggable = true,
|
|
39
40
|
limitLegendRows = true,
|
|
40
|
-
renderExtraComponent
|
|
41
|
+
renderExtraComponent,
|
|
42
|
+
displayAnchor = true
|
|
41
43
|
}: Props): JSX.Element => {
|
|
42
44
|
const { classes, cx } = useStyles({ limitLegendRows });
|
|
43
45
|
const theme = useTheme();
|
|
@@ -86,7 +88,9 @@ const MainLegend = ({
|
|
|
86
88
|
? color
|
|
87
89
|
: alpha(theme.palette.text.disabled, 0.2);
|
|
88
90
|
|
|
89
|
-
const interactiveValue =
|
|
91
|
+
const interactiveValue = displayAnchor
|
|
92
|
+
? getFormattedValue(line)
|
|
93
|
+
: null;
|
|
90
94
|
|
|
91
95
|
const minMaxAvg = [
|
|
92
96
|
{
|
|
@@ -118,7 +122,7 @@ const MainLegend = ({
|
|
|
118
122
|
<LegendMarker color={markerColor} disabled={!display} />
|
|
119
123
|
<div className={classes.legendData}>
|
|
120
124
|
<LegendHeader line={line} />
|
|
121
|
-
<InteractiveValue value={interactiveValue} />
|
|
125
|
+
{displayAnchor && <InteractiveValue value={interactiveValue} />}
|
|
122
126
|
{!interactiveValue && (
|
|
123
127
|
<div className={classes.minMaxAvgContainer}>
|
|
124
128
|
{minMaxAvg.map(({ label, value }) => (
|
|
@@ -141,12 +145,21 @@ const MainLegend = ({
|
|
|
141
145
|
};
|
|
142
146
|
|
|
143
147
|
const Legend = (props: Props): JSX.Element => {
|
|
144
|
-
const { toggable, limitLegendRows, timeSeries, lines, base } =
|
|
148
|
+
const { toggable, limitLegendRows, timeSeries, lines, base, displayAnchor } =
|
|
149
|
+
props;
|
|
145
150
|
const timeValue = useAtomValue(timeValueAtom);
|
|
146
151
|
|
|
147
152
|
return useMemoComponent({
|
|
148
153
|
Component: <MainLegend {...props} />,
|
|
149
|
-
memoProps: [
|
|
154
|
+
memoProps: [
|
|
155
|
+
timeValue,
|
|
156
|
+
timeSeries,
|
|
157
|
+
lines,
|
|
158
|
+
base,
|
|
159
|
+
toggable,
|
|
160
|
+
limitLegendRows,
|
|
161
|
+
displayAnchor
|
|
162
|
+
]
|
|
150
163
|
});
|
|
151
164
|
};
|
|
152
165
|
|
package/src/Graph/helpers/doc.ts
CHANGED
|
@@ -20,7 +20,6 @@ interface Prop {
|
|
|
20
20
|
interface Section {
|
|
21
21
|
description?: string;
|
|
22
22
|
name: string;
|
|
23
|
-
note?: string;
|
|
24
23
|
props: Array<Record<string, Prop>>;
|
|
25
24
|
type: string;
|
|
26
25
|
}
|
|
@@ -102,7 +101,6 @@ export const propsAxisX = [
|
|
|
102
101
|
];
|
|
103
102
|
|
|
104
103
|
export const propsAxisY = [
|
|
105
|
-
{ display: { description: 'display or not the axis', type: 'boolean' } },
|
|
106
104
|
{
|
|
107
105
|
displayUnit: {
|
|
108
106
|
description: 'display or not the unit of the axis',
|
|
@@ -112,29 +110,18 @@ export const propsAxisY = [
|
|
|
112
110
|
];
|
|
113
111
|
|
|
114
112
|
export const argTypes = {
|
|
115
|
-
|
|
113
|
+
annotationEvent: {
|
|
116
114
|
control: 'object',
|
|
117
115
|
description: getDescription({
|
|
118
116
|
sections: [
|
|
119
117
|
{
|
|
120
|
-
name: '
|
|
118
|
+
name: '',
|
|
121
119
|
props: [
|
|
122
120
|
{
|
|
123
|
-
|
|
124
|
-
description:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
],
|
|
129
|
-
type: 'object'
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: 'areaStackedLinesAnchorPoint',
|
|
133
|
-
props: [
|
|
134
|
-
{
|
|
135
|
-
display: {
|
|
136
|
-
description: 'display or not the anchor point',
|
|
137
|
-
type: 'boolean'
|
|
121
|
+
data: {
|
|
122
|
+
description:
|
|
123
|
+
'if the data is provided , events (comments,downtime,acknowledgement) will be displayed',
|
|
124
|
+
type: 'array of events'
|
|
138
125
|
}
|
|
139
126
|
}
|
|
140
127
|
],
|
|
@@ -145,23 +132,11 @@ export const argTypes = {
|
|
|
145
132
|
table: {
|
|
146
133
|
category: 'Graph interaction',
|
|
147
134
|
type: {
|
|
148
|
-
|
|
149
|
-
'displays the timing, circle, vertical and horizontal line for each point of the corresponding graph (line) according to the interaction of the mouse with the graph',
|
|
150
|
-
summary: 'object'
|
|
135
|
+
summary: 'display events'
|
|
151
136
|
}
|
|
152
137
|
}
|
|
153
138
|
},
|
|
154
139
|
axis: {
|
|
155
|
-
axisX: {
|
|
156
|
-
xAxisTickFormat: { control: 'text' }
|
|
157
|
-
},
|
|
158
|
-
axisYLeft: {
|
|
159
|
-
display: { control: 'boolean' },
|
|
160
|
-
displayUnit: { control: 'boolean' }
|
|
161
|
-
},
|
|
162
|
-
axisYRight: {
|
|
163
|
-
displayUnit: { control: 'boolean' }
|
|
164
|
-
},
|
|
165
140
|
control: 'object',
|
|
166
141
|
description: getDescription({
|
|
167
142
|
sections: [
|
|
@@ -189,16 +164,92 @@ export const argTypes = {
|
|
|
189
164
|
},
|
|
190
165
|
data: {
|
|
191
166
|
control: 'object',
|
|
192
|
-
description:
|
|
167
|
+
description: getDescription({
|
|
168
|
+
sections: [
|
|
169
|
+
{
|
|
170
|
+
name: '',
|
|
171
|
+
props: [
|
|
172
|
+
{
|
|
173
|
+
global: {
|
|
174
|
+
description: 'global data of graph like title ...',
|
|
175
|
+
type: 'object'
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
metrics: {
|
|
180
|
+
description: '',
|
|
181
|
+
type: 'array of object (ds_data)'
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
times: {
|
|
186
|
+
description: '',
|
|
187
|
+
type: 'array of dates -iso string-'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
type: 'object'
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}),
|
|
195
|
+
table: {
|
|
196
|
+
category: 'Graph data'
|
|
197
|
+
},
|
|
198
|
+
type: {
|
|
199
|
+
required: true
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
displayAnchor: {
|
|
203
|
+
control: 'boolean',
|
|
204
|
+
description:
|
|
205
|
+
'displays or not the timing, circle, vertical and horizontal line for each point of the corresponding graph (line) according to the interaction of the mouse with the graph',
|
|
206
|
+
table: {
|
|
207
|
+
category: 'Graph interaction',
|
|
208
|
+
type: { summary: 'boolean' }
|
|
209
|
+
}
|
|
193
210
|
},
|
|
194
211
|
end: {
|
|
195
212
|
control: 'text',
|
|
196
|
-
description: 'the end of the interval
|
|
213
|
+
description: 'the end of the interval',
|
|
197
214
|
table: {
|
|
198
215
|
category: 'Graph data',
|
|
199
216
|
type: {
|
|
200
217
|
detail: 'the end of the interval',
|
|
201
|
-
summary: 'ISOString
|
|
218
|
+
summary: 'ISOString'
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
type: {
|
|
222
|
+
required: true
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
header: {
|
|
226
|
+
control: 'object',
|
|
227
|
+
description: getDescription({
|
|
228
|
+
sections: [
|
|
229
|
+
{
|
|
230
|
+
name: '',
|
|
231
|
+
props: [
|
|
232
|
+
{
|
|
233
|
+
displayTitle: {
|
|
234
|
+
description: 'display or not the title of the graph',
|
|
235
|
+
type: 'boolean'
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
extraComponent: {
|
|
240
|
+
description: 'extra component to display on header graph',
|
|
241
|
+
type: 'React node'
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
type: 'object'
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
}),
|
|
249
|
+
table: {
|
|
250
|
+
category: 'Graph component',
|
|
251
|
+
type: {
|
|
252
|
+
summary: 'control header of the graph'
|
|
202
253
|
}
|
|
203
254
|
}
|
|
204
255
|
},
|
|
@@ -210,6 +261,48 @@ export const argTypes = {
|
|
|
210
261
|
type: { summary: 'number' }
|
|
211
262
|
}
|
|
212
263
|
},
|
|
264
|
+
legend: {
|
|
265
|
+
control: 'object',
|
|
266
|
+
description: getDescription({
|
|
267
|
+
sections: [
|
|
268
|
+
{
|
|
269
|
+
name: '',
|
|
270
|
+
props: [
|
|
271
|
+
{
|
|
272
|
+
display: {
|
|
273
|
+
description: 'display or not the legend',
|
|
274
|
+
type: 'boolean'
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
renderExtraComponent: {
|
|
279
|
+
description: 'extra component to render with legend ',
|
|
280
|
+
type: 'React node'
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
type: 'object'
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}),
|
|
288
|
+
table: {
|
|
289
|
+
category: 'Graph component',
|
|
290
|
+
type: {
|
|
291
|
+
summary: 'control applying zoom to a specific zoon'
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
loading: {
|
|
296
|
+
control: 'boolean',
|
|
297
|
+
description: 'the loading indicator ',
|
|
298
|
+
table: {
|
|
299
|
+
category: 'Graph data',
|
|
300
|
+
type: { summary: 'boolean' }
|
|
301
|
+
},
|
|
302
|
+
type: {
|
|
303
|
+
required: true
|
|
304
|
+
}
|
|
305
|
+
},
|
|
213
306
|
shapeLines: {
|
|
214
307
|
control: 'object',
|
|
215
308
|
description: getDescription({
|
|
@@ -231,9 +324,71 @@ export const argTypes = {
|
|
|
231
324
|
props: [
|
|
232
325
|
{
|
|
233
326
|
display: {
|
|
234
|
-
description: 'display or not the area',
|
|
327
|
+
description: 'display or not the area stacked lines',
|
|
328
|
+
type: 'boolean'
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
type: 'object'
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: 'areaThresholdLines',
|
|
336
|
+
props: [
|
|
337
|
+
{
|
|
338
|
+
display: {
|
|
339
|
+
description:
|
|
340
|
+
'display or not the area threshold lines , if not the component will display the corresponding graph according to the data (regular area lines)',
|
|
341
|
+
type: 'boolean'
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
displayCircles: {
|
|
346
|
+
description: 'display or not the circles',
|
|
235
347
|
type: 'boolean'
|
|
236
348
|
}
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
factors: {
|
|
352
|
+
description: getDescription({
|
|
353
|
+
sections: [
|
|
354
|
+
{
|
|
355
|
+
name: 'details',
|
|
356
|
+
props: [
|
|
357
|
+
{
|
|
358
|
+
currentFactorMultiplication: {
|
|
359
|
+
description:
|
|
360
|
+
'the variant to calculate the envelope variation',
|
|
361
|
+
type: 'number'
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
simulatedFactorMultiplication: {
|
|
366
|
+
description:
|
|
367
|
+
'the simulated factor of envelope variation',
|
|
368
|
+
type: 'number'
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
type: 'object'
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
}),
|
|
376
|
+
type: 'if the object is provided, the envelope variation of the graph is displayed according to the factors provided'
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
getCountDisplayedCircles: {
|
|
381
|
+
description:
|
|
382
|
+
'callback return the counted circles out of the envelope variation depends on mouse position relative to time value (t)',
|
|
383
|
+
type: '() => void'
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
dataExclusionPeriods: {
|
|
388
|
+
description:
|
|
389
|
+
'array of graph data ,showing threshold with Patter lines',
|
|
390
|
+
type: 'if the object is provided , the thresholds with pattern lines will be displayed'
|
|
391
|
+
}
|
|
237
392
|
}
|
|
238
393
|
],
|
|
239
394
|
type: 'object'
|
|
@@ -247,7 +402,7 @@ export const argTypes = {
|
|
|
247
402
|
},
|
|
248
403
|
start: {
|
|
249
404
|
control: 'text',
|
|
250
|
-
description: 'the beginning of the interval of time
|
|
405
|
+
description: 'the beginning of the interval of time ',
|
|
251
406
|
name: 'start',
|
|
252
407
|
table: {
|
|
253
408
|
category: 'Graph data',
|
|
@@ -255,6 +410,67 @@ export const argTypes = {
|
|
|
255
410
|
detail: 'the beginning of the interval',
|
|
256
411
|
summary: 'ISOString (required*)'
|
|
257
412
|
}
|
|
413
|
+
},
|
|
414
|
+
type: {
|
|
415
|
+
required: true
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
timeShiftZones: {
|
|
419
|
+
control: 'object',
|
|
420
|
+
description: getDescription({
|
|
421
|
+
sections: [
|
|
422
|
+
{
|
|
423
|
+
name: '',
|
|
424
|
+
props: [
|
|
425
|
+
{
|
|
426
|
+
enable: {
|
|
427
|
+
description: 'enable or not the action drag',
|
|
428
|
+
type: 'boolean'
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
getInterval: {
|
|
433
|
+
description:
|
|
434
|
+
'callback return the new interval of the graph (end, start) after the action drag',
|
|
435
|
+
type: '({end,start}) => void'
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
type: 'object'
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
}),
|
|
443
|
+
table: {
|
|
444
|
+
category: 'Graph interaction',
|
|
445
|
+
type: {
|
|
446
|
+
summary: 'control applying zoom to a specific zoon'
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
tooltip: {
|
|
451
|
+
control: 'object',
|
|
452
|
+
description: getDescription({
|
|
453
|
+
sections: [
|
|
454
|
+
{
|
|
455
|
+
name: '',
|
|
456
|
+
props: [
|
|
457
|
+
{
|
|
458
|
+
renderComponent: {
|
|
459
|
+
description:
|
|
460
|
+
'render function with given props of tooltip data (date of the tooltip position depend on the mouse click , hideTooltip callback to hide tooltip , boolean of is tooltip opened)',
|
|
461
|
+
type: '({data,hideTooltip,tooltipOpen}) => void , if the component provided the tooltip displays'
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
type: 'object'
|
|
466
|
+
}
|
|
467
|
+
]
|
|
468
|
+
}),
|
|
469
|
+
table: {
|
|
470
|
+
category: 'Graph interaction',
|
|
471
|
+
type: {
|
|
472
|
+
summary: 'control graph tooltip'
|
|
473
|
+
}
|
|
258
474
|
}
|
|
259
475
|
},
|
|
260
476
|
width: {
|
|
@@ -273,10 +489,17 @@ export const argTypes = {
|
|
|
273
489
|
name: '',
|
|
274
490
|
props: [
|
|
275
491
|
{
|
|
276
|
-
|
|
492
|
+
enable: {
|
|
277
493
|
description: 'enable or not the zoomPreview',
|
|
278
494
|
type: 'boolean'
|
|
279
495
|
}
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
getInterval: {
|
|
499
|
+
description:
|
|
500
|
+
'callback return the new interval of the graph (end, start) after applying zoom',
|
|
501
|
+
type: '({end,start}) => void'
|
|
502
|
+
}
|
|
280
503
|
}
|
|
281
504
|
],
|
|
282
505
|
type: 'object'
|
|
@@ -286,31 +509,21 @@ export const argTypes = {
|
|
|
286
509
|
table: {
|
|
287
510
|
category: 'Graph interaction',
|
|
288
511
|
type: {
|
|
289
|
-
summary: '
|
|
512
|
+
summary: 'control applying zoom to a specific zoon'
|
|
290
513
|
}
|
|
291
514
|
}
|
|
292
515
|
}
|
|
293
516
|
};
|
|
294
517
|
|
|
295
518
|
export const args = {
|
|
296
|
-
anchorPoint: {
|
|
297
|
-
areaRegularLinesAnchorPoint: {
|
|
298
|
-
display: true
|
|
299
|
-
},
|
|
300
|
-
areaStackedLinesAnchorPoint: {
|
|
301
|
-
display: true
|
|
302
|
-
},
|
|
303
|
-
areaThresholdLines: {
|
|
304
|
-
display: true
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
519
|
axis: {
|
|
308
|
-
// axisX: { xAxisTickFormat: undefined },
|
|
309
520
|
axisYLeft: { displayUnit: true },
|
|
310
|
-
axisYRight: {
|
|
521
|
+
axisYRight: { displayUnit: true }
|
|
311
522
|
},
|
|
523
|
+
displayAnchor: true,
|
|
312
524
|
end: defaultEnd,
|
|
313
525
|
height: 500,
|
|
526
|
+
loading: false,
|
|
314
527
|
shapeLines: {
|
|
315
528
|
areaRegularLines: {
|
|
316
529
|
display: true
|
|
@@ -27,7 +27,7 @@ import exclusionPeriodFirstPeriod from './mockedData/exclusionPeriodFirstPeriod.
|
|
|
27
27
|
import exclusionPeriodFourthPeriod from './mockedData/exclusionPeriodFourthPeriod.json';
|
|
28
28
|
import exclusionPeriodSecondPeriod from './mockedData/exclusionPeriodSecondPeriod.json';
|
|
29
29
|
import dataLastDayForword from './mockedData/lastDayForward.json';
|
|
30
|
-
import dataLastDay from './mockedData/
|
|
30
|
+
import dataLastDay from './mockedData/lastDayThreshold.json';
|
|
31
31
|
import dataLastMonth from './mockedData/lastMonth.json';
|
|
32
32
|
import dataLastWeek from './mockedData/lastWeek.json';
|
|
33
33
|
import dataZoomPreview from './mockedData/zoomPreview.json';
|
package/src/Graph/models.ts
CHANGED
|
@@ -67,7 +67,6 @@ export interface TooltipData {
|
|
|
67
67
|
tooltipOpen: boolean;
|
|
68
68
|
}
|
|
69
69
|
export interface Tooltip {
|
|
70
|
-
enable?: boolean;
|
|
71
70
|
renderComponent?: (args: TooltipData) => ReactNode;
|
|
72
71
|
}
|
|
73
72
|
|
|
@@ -99,6 +98,7 @@ export interface Area {
|
|
|
99
98
|
|
|
100
99
|
export interface ThresholdArea extends Area {
|
|
101
100
|
dataExclusionPeriods?: Array<GraphData>;
|
|
101
|
+
displayCircles?: boolean;
|
|
102
102
|
factors?: FactorsVariation;
|
|
103
103
|
getCountDisplayedCircles?: (value: number) => void;
|
|
104
104
|
}
|
|
@@ -109,5 +109,6 @@ export interface GlobalAreaLines {
|
|
|
109
109
|
areaThresholdLines?: ThresholdArea;
|
|
110
110
|
}
|
|
111
111
|
export interface LegendModel {
|
|
112
|
+
display?: boolean;
|
|
112
113
|
renderExtraComponent?: ReactNode;
|
|
113
114
|
}
|
package/src/Graph/map.md
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
markmap:
|
|
3
|
-
colorFreezeLevel: 2
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# WrapperGraph
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Graph
|
|
11
|
-
### Header
|
|
12
|
-
###
|
|
13
|
-
#### Grids
|
|
14
|
-
- Grid_Rows
|
|
15
|
-
- Grid_Columns
|
|
16
|
-
#### Axes
|
|
17
|
-
- Axis_Bottom
|
|
18
|
-
- Axis_Left
|
|
19
|
-
- Axis_Right
|
|
20
|
-
|
|
21
|
-
#### Lines
|
|
22
|
-
##### StackedLines
|
|
23
|
-
- shape_AreaStack
|
|
24
|
-
- StackedLines_AnchorPoint
|
|
25
|
-
|
|
26
|
-
#####
|
|
27
|
-
###### RegularLines_AnchorPoint
|
|
28
|
-
###### RegularLines
|
|
29
|
-
- shape_AreaClosed
|
|
30
|
-
- shape_LinePath
|
|
31
|
-
|
|
32
|
-
#### Interaction_With_Graph
|
|
33
|
-
- ZoomPreview
|
|
34
|
-
- Add_Tooltip (Comment)
|
|
35
|
-
- Annotation
|
|
36
|
-
- Time_Shift
|
|
37
|
-
#### Legend
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
package/src/TimePeriods/map.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
markmap:
|
|
3
|
-
colorFreezeLevel: 2
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# AwesomeTimePeriod
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## SelectedTimePeriod
|
|
11
|
-
### ButtonGroups (dates to select)
|
|
12
|
-
## CustomTimePeriod
|
|
13
|
-
### CompactCustomTimePeriod (date [To-From] to show popover)
|
|
14
|
-
### PopoverCustomTimePeriod
|
|
15
|
-
#### Popover_PickersDtartEndInput
|
|
16
|
-
##### PickerDateWithLabel (represent PickerDateStartInput)
|
|
17
|
-
###### PickerDateTime
|
|
18
|
-
##### PickerDateWithLabel (represent PickerDateEndInput)
|
|
19
|
-
###### PickerDateTime
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|