@centreon/ui 24.6.0 → 24.6.2
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/Dashboard/Item.tsx +25 -8
- package/src/Dashboard/Layout.tsx +15 -1
- package/src/Dashboard/atoms.ts +3 -0
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +1 -1
- package/src/Graph/BarStack/BarStack.stories.tsx +15 -0
- package/src/Graph/BarStack/BarStack.styles.ts +5 -1
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +18 -15
- package/src/Graph/BarStack/useResponsiveBarStack.ts +4 -8
- package/src/Graph/Gauge/AnimatedPie.tsx +3 -1
- package/src/Graph/Gauge/Gauge.stories.tsx +10 -2
- package/src/Graph/Gauge/PieData.tsx +9 -4
- package/src/Graph/Gauge/ResponsiveGauge.tsx +55 -69
- package/src/Graph/Gauge/Thresholds.tsx +5 -3
- package/src/Graph/Gauge/utils.ts +4 -0
- package/src/Graph/HeatMap/HeatMap.tsx +3 -1
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +12 -4
- package/src/Graph/LineChart/Header/index.tsx +2 -2
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +1 -1
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +5 -3
- package/src/Graph/LineChart/Legend/Legend.styles.ts +10 -3
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +3 -1
- package/src/Graph/LineChart/Legend/index.tsx +19 -3
- package/src/Graph/LineChart/LineChart.styles.ts +4 -47
- package/src/Graph/LineChart/LineChart.tsx +132 -211
- package/src/Graph/LineChart/index.stories.tsx +3 -1
- package/src/Graph/LineChart/models.ts +1 -5
- package/src/Graph/PieChart/PieChart.cypress.spec.tsx +1 -1
- package/src/Graph/PieChart/PieChart.stories.tsx +14 -0
- package/src/Graph/PieChart/ResponsivePie.tsx +15 -9
- package/src/Graph/PieChart/useResponsivePie.ts +0 -3
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +65 -68
- package/src/Graph/SingleBar/SingleBar.stories.tsx +28 -0
- package/src/Graph/SingleBar/ThresholdLine.tsx +14 -18
- package/src/Graph/SingleBar/Thresholds.tsx +9 -1
- package/src/Graph/Text/Text.stories.tsx +32 -0
- package/src/Graph/Text/Text.styles.ts +0 -1
- package/src/Graph/Text/Text.tsx +11 -7
- package/src/Graph/{LineChart/BasicComponents → common}/Axes/UnitLabel.tsx +1 -1
- package/src/Graph/{LineChart/BasicComponents → common}/Axes/index.tsx +8 -7
- package/src/Graph/{LineChart/BasicComponents → common}/Axes/models.ts +2 -2
- package/src/Graph/{LineChart/BasicComponents → common}/Axes/useAxisY.ts +2 -2
- package/src/Graph/common/BaseChart/BaseChart.tsx +114 -0
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +75 -0
- package/src/Graph/common/BaseChart/useBaseChartStyles.ts +38 -0
- package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +61 -0
- package/src/Graph/{LineChart/BasicComponents → common}/Grids/index.tsx +1 -1
- package/src/Graph/common/useTooltipStyles.ts +17 -0
- package/src/Graph/common/utils.ts +6 -0
- package/src/Typography/FluidTypography/index.tsx +5 -3
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
isNil,
|
|
8
8
|
prop,
|
|
9
9
|
reverse,
|
|
10
|
-
sortBy
|
|
10
|
+
sortBy,
|
|
11
|
+
T
|
|
11
12
|
} from 'ramda';
|
|
12
13
|
|
|
13
14
|
import { graphTooltipDataAtom } from '../interactionWithGraphAtoms';
|
|
@@ -29,7 +30,7 @@ export const useGraphValueTooltip = ({
|
|
|
29
30
|
const { toDate, toTime } = useLocaleDateTimeFormat();
|
|
30
31
|
const graphTooltipData = useAtomValue(graphTooltipDataAtom);
|
|
31
32
|
|
|
32
|
-
if (isNil(graphTooltipData)) {
|
|
33
|
+
if (isNil(graphTooltipData) || isNil(graphTooltipData.metrics)) {
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -48,7 +49,8 @@ export const useGraphValueTooltip = ({
|
|
|
48
49
|
[
|
|
49
50
|
equals('descending'),
|
|
50
51
|
always(reverse(sortBy(prop('value'), filteredMetrics)))
|
|
51
|
-
]
|
|
52
|
+
],
|
|
53
|
+
[T, always(filteredMetrics)]
|
|
52
54
|
])(sortOrder);
|
|
53
55
|
|
|
54
56
|
return {
|
|
@@ -16,7 +16,7 @@ export const useStyles = makeStyles<MakeStylesProps>()(
|
|
|
16
16
|
color: theme.typography.body1.color
|
|
17
17
|
},
|
|
18
18
|
item: {
|
|
19
|
-
width: '
|
|
19
|
+
width: '100%'
|
|
20
20
|
},
|
|
21
21
|
items: {
|
|
22
22
|
'&[data-as-list="true"]': {
|
|
@@ -93,7 +93,7 @@ export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
|
93
93
|
width: theme.spacing(1.5)
|
|
94
94
|
},
|
|
95
95
|
legendName: {
|
|
96
|
-
maxWidth: '
|
|
96
|
+
maxWidth: '95%'
|
|
97
97
|
},
|
|
98
98
|
legendNameSide: {
|
|
99
99
|
maxWidth: '95%'
|
|
@@ -113,11 +113,18 @@ export const useLegendHeaderStyles = makeStyles<StylesProps>()(
|
|
|
113
113
|
text: {
|
|
114
114
|
fontSize: '0.75rem',
|
|
115
115
|
fontWeight: theme.typography.fontWeightMedium,
|
|
116
|
-
lineHeight: 1
|
|
116
|
+
lineHeight: 1,
|
|
117
|
+
maxWidth: '250px'
|
|
117
118
|
},
|
|
118
119
|
textList: {
|
|
119
120
|
fontSize: '0.75rem',
|
|
120
121
|
fontWeight: theme.typography.fontWeightMedium
|
|
122
|
+
},
|
|
123
|
+
textListBottom: {
|
|
124
|
+
width: 'auto'
|
|
125
|
+
},
|
|
126
|
+
textListSide: {
|
|
127
|
+
width: '95%'
|
|
121
128
|
}
|
|
122
129
|
})
|
|
123
130
|
);
|
|
@@ -77,7 +77,9 @@ const LegendHeader = ({
|
|
|
77
77
|
className={cx(
|
|
78
78
|
classes.text,
|
|
79
79
|
!isListMode && classes.legendName,
|
|
80
|
-
!isListMode && isDisplayedOnSide && classes.legendNameSide
|
|
80
|
+
!isListMode && isDisplayedOnSide && classes.legendNameSide,
|
|
81
|
+
isListMode && !isDisplayedOnSide && classes.textListBottom,
|
|
82
|
+
isListMode && isDisplayedOnSide && classes.textListSide
|
|
81
83
|
)}
|
|
82
84
|
data-mode={
|
|
83
85
|
value ? LegendDisplayMode.Compact : LegendDisplayMode.Normal
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, ReactNode, SetStateAction, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import { equals, prop, slice, sortBy } from 'ramda';
|
|
3
|
+
import { equals, lt, prop, slice, sortBy } from 'ramda';
|
|
4
4
|
|
|
5
5
|
import { Box, alpha, useTheme } from '@mui/material';
|
|
6
6
|
|
|
@@ -81,14 +81,30 @@ const MainLegend = ({
|
|
|
81
81
|
? LegendDisplayMode.Compact
|
|
82
82
|
: LegendDisplayMode.Normal;
|
|
83
83
|
|
|
84
|
+
const legendMaxHeight = useMemo(() => {
|
|
85
|
+
if (!isListMode || !equals(placement, 'bottom')) {
|
|
86
|
+
return 'none';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (lt(height || 0, 220)) {
|
|
90
|
+
return 40;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return 90;
|
|
94
|
+
}, [height, isListMode, placement]);
|
|
95
|
+
|
|
96
|
+
const overflow = equals(legendMaxHeight, 'none') ? 'hidden' : 'auto';
|
|
97
|
+
|
|
84
98
|
return (
|
|
85
99
|
<div
|
|
86
100
|
className={classes.legend}
|
|
87
101
|
data-display-side={!equals(placement, 'bottom')}
|
|
88
102
|
style={{
|
|
89
103
|
height: !equals(placement, 'bottom')
|
|
90
|
-
? height - margin.top / 2
|
|
91
|
-
: undefined
|
|
104
|
+
? (height || 0) - margin.top / 2
|
|
105
|
+
: undefined,
|
|
106
|
+
maxHeight: legendMaxHeight,
|
|
107
|
+
overflow
|
|
92
108
|
}}
|
|
93
109
|
>
|
|
94
110
|
<div
|
|
@@ -1,53 +1,10 @@
|
|
|
1
1
|
import { makeStyles } from 'tss-react/mui';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
container: {
|
|
5
|
-
'& .visx-axis-bottom': {
|
|
6
|
-
'& .visx-axis-tick': {
|
|
7
|
-
'& .visx-line': {
|
|
8
|
-
stroke: theme.palette.text.primary
|
|
9
|
-
},
|
|
10
|
-
text: {
|
|
11
|
-
fill: theme.palette.text.primary
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
'& .visx-axis-line': {
|
|
16
|
-
stroke: theme.palette.text.primary
|
|
17
|
-
},
|
|
18
|
-
'& .visx-axis-right': {
|
|
19
|
-
'& .visx-axis-tick': {
|
|
20
|
-
'& .visx-line': {
|
|
21
|
-
stroke: theme.palette.text.primary
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
'& .visx-columns': {
|
|
26
|
-
'& .visx-line': {
|
|
27
|
-
stroke: theme.palette.divider
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
'& .visx-rows': {
|
|
31
|
-
'& .visx-line': {
|
|
32
|
-
stroke: theme.palette.divider
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
fill: theme.palette.text.primary,
|
|
36
|
-
position: 'relative'
|
|
37
|
-
},
|
|
38
|
-
graphValueTooltip: {
|
|
39
|
-
backgroundColor: theme.palette.background.paper,
|
|
40
|
-
borderRadius: theme.shape.borderRadius,
|
|
41
|
-
boxShadow: theme.shadows[3],
|
|
42
|
-
color: theme.palette.text.primary,
|
|
43
|
-
maxWidth: 'none',
|
|
44
|
-
padding: 0
|
|
45
|
-
},
|
|
3
|
+
export const useLineChartStyles = makeStyles()({
|
|
46
4
|
header: {
|
|
47
5
|
display: 'grid',
|
|
48
6
|
gridTemplateColumns: '0.4fr 1fr 0.4fr',
|
|
49
7
|
width: '100%'
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { useStyles };
|
|
8
|
+
},
|
|
9
|
+
tooltipChildren: { height: '100%', width: '100%' }
|
|
10
|
+
});
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { MutableRefObject, useMemo, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { equals, flatten,
|
|
3
|
+
import { Tooltip } from '@visx/visx';
|
|
4
|
+
import { equals, flatten, isNil, pluck } from 'ramda';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
ClickAwayListener,
|
|
8
|
-
Fade,
|
|
9
|
-
Skeleton,
|
|
10
|
-
Stack,
|
|
11
|
-
useTheme
|
|
12
|
-
} from '@mui/material';
|
|
6
|
+
import { ClickAwayListener, Fade, Skeleton, useTheme } from '@mui/material';
|
|
13
7
|
|
|
14
8
|
import {
|
|
15
9
|
getLeftScale,
|
|
@@ -20,26 +14,24 @@ import {
|
|
|
20
14
|
import { Line } from '../common/timeSeries/models';
|
|
21
15
|
import { Thresholds as ThresholdsModel } from '../common/models';
|
|
22
16
|
import { Tooltip as MuiTooltip } from '../../components/Tooltip';
|
|
17
|
+
import { useTooltipStyles } from '../common/useTooltipStyles';
|
|
18
|
+
import BaseChart from '../common/BaseChart/BaseChart';
|
|
19
|
+
import { useComputeBaseChartDimensions } from '../common/BaseChart/useComputeBaseChartDimensions';
|
|
20
|
+
import ChartSvgWrapper from '../common/BaseChart/ChartSvgWrapper';
|
|
23
21
|
|
|
24
|
-
import Axes from './BasicComponents/Axes';
|
|
25
|
-
import Grids from './BasicComponents/Grids';
|
|
26
22
|
import Lines from './BasicComponents/Lines';
|
|
27
23
|
import { canDisplayThreshold } from './BasicComponents/Lines/Threshold/models';
|
|
28
24
|
import useFilterLines from './BasicComponents/useFilterLines';
|
|
29
|
-
import { useStyles } from './LineChart.styles';
|
|
30
25
|
import Header from './Header';
|
|
31
26
|
import InteractionWithGraph from './InteractiveComponents';
|
|
32
27
|
import GraphTooltip from './InteractiveComponents/Tooltip';
|
|
33
28
|
import useGraphTooltip from './InteractiveComponents/Tooltip/useGraphTooltip';
|
|
34
|
-
import Legend from './Legend';
|
|
35
29
|
import { margin } from './common';
|
|
36
30
|
import { Data, GlobalAreaLines, GraphInterval, LineChartProps } from './models';
|
|
37
31
|
import { useIntersection } from './useLineChartIntersection';
|
|
38
32
|
import Thresholds from './BasicComponents/Thresholds';
|
|
39
|
-
import { legendWidth } from './Legend/Legend.styles';
|
|
40
33
|
import GraphValueTooltip from './InteractiveComponents/GraphValueTooltip/GraphValueTooltip';
|
|
41
|
-
|
|
42
|
-
const extraMargin = 10;
|
|
34
|
+
import { useLineChartStyles } from './LineChart.styles';
|
|
43
35
|
|
|
44
36
|
interface Props extends LineChartProps {
|
|
45
37
|
graphData: Data;
|
|
@@ -76,7 +68,8 @@ const LineChart = ({
|
|
|
76
68
|
thresholdUnit,
|
|
77
69
|
limitLegend
|
|
78
70
|
}: Props): JSX.Element => {
|
|
79
|
-
const { classes } =
|
|
71
|
+
const { classes } = useLineChartStyles();
|
|
72
|
+
const { classes: tooltipClasses, cx } = useTooltipStyles();
|
|
80
73
|
|
|
81
74
|
const theme = useTheme();
|
|
82
75
|
|
|
@@ -85,8 +78,6 @@ const LineChart = ({
|
|
|
85
78
|
|
|
86
79
|
const { isInViewport } = useIntersection({ element: graphRef?.current });
|
|
87
80
|
|
|
88
|
-
const legendRef = useRef<HTMLDivElement | null>(null);
|
|
89
|
-
|
|
90
81
|
const {
|
|
91
82
|
tooltipOpen: thresholdTooltipOpen,
|
|
92
83
|
tooltipLeft: thresholdTooltipLeft,
|
|
@@ -103,38 +94,22 @@ const LineChart = ({
|
|
|
103
94
|
pluck('value', thresholds?.critical || [])
|
|
104
95
|
]);
|
|
105
96
|
|
|
106
|
-
const { displayedLines
|
|
97
|
+
const { displayedLines } = useFilterLines({
|
|
107
98
|
displayThreshold: canDisplayThreshold(shapeLines?.areaThresholdLines),
|
|
108
99
|
lines,
|
|
109
100
|
linesGraph,
|
|
110
101
|
setLinesGraph
|
|
111
102
|
});
|
|
112
103
|
|
|
113
|
-
const legendBoundingHeight =
|
|
114
|
-
!equals(legend?.display, false) &&
|
|
115
|
-
(isNil(legend?.placement) || equals(legend?.placement, 'bottom'))
|
|
116
|
-
? legendRef.current?.getBoundingClientRect().height || 0
|
|
117
|
-
: 0;
|
|
118
|
-
const legendBoundingWidth =
|
|
119
|
-
!equals(legend?.display, false) &&
|
|
120
|
-
(equals(legend?.placement, 'left') || equals(legend?.placement, 'right'))
|
|
121
|
-
? legendRef.current?.getBoundingClientRect().width || 0
|
|
122
|
-
: 0;
|
|
123
|
-
|
|
124
104
|
const [, secondUnit] = getUnits(displayedLines);
|
|
125
105
|
|
|
126
|
-
const graphWidth =
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
: 0;
|
|
134
|
-
const graphHeight =
|
|
135
|
-
(height || 0) > 0
|
|
136
|
-
? (height || 0) - margin.top - 5 - legendBoundingHeight
|
|
137
|
-
: 0;
|
|
106
|
+
const { legendRef, graphWidth, graphHeight } = useComputeBaseChartDimensions({
|
|
107
|
+
hasSecondUnit: Boolean(secondUnit),
|
|
108
|
+
height,
|
|
109
|
+
legendDisplay: legend?.display,
|
|
110
|
+
legendPlacement: legend?.placement,
|
|
111
|
+
width
|
|
112
|
+
});
|
|
138
113
|
|
|
139
114
|
const xScale = useMemo(
|
|
140
115
|
() =>
|
|
@@ -199,20 +174,6 @@ const LineChart = ({
|
|
|
199
174
|
const displayLegend = legend?.display ?? true;
|
|
200
175
|
const displayTooltip = !isNil(tooltip?.renderComponent);
|
|
201
176
|
|
|
202
|
-
const legendItemsWidth = reduce(
|
|
203
|
-
(acc) => acc + legendWidth * 8 + 24,
|
|
204
|
-
0,
|
|
205
|
-
displayedLines
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const displayLegendInBottom =
|
|
209
|
-
isNil(legend?.placement) || equals(legend?.placement, 'bottom');
|
|
210
|
-
|
|
211
|
-
const shouldDisplayLegendInCompactMode =
|
|
212
|
-
lte(graphWidth, 808) &&
|
|
213
|
-
gt(legendItemsWidth, graphWidth) &&
|
|
214
|
-
displayLegendInBottom;
|
|
215
|
-
|
|
216
177
|
const showGridLines = useMemo(
|
|
217
178
|
() => isNil(axis?.showGridLines) || axis?.showGridLines,
|
|
218
179
|
[axis?.showGridLines]
|
|
@@ -232,170 +193,130 @@ const LineChart = ({
|
|
|
232
193
|
<>
|
|
233
194
|
<Header header={header} title={title} />
|
|
234
195
|
<ClickAwayListener onClickAway={graphTooltipData?.hideTooltip}>
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
<
|
|
252
|
-
|
|
253
|
-
|
|
196
|
+
<>
|
|
197
|
+
<BaseChart
|
|
198
|
+
base={baseAxis}
|
|
199
|
+
graphWidth={graphWidth}
|
|
200
|
+
height={height}
|
|
201
|
+
legend={{
|
|
202
|
+
displayLegend,
|
|
203
|
+
mode: legend?.mode,
|
|
204
|
+
placement: legend?.placement,
|
|
205
|
+
renderExtraComponent: legend?.renderExtraComponent
|
|
206
|
+
}}
|
|
207
|
+
legendRef={legendRef}
|
|
208
|
+
limitLegend={limitLegend}
|
|
209
|
+
lines={displayedLines}
|
|
210
|
+
setLines={setLinesGraph}
|
|
211
|
+
>
|
|
212
|
+
<MuiTooltip
|
|
213
|
+
classes={{
|
|
214
|
+
tooltip: cx(
|
|
215
|
+
tooltipClasses.tooltip,
|
|
216
|
+
tooltipClasses.tooltipDisablePadding
|
|
217
|
+
)
|
|
218
|
+
}}
|
|
219
|
+
placement="top-start"
|
|
220
|
+
title={
|
|
221
|
+
equals('hidden', tooltip?.mode) ? null : (
|
|
222
|
+
<GraphValueTooltip
|
|
223
|
+
base={baseAxis}
|
|
224
|
+
isSingleMode={equals('single', tooltip?.mode)}
|
|
225
|
+
sortOrder={tooltip?.sortOrder}
|
|
226
|
+
/>
|
|
227
|
+
)
|
|
254
228
|
}
|
|
255
229
|
>
|
|
256
|
-
{
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
shouldDisplayLegendInCompactMode
|
|
271
|
-
}
|
|
272
|
-
width={width}
|
|
273
|
-
/>
|
|
274
|
-
</div>
|
|
275
|
-
)}
|
|
276
|
-
<svg
|
|
277
|
-
height={graphHeight + margin.top}
|
|
278
|
-
ref={graphSvgRef}
|
|
279
|
-
width="100%"
|
|
280
|
-
>
|
|
281
|
-
<Group.Group
|
|
282
|
-
left={margin.left + extraMargin / 2}
|
|
283
|
-
top={margin.top}
|
|
230
|
+
<div className={classes.tooltipChildren}>
|
|
231
|
+
<ChartSvgWrapper
|
|
232
|
+
axis={axis}
|
|
233
|
+
base={baseAxis}
|
|
234
|
+
displayedLines={displayedLines}
|
|
235
|
+
graphHeight={graphHeight}
|
|
236
|
+
graphWidth={graphWidth}
|
|
237
|
+
gridLinesType={axis?.gridLinesType}
|
|
238
|
+
leftScale={leftScale}
|
|
239
|
+
rightScale={rightScale}
|
|
240
|
+
showGridLines={showGridLines}
|
|
241
|
+
svgRef={graphSvgRef}
|
|
242
|
+
timeSeries={timeSeries}
|
|
243
|
+
xScale={xScale}
|
|
284
244
|
>
|
|
285
|
-
|
|
286
|
-
<
|
|
287
|
-
|
|
245
|
+
<>
|
|
246
|
+
<Lines
|
|
247
|
+
areaTransparency={lineStyle?.areaTransparency}
|
|
248
|
+
curve={lineStyle?.curve || 'linear'}
|
|
249
|
+
dashLength={lineStyle?.dashLength}
|
|
250
|
+
dashOffset={lineStyle?.dashOffset}
|
|
251
|
+
displayAnchor={displayAnchor}
|
|
252
|
+
displayedLines={displayedLines}
|
|
253
|
+
dotOffset={lineStyle?.dotOffset}
|
|
254
|
+
graphSvgRef={graphSvgRef}
|
|
288
255
|
height={graphHeight - margin.top}
|
|
289
256
|
leftScale={leftScale}
|
|
257
|
+
lineWidth={lineStyle?.lineWidth}
|
|
258
|
+
rightScale={rightScale}
|
|
259
|
+
showArea={lineStyle?.showArea}
|
|
260
|
+
showPoints={lineStyle?.showPoints}
|
|
261
|
+
timeSeries={timeSeries}
|
|
290
262
|
width={graphWidth}
|
|
291
263
|
xScale={xScale}
|
|
264
|
+
{...shapeLines}
|
|
292
265
|
/>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
areaTransparency={lineStyle?.areaTransparency}
|
|
311
|
-
curve={lineStyle?.curve || 'linear'}
|
|
312
|
-
dashLength={lineStyle?.dashLength}
|
|
313
|
-
dashOffset={lineStyle?.dashOffset}
|
|
314
|
-
displayAnchor={displayAnchor}
|
|
315
|
-
displayedLines={displayedLines}
|
|
316
|
-
dotOffset={lineStyle?.dotOffset}
|
|
317
|
-
graphSvgRef={graphSvgRef}
|
|
318
|
-
height={graphHeight - margin.top}
|
|
319
|
-
leftScale={leftScale}
|
|
320
|
-
lineWidth={lineStyle?.lineWidth}
|
|
321
|
-
rightScale={rightScale}
|
|
322
|
-
showArea={lineStyle?.showArea}
|
|
323
|
-
showPoints={lineStyle?.showPoints}
|
|
324
|
-
timeSeries={timeSeries}
|
|
325
|
-
width={graphWidth}
|
|
326
|
-
xScale={xScale}
|
|
327
|
-
{...shapeLines}
|
|
328
|
-
/>
|
|
329
|
-
|
|
330
|
-
<InteractionWithGraph
|
|
331
|
-
annotationData={{ ...annotationEvent }}
|
|
332
|
-
commonData={{
|
|
333
|
-
graphHeight,
|
|
334
|
-
graphSvgRef,
|
|
335
|
-
graphWidth,
|
|
336
|
-
leftScale,
|
|
337
|
-
lines: displayedLines,
|
|
338
|
-
rightScale,
|
|
339
|
-
timeSeries,
|
|
340
|
-
xScale
|
|
341
|
-
}}
|
|
342
|
-
timeShiftZonesData={{
|
|
343
|
-
...timeShiftZones,
|
|
344
|
-
graphInterval
|
|
345
|
-
}}
|
|
346
|
-
zoomData={{ ...zoomPreview }}
|
|
347
|
-
/>
|
|
348
|
-
|
|
349
|
-
{thresholds?.enabled && (
|
|
350
|
-
<Thresholds
|
|
351
|
-
displayedLines={displayedLines}
|
|
352
|
-
hideTooltip={hideThresholdTooltip}
|
|
353
|
-
leftScale={leftScale}
|
|
354
|
-
rightScale={rightScale}
|
|
355
|
-
showTooltip={showThresholdTooltip}
|
|
356
|
-
thresholdUnit={thresholdUnit}
|
|
357
|
-
thresholds={thresholds as ThresholdsModel}
|
|
358
|
-
width={graphWidth}
|
|
266
|
+
<InteractionWithGraph
|
|
267
|
+
annotationData={{ ...annotationEvent }}
|
|
268
|
+
commonData={{
|
|
269
|
+
graphHeight,
|
|
270
|
+
graphSvgRef,
|
|
271
|
+
graphWidth,
|
|
272
|
+
leftScale,
|
|
273
|
+
lines: displayedLines,
|
|
274
|
+
rightScale,
|
|
275
|
+
timeSeries,
|
|
276
|
+
xScale
|
|
277
|
+
}}
|
|
278
|
+
timeShiftZonesData={{
|
|
279
|
+
...timeShiftZones,
|
|
280
|
+
graphInterval
|
|
281
|
+
}}
|
|
282
|
+
zoomData={{ ...zoomPreview }}
|
|
359
283
|
/>
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
284
|
+
{thresholds?.enabled && (
|
|
285
|
+
<Thresholds
|
|
286
|
+
displayedLines={displayedLines}
|
|
287
|
+
hideTooltip={hideThresholdTooltip}
|
|
288
|
+
leftScale={leftScale}
|
|
289
|
+
rightScale={rightScale}
|
|
290
|
+
showTooltip={showThresholdTooltip}
|
|
291
|
+
thresholdUnit={thresholdUnit}
|
|
292
|
+
thresholds={thresholds as ThresholdsModel}
|
|
293
|
+
width={graphWidth}
|
|
294
|
+
/>
|
|
295
|
+
)}
|
|
296
|
+
</>
|
|
297
|
+
</ChartSvgWrapper>
|
|
298
|
+
</div>
|
|
299
|
+
</MuiTooltip>
|
|
300
|
+
</BaseChart>
|
|
301
|
+
{displayTooltip && (
|
|
302
|
+
<GraphTooltip {...tooltip} {...graphTooltipData} />
|
|
303
|
+
)}
|
|
304
|
+
<Fade in={thresholdTooltipOpen}>
|
|
305
|
+
<Tooltip.Tooltip
|
|
306
|
+
left={thresholdTooltipLeft}
|
|
307
|
+
style={{
|
|
308
|
+
...baseStyles,
|
|
309
|
+
backgroundColor: theme.palette.background.paper,
|
|
310
|
+
color: theme.palette.text.primary,
|
|
311
|
+
transform: `translate(${graphWidth / 2}px, -10px)`
|
|
312
|
+
}}
|
|
313
|
+
top={thresholdTooltipTop}
|
|
314
|
+
>
|
|
315
|
+
{thresholdTooltipData}
|
|
316
|
+
</Tooltip.Tooltip>
|
|
317
|
+
</Fade>
|
|
318
|
+
</>
|
|
383
319
|
</ClickAwayListener>
|
|
384
|
-
{displayLegend && displayLegendInBottom && (
|
|
385
|
-
<div ref={legendRef}>
|
|
386
|
-
<Legend
|
|
387
|
-
base={baseAxis}
|
|
388
|
-
height={height}
|
|
389
|
-
limitLegend={limitLegend}
|
|
390
|
-
lines={newLines}
|
|
391
|
-
mode={legend?.mode}
|
|
392
|
-
placement="bottom"
|
|
393
|
-
renderExtraComponent={legend?.renderExtraComponent}
|
|
394
|
-
setLinesGraph={setLinesGraph}
|
|
395
|
-
shouldDisplayLegendInCompactMode={shouldDisplayLegendInCompactMode}
|
|
396
|
-
/>
|
|
397
|
-
</div>
|
|
398
|
-
)}
|
|
399
320
|
</>
|
|
400
321
|
);
|
|
401
322
|
};
|
|
@@ -4,12 +4,8 @@ import { ScaleLinear } from 'd3-scale';
|
|
|
4
4
|
|
|
5
5
|
import { Line, TimeValue } from '../common/timeSeries/models';
|
|
6
6
|
import { LineChartData } from '../common/models';
|
|
7
|
+
import { AxisX, Axis as AxisYLeft, AxisYRight } from '../common/Axes/models';
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
-
AxisX,
|
|
10
|
-
Axis as AxisYLeft,
|
|
11
|
-
AxisYRight
|
|
12
|
-
} from './BasicComponents/Axes/models';
|
|
13
9
|
import {
|
|
14
10
|
AreaRegularLines,
|
|
15
11
|
AreaStackedLines
|
|
@@ -144,6 +144,10 @@ const TemplateForSmallDimensions = (args): JSX.Element => {
|
|
|
144
144
|
return <ResponsivePie height={130} width={130} {...args} />;
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
+
const SmallTemplate = (args): JSX.Element => {
|
|
148
|
+
return <ResponsivePie height={100} width={100} {...args} />;
|
|
149
|
+
};
|
|
150
|
+
|
|
147
151
|
export const PieWithSmallDimensions: Story = {
|
|
148
152
|
args: {
|
|
149
153
|
data,
|
|
@@ -188,3 +192,13 @@ export const donutWithOneNoZeroValue: Story = {
|
|
|
188
192
|
},
|
|
189
193
|
render: Template
|
|
190
194
|
};
|
|
195
|
+
|
|
196
|
+
export const smallDisplay: Story = {
|
|
197
|
+
args: {
|
|
198
|
+
data,
|
|
199
|
+
displayLegend: false,
|
|
200
|
+
title: 'hosts',
|
|
201
|
+
variant: 'donut'
|
|
202
|
+
},
|
|
203
|
+
render: SmallTemplate
|
|
204
|
+
};
|