@centreon/ui 23.10.51 → 23.10.53
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 +3 -1
- package/src/Dashboard/Layout.tsx +4 -2
- package/src/Graph/BasicComponents/Axes/index.tsx +1 -1
- package/src/Graph/BasicComponents/Lines/RegularLines/index.tsx +6 -3
- package/src/Graph/BasicComponents/Lines/StackedLines/index.tsx +6 -3
- package/src/Graph/BasicComponents/Lines/Threshold/BasicThreshold.tsx +5 -3
- package/src/Graph/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +5 -1
- package/src/Graph/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +5 -1
- package/src/Graph/BasicComponents/Lines/Threshold/index.tsx +5 -1
- package/src/Graph/BasicComponents/Lines/index.tsx +6 -1
- package/src/Graph/BasicComponents/Lines/models.ts +3 -0
- package/src/Graph/Graph.tsx +40 -20
- package/src/Graph/Header/index.tsx +7 -7
- package/src/Graph/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +48 -22
- package/src/Graph/InteractiveComponents/AnchorPoint/index.tsx +14 -12
- package/src/Graph/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +1 -1
- package/src/Graph/index.stories.tsx +10 -0
- package/src/Graph/index.tsx +35 -23
- package/src/Graph/models.ts +1 -1
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +9 -1
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +7 -2
- package/src/RichTextEditor/ContentEditable.tsx +12 -9
- package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +109 -1
- package/src/RichTextEditor/RichTextEditor.tsx +19 -5
- package/src/RichTextEditor/plugins/AutoLinkPlugin/index.tsx +14 -5
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +14 -7
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +197 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +3 -10
- package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +6 -1
- package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +7 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +7 -3
- package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +9 -7
- package/src/api/useGraphQuery/index.ts +92 -0
- package/src/api/useGraphQuery/models.ts +12 -0
- package/src/components/ItemComposition/Item.tsx +37 -0
- package/src/components/ItemComposition/ItemComposition.stories.tsx +78 -0
- package/src/components/ItemComposition/ItemComposition.styles.ts +26 -0
- package/src/components/ItemComposition/ItemComposition.tsx +41 -0
- package/src/components/ItemComposition/index.ts +6 -0
- package/src/components/Modal/Modal.styles.ts +1 -1
- package/src/components/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/AnchorPoint.styles.ts +0 -58
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "23.10.
|
|
3
|
+
"version": "23.10.53",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
@@ -102,7 +102,9 @@
|
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@lexical/link": "0.11.3",
|
|
105
|
+
"@lexical/list": "^0.11.3",
|
|
105
106
|
"@lexical/react": "0.11.3",
|
|
107
|
+
"@lexical/rich-text": "^0.11.3",
|
|
106
108
|
"@lexical/selection": "0.11.3",
|
|
107
109
|
"@lexical/utils": "0.11.3",
|
|
108
110
|
"@visx/curve": "^2.1.0",
|
package/src/Dashboard/Layout.tsx
CHANGED
|
@@ -16,6 +16,7 @@ interface DashboardLayoutProps<T> {
|
|
|
16
16
|
changeLayout?: (newLayout: Array<Layout>) => void;
|
|
17
17
|
children: Array<JSX.Element>;
|
|
18
18
|
displayGrid?: boolean;
|
|
19
|
+
isStatic?: boolean;
|
|
19
20
|
layout: Array<T>;
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -23,9 +24,10 @@ const Layout = <T extends Layout>({
|
|
|
23
24
|
children,
|
|
24
25
|
changeLayout,
|
|
25
26
|
displayGrid,
|
|
26
|
-
layout
|
|
27
|
+
layout,
|
|
28
|
+
isStatic = false
|
|
27
29
|
}: DashboardLayoutProps<T>): JSX.Element => {
|
|
28
|
-
const { classes } = useDashboardLayoutStyles();
|
|
30
|
+
const { classes } = useDashboardLayoutStyles(isStatic);
|
|
29
31
|
|
|
30
32
|
const [columns, setColumns] = useState(getColumnsFromScreenSize());
|
|
31
33
|
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Shape } from '@visx/visx';
|
|
4
4
|
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
5
5
|
import { equals, isNil, prop } from 'ramda';
|
|
6
6
|
|
|
7
7
|
import { getTime } from '../../../timeSeries';
|
|
8
8
|
import { TimeValue } from '../../../timeSeries/models';
|
|
9
9
|
import { getFillColor } from '../../../common';
|
|
10
|
+
import { CurveType } from '../models';
|
|
10
11
|
|
|
11
12
|
interface Props {
|
|
12
13
|
areaColor: string;
|
|
14
|
+
curve: CurveType;
|
|
13
15
|
filled: boolean;
|
|
14
16
|
graphHeight: number;
|
|
15
17
|
highlight?: boolean;
|
|
@@ -35,10 +37,11 @@ const RegularLine = ({
|
|
|
35
37
|
xScale,
|
|
36
38
|
areaColor,
|
|
37
39
|
transparency,
|
|
38
|
-
graphHeight
|
|
40
|
+
graphHeight,
|
|
41
|
+
curve
|
|
39
42
|
}: Props): JSX.Element => {
|
|
40
43
|
const props = {
|
|
41
|
-
curve
|
|
44
|
+
curve,
|
|
42
45
|
data: timeSeries,
|
|
43
46
|
defined: (value): boolean => !isNil(value[metric]),
|
|
44
47
|
opacity: 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Shape } from '@visx/visx';
|
|
2
2
|
import { ScaleLinear, ScaleTime } from 'd3-scale';
|
|
3
3
|
import { all, isNil, map, not, nth, path, pipe, prop } from 'ramda';
|
|
4
4
|
|
|
@@ -7,8 +7,10 @@ import { StackValue } from '../../../InteractiveComponents/AnchorPoint/models';
|
|
|
7
7
|
import { getFillColor } from '../../../common';
|
|
8
8
|
import { getTime } from '../../../timeSeries';
|
|
9
9
|
import { Line, TimeValue } from '../../../timeSeries/models';
|
|
10
|
+
import { CurveType } from '../models';
|
|
10
11
|
|
|
11
12
|
interface Props {
|
|
13
|
+
curve: CurveType;
|
|
12
14
|
displayAnchor: boolean;
|
|
13
15
|
lines: Array<Line>;
|
|
14
16
|
timeSeries: Array<TimeValue>;
|
|
@@ -21,11 +23,12 @@ const StackLines = ({
|
|
|
21
23
|
lines,
|
|
22
24
|
yScale,
|
|
23
25
|
xScale,
|
|
24
|
-
displayAnchor
|
|
26
|
+
displayAnchor,
|
|
27
|
+
curve
|
|
25
28
|
}: Props): JSX.Element => {
|
|
26
29
|
return (
|
|
27
30
|
<Shape.AreaStack
|
|
28
|
-
curve={
|
|
31
|
+
curve={curve}
|
|
29
32
|
data={timeSeries}
|
|
30
33
|
defined={(d): boolean => {
|
|
31
34
|
return pipe(
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { curveBasis } from '@visx/curve';
|
|
2
1
|
import { Threshold } from '@visx/threshold';
|
|
3
2
|
|
|
4
3
|
import { TimeValue } from '../../../timeSeries/models';
|
|
4
|
+
import { CurveType } from '../models';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
+
curve: CurveType;
|
|
7
8
|
fillAboveArea: string;
|
|
8
9
|
fillBelowArea: string;
|
|
9
10
|
fillOpacity?: number;
|
|
@@ -24,7 +25,8 @@ const BasicThreshold = ({
|
|
|
24
25
|
fillOpacity = 0.1,
|
|
25
26
|
id,
|
|
26
27
|
fillAboveArea,
|
|
27
|
-
fillBelowArea
|
|
28
|
+
fillBelowArea,
|
|
29
|
+
curve
|
|
28
30
|
}: Props): JSX.Element => {
|
|
29
31
|
return (
|
|
30
32
|
<Threshold
|
|
@@ -38,7 +40,7 @@ const BasicThreshold = ({
|
|
|
38
40
|
}}
|
|
39
41
|
clipAboveTo={0}
|
|
40
42
|
clipBelowTo={graphHeight}
|
|
41
|
-
curve={
|
|
43
|
+
curve={curve}
|
|
42
44
|
data={timeSeries}
|
|
43
45
|
id={id}
|
|
44
46
|
x={getX}
|
|
@@ -5,11 +5,13 @@ import { useTheme } from '@mui/material/styles';
|
|
|
5
5
|
|
|
6
6
|
import { adjustGraphData } from '../../../helpers/index';
|
|
7
7
|
import { GraphData, PatternOrientation } from '../../../models';
|
|
8
|
+
import { CurveType } from '../models';
|
|
8
9
|
|
|
9
10
|
import BasicThreshold from './BasicThreshold';
|
|
10
11
|
import useScaleThreshold from './useScaleThreshold';
|
|
11
12
|
|
|
12
13
|
interface Props {
|
|
14
|
+
curve: CurveType;
|
|
13
15
|
data: GraphData;
|
|
14
16
|
graphHeight: number;
|
|
15
17
|
id: string;
|
|
@@ -26,7 +28,8 @@ const ThresholdWithPatternLines = ({
|
|
|
26
28
|
leftScale,
|
|
27
29
|
rightScale,
|
|
28
30
|
xScale,
|
|
29
|
-
id
|
|
31
|
+
id,
|
|
32
|
+
curve
|
|
30
33
|
}: Props): JSX.Element | null => {
|
|
31
34
|
const theme = useTheme();
|
|
32
35
|
|
|
@@ -47,6 +50,7 @@ const ThresholdWithPatternLines = ({
|
|
|
47
50
|
return (
|
|
48
51
|
<>
|
|
49
52
|
<BasicThreshold
|
|
53
|
+
curve={curve}
|
|
50
54
|
fillAboveArea={"url('#lines')"}
|
|
51
55
|
fillBelowArea={"url('#lines')"}
|
|
52
56
|
fillOpacity={0.8}
|
|
@@ -4,10 +4,12 @@ import { LinePath } from '@visx/shape';
|
|
|
4
4
|
import { useTheme } from '@mui/material/styles';
|
|
5
5
|
|
|
6
6
|
import { TimeValue } from '../../../timeSeries/models';
|
|
7
|
+
import { CurveType } from '../models';
|
|
7
8
|
|
|
8
9
|
import BasicThreshold from './BasicThreshold';
|
|
9
10
|
|
|
10
11
|
interface Props {
|
|
12
|
+
curve: CurveType;
|
|
11
13
|
getX: (timeValue: TimeValue) => number;
|
|
12
14
|
getY0Variation: (timeValue: TimeValue) => number;
|
|
13
15
|
getY1Variation: (timeValue: TimeValue) => number;
|
|
@@ -24,7 +26,8 @@ const ThresholdWithVariation = ({
|
|
|
24
26
|
getY1Variation,
|
|
25
27
|
graphHeight,
|
|
26
28
|
lineColorY1,
|
|
27
|
-
lineColorY0
|
|
29
|
+
lineColorY0,
|
|
30
|
+
curve
|
|
28
31
|
}: Props): JSX.Element => {
|
|
29
32
|
const theme = useTheme();
|
|
30
33
|
|
|
@@ -40,6 +43,7 @@ const ThresholdWithVariation = ({
|
|
|
40
43
|
return (
|
|
41
44
|
<>
|
|
42
45
|
<BasicThreshold
|
|
46
|
+
curve={curve}
|
|
43
47
|
fillAboveArea={lineColorY1}
|
|
44
48
|
fillBelowArea={lineColorY0}
|
|
45
49
|
getX={getX}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
VariationThreshold
|
|
8
8
|
} from '../../../models';
|
|
9
9
|
import { TimeValue } from '../../../timeSeries/models';
|
|
10
|
+
import { CurveType } from '../models';
|
|
10
11
|
|
|
11
12
|
import BasicThreshold from './BasicThreshold';
|
|
12
13
|
import Circle from './Circle';
|
|
@@ -16,6 +17,7 @@ import { WrapperThresholdLinesModel } from './models';
|
|
|
16
17
|
import useScaleThreshold from './useScaleThreshold';
|
|
17
18
|
|
|
18
19
|
interface Props extends WrapperThresholdLinesModel {
|
|
20
|
+
curve: CurveType;
|
|
19
21
|
graphHeight: number;
|
|
20
22
|
timeSeries: Array<TimeValue>;
|
|
21
23
|
}
|
|
@@ -27,7 +29,8 @@ const WrapperThresholdLines = ({
|
|
|
27
29
|
lines,
|
|
28
30
|
rightScale,
|
|
29
31
|
timeSeries,
|
|
30
|
-
xScale
|
|
32
|
+
xScale,
|
|
33
|
+
curve
|
|
31
34
|
}: Props): JSX.Element | null => {
|
|
32
35
|
const data = useScaleThreshold({
|
|
33
36
|
areaThresholdLines,
|
|
@@ -44,6 +47,7 @@ const WrapperThresholdLines = ({
|
|
|
44
47
|
const { getX, getY0, getY1, lineColorY0, lineColorY1, ...rest } = data;
|
|
45
48
|
|
|
46
49
|
const commonProps = {
|
|
50
|
+
curve,
|
|
47
51
|
fillAboveArea: lineColorY0,
|
|
48
52
|
fillBelowArea: lineColorY1,
|
|
49
53
|
getX,
|
|
@@ -19,8 +19,10 @@ import {
|
|
|
19
19
|
canDisplayThreshold,
|
|
20
20
|
requiredNumberLinesThreshold
|
|
21
21
|
} from './Threshold/models';
|
|
22
|
+
import { CurveType } from './models';
|
|
22
23
|
|
|
23
24
|
interface Props extends GlobalAreaLines {
|
|
25
|
+
curve: CurveType;
|
|
24
26
|
displayAnchor?: DisplayAnchor;
|
|
25
27
|
displayedLines: Array<Line>;
|
|
26
28
|
graphSvgRef: MutableRefObject<SVGSVGElement | null>;
|
|
@@ -44,7 +46,8 @@ const Lines = ({
|
|
|
44
46
|
displayedLines,
|
|
45
47
|
areaThresholdLines,
|
|
46
48
|
areaStackedLines,
|
|
47
|
-
areaRegularLines
|
|
49
|
+
areaRegularLines,
|
|
50
|
+
curve
|
|
48
51
|
}: Props): JSX.Element => {
|
|
49
52
|
const { stackedLinesData, invertedStackedLinesData } = useStackedLines({
|
|
50
53
|
lines: displayedLines,
|
|
@@ -67,6 +70,7 @@ const Lines = ({
|
|
|
67
70
|
|
|
68
71
|
const displayGuidingLines = displayAnchor?.displayGuidingLines ?? true;
|
|
69
72
|
const commonStackedLinesProps = {
|
|
73
|
+
curve,
|
|
70
74
|
displayAnchor: displayGuidingLines,
|
|
71
75
|
graphHeight: height,
|
|
72
76
|
graphSvgRef,
|
|
@@ -157,6 +161,7 @@ const Lines = ({
|
|
|
157
161
|
)}
|
|
158
162
|
<RegularLine
|
|
159
163
|
areaColor={areaColor}
|
|
164
|
+
curve={curve}
|
|
160
165
|
filled={filled}
|
|
161
166
|
graphHeight={height}
|
|
162
167
|
highlight={highlight}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ScaleLinear } from 'd3-scale';
|
|
2
|
+
import { curveBasis } from '@visx/curve';
|
|
2
3
|
|
|
3
4
|
import { GraphData } from '../../models';
|
|
4
5
|
import { Line, TimeValue } from '../../timeSeries/models';
|
|
@@ -40,3 +41,5 @@ export interface Shape {
|
|
|
40
41
|
areaStackedLines: AreaStackedLines;
|
|
41
42
|
areaThreshold: AreaThreshold;
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
export type CurveType = typeof curveBasis;
|
package/src/Graph/Graph.tsx
CHANGED
|
@@ -28,12 +28,15 @@ import {
|
|
|
28
28
|
} from './models';
|
|
29
29
|
import { getLeftScale, getRightScale, getXScale } from './timeSeries';
|
|
30
30
|
import { useIntersection } from './useGraphIntersection';
|
|
31
|
+
import { CurveType } from './BasicComponents/Lines/models';
|
|
31
32
|
|
|
32
33
|
interface Props extends GraphProps {
|
|
34
|
+
curve: CurveType;
|
|
33
35
|
graphData: Data;
|
|
34
36
|
graphInterval: GraphInterval;
|
|
35
37
|
graphRef: MutableRefObject<HTMLDivElement | null>;
|
|
36
38
|
legend?: LegendModel;
|
|
39
|
+
marginBottom: number;
|
|
37
40
|
shapeLines?: GlobalAreaLines;
|
|
38
41
|
}
|
|
39
42
|
|
|
@@ -52,15 +55,26 @@ const Graph = ({
|
|
|
52
55
|
tooltip,
|
|
53
56
|
legend,
|
|
54
57
|
graphRef,
|
|
55
|
-
header
|
|
58
|
+
header,
|
|
59
|
+
curve,
|
|
60
|
+
marginBottom
|
|
56
61
|
}: Props): JSX.Element => {
|
|
57
62
|
const graphSvgRef = useRef<SVGSVGElement | null>(null);
|
|
58
63
|
|
|
59
64
|
const { classes } = useStyles();
|
|
60
65
|
const { isInViewport } = useIntersection({ element: graphRef?.current });
|
|
61
66
|
|
|
67
|
+
const legendRef = useRef<HTMLDivElement | null>(null);
|
|
68
|
+
|
|
62
69
|
const graphWidth = width > 0 ? width - margin.left - margin.right : 0;
|
|
63
|
-
const graphHeight =
|
|
70
|
+
const graphHeight =
|
|
71
|
+
(height || 0) > 0
|
|
72
|
+
? (height || 0) -
|
|
73
|
+
margin.top -
|
|
74
|
+
margin.bottom -
|
|
75
|
+
marginBottom -
|
|
76
|
+
(legendRef.current?.getBoundingClientRect().height || 0)
|
|
77
|
+
: 0;
|
|
64
78
|
|
|
65
79
|
const { title, timeSeries, baseAxis, lines } = graphData;
|
|
66
80
|
|
|
@@ -83,7 +97,7 @@ const Graph = ({
|
|
|
83
97
|
getLeftScale({
|
|
84
98
|
dataLines: displayedLines,
|
|
85
99
|
dataTimeSeries: timeSeries,
|
|
86
|
-
valueGraphHeight: graphHeight
|
|
100
|
+
valueGraphHeight: graphHeight - 35
|
|
87
101
|
}),
|
|
88
102
|
[displayedLines, timeSeries, graphHeight]
|
|
89
103
|
);
|
|
@@ -93,7 +107,7 @@ const Graph = ({
|
|
|
93
107
|
getRightScale({
|
|
94
108
|
dataLines: displayedLines,
|
|
95
109
|
dataTimeSeries: timeSeries,
|
|
96
|
-
valueGraphHeight: graphHeight
|
|
110
|
+
valueGraphHeight: graphHeight - 35
|
|
97
111
|
}),
|
|
98
112
|
[timeSeries, displayedLines, graphHeight]
|
|
99
113
|
);
|
|
@@ -128,11 +142,15 @@ const Graph = ({
|
|
|
128
142
|
/>
|
|
129
143
|
<ClickAwayListener onClickAway={graphTooltipData?.hideTooltip}>
|
|
130
144
|
<div className={classes.container}>
|
|
131
|
-
<LoadingProgress
|
|
132
|
-
|
|
145
|
+
<LoadingProgress
|
|
146
|
+
display={loading}
|
|
147
|
+
height={graphHeight}
|
|
148
|
+
width={width}
|
|
149
|
+
/>
|
|
150
|
+
<svg height={graphHeight + margin.top} ref={graphSvgRef} width="100%">
|
|
133
151
|
<Group.Group left={margin.left} top={margin.top}>
|
|
134
152
|
<Grids
|
|
135
|
-
height={graphHeight}
|
|
153
|
+
height={graphHeight - margin.top}
|
|
136
154
|
leftScale={leftScale}
|
|
137
155
|
width={graphWidth}
|
|
138
156
|
xScale={xScale}
|
|
@@ -145,7 +163,7 @@ const Graph = ({
|
|
|
145
163
|
...axis
|
|
146
164
|
}}
|
|
147
165
|
graphInterval={graphInterval}
|
|
148
|
-
height={graphHeight}
|
|
166
|
+
height={graphHeight - margin.top}
|
|
149
167
|
leftScale={leftScale}
|
|
150
168
|
rightScale={rightScale}
|
|
151
169
|
width={graphWidth}
|
|
@@ -153,10 +171,11 @@ const Graph = ({
|
|
|
153
171
|
/>
|
|
154
172
|
|
|
155
173
|
<Lines
|
|
174
|
+
curve={curve}
|
|
156
175
|
displayAnchor={displayAnchor}
|
|
157
176
|
displayedLines={displayedLines}
|
|
158
177
|
graphSvgRef={graphSvgRef}
|
|
159
|
-
height={graphHeight}
|
|
178
|
+
height={graphHeight - margin.top}
|
|
160
179
|
leftScale={leftScale}
|
|
161
180
|
rightScale={rightScale}
|
|
162
181
|
timeSeries={timeSeries}
|
|
@@ -189,7 +208,7 @@ const Graph = ({
|
|
|
189
208
|
{(displayAnchor?.displayTooltipsGuidingLines ?? true) && (
|
|
190
209
|
<TooltipAnchorPoint
|
|
191
210
|
baseAxis={baseAxis}
|
|
192
|
-
graphHeight={graphHeight}
|
|
211
|
+
graphHeight={graphHeight - 35}
|
|
193
212
|
graphWidth={graphWidth}
|
|
194
213
|
leftScale={leftScale}
|
|
195
214
|
lines={displayedLines}
|
|
@@ -198,18 +217,19 @@ const Graph = ({
|
|
|
198
217
|
xScale={xScale}
|
|
199
218
|
/>
|
|
200
219
|
)}
|
|
201
|
-
|
|
202
|
-
{displayLegend && (
|
|
203
|
-
<Legend
|
|
204
|
-
base={baseAxis}
|
|
205
|
-
displayAnchor={displayAnchor?.displayGuidingLines ?? true}
|
|
206
|
-
lines={newLines}
|
|
207
|
-
renderExtraComponent={legend?.renderExtraComponent}
|
|
208
|
-
timeSeries={timeSeries}
|
|
209
|
-
/>
|
|
210
|
-
)}
|
|
211
220
|
</div>
|
|
212
221
|
</ClickAwayListener>
|
|
222
|
+
{displayLegend && (
|
|
223
|
+
<div ref={legendRef}>
|
|
224
|
+
<Legend
|
|
225
|
+
base={baseAxis}
|
|
226
|
+
displayAnchor={displayAnchor?.displayGuidingLines ?? true}
|
|
227
|
+
lines={newLines}
|
|
228
|
+
renderExtraComponent={legend?.renderExtraComponent}
|
|
229
|
+
timeSeries={timeSeries}
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
)}
|
|
213
233
|
</>
|
|
214
234
|
);
|
|
215
235
|
};
|
|
@@ -43,17 +43,17 @@ const Header = ({
|
|
|
43
43
|
Component: (
|
|
44
44
|
<div className={classes.header}>
|
|
45
45
|
<div />
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
<div>
|
|
47
|
+
{displayTitle && (
|
|
48
48
|
<Typography align="center" variant="body1">
|
|
49
49
|
{title}
|
|
50
50
|
</Typography>
|
|
51
|
+
)}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
)}
|
|
53
|
+
<Typography align="center" style={{ height: 20 }} variant="body1">
|
|
54
|
+
{time}
|
|
55
|
+
</Typography>
|
|
56
|
+
</div>
|
|
57
57
|
{header?.extraComponent}
|
|
58
58
|
</div>
|
|
59
59
|
),
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Tooltip } from '@visx/visx';
|
|
2
|
+
|
|
3
|
+
import { Typography, useTheme } from '@mui/material';
|
|
3
4
|
|
|
4
5
|
import useTooltipAnchorPoint from './useTooltipAnchorPoint';
|
|
5
|
-
import { useStyles } from './AnchorPoint.styles';
|
|
6
6
|
import { TooltipAnchorModel } from './models';
|
|
7
7
|
|
|
8
|
+
const baseStyles = {
|
|
9
|
+
...Tooltip.defaultStyles,
|
|
10
|
+
textAlign: 'center'
|
|
11
|
+
};
|
|
12
|
+
|
|
8
13
|
const TooltipAnchorPoint = ({
|
|
9
14
|
timeSeries,
|
|
10
15
|
xScale,
|
|
@@ -15,12 +20,13 @@ const TooltipAnchorPoint = ({
|
|
|
15
20
|
lines,
|
|
16
21
|
baseAxis
|
|
17
22
|
}: TooltipAnchorModel): JSX.Element => {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
|
|
18
25
|
const {
|
|
19
26
|
tooltipDataAxisX,
|
|
20
27
|
tooltipDataAxisYLeft,
|
|
21
28
|
tooltipLeftAxisX,
|
|
22
29
|
tooltipLeftAxisYLeft,
|
|
23
|
-
tooltipTopAxisX,
|
|
24
30
|
tooltipTopAxisYLeft,
|
|
25
31
|
tooltipDataAxisYRight,
|
|
26
32
|
tooltipTopAxisYRight,
|
|
@@ -35,33 +41,53 @@ const TooltipAnchorPoint = ({
|
|
|
35
41
|
timeSeries,
|
|
36
42
|
xScale
|
|
37
43
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
tooltipTopAxisYRight
|
|
45
|
-
});
|
|
44
|
+
|
|
45
|
+
const cardStyles = {
|
|
46
|
+
backgroundColor: theme.palette.background.paper,
|
|
47
|
+
color: theme.palette.text.primary,
|
|
48
|
+
padding: theme.spacing(0.25, 0.5)
|
|
49
|
+
};
|
|
46
50
|
|
|
47
51
|
return (
|
|
48
52
|
<>
|
|
49
|
-
{tooltipDataAxisYLeft && (
|
|
50
|
-
<Paper className={cx(classes.tooltipAxis, classes.tooltipAxisLeftY)}>
|
|
51
|
-
<Typography variant="caption">{tooltipDataAxisYLeft}</Typography>
|
|
52
|
-
</Paper>
|
|
53
|
-
)}
|
|
54
53
|
{tooltipDataAxisX && (
|
|
55
|
-
<
|
|
54
|
+
<Tooltip.Tooltip
|
|
55
|
+
left={tooltipLeftAxisX}
|
|
56
|
+
style={{
|
|
57
|
+
...baseStyles,
|
|
58
|
+
...cardStyles,
|
|
59
|
+
transform: 'translateX(-70%)'
|
|
60
|
+
}}
|
|
61
|
+
top={0}
|
|
62
|
+
>
|
|
56
63
|
<Typography variant="caption">{tooltipDataAxisX}</Typography>
|
|
57
|
-
</
|
|
64
|
+
</Tooltip.Tooltip>
|
|
65
|
+
)}
|
|
66
|
+
{tooltipDataAxisYLeft && (
|
|
67
|
+
<Tooltip.Tooltip
|
|
68
|
+
left={tooltipLeftAxisYLeft}
|
|
69
|
+
style={{
|
|
70
|
+
...baseStyles,
|
|
71
|
+
...cardStyles,
|
|
72
|
+
transform: 'translateX(-70%) translateY(-100%)'
|
|
73
|
+
}}
|
|
74
|
+
top={tooltipTopAxisYLeft}
|
|
75
|
+
>
|
|
76
|
+
<Typography variant="caption">{tooltipDataAxisYLeft}</Typography>
|
|
77
|
+
</Tooltip.Tooltip>
|
|
58
78
|
)}
|
|
59
79
|
{tooltipDataAxisYRight && (
|
|
60
|
-
<
|
|
61
|
-
|
|
80
|
+
<Tooltip.Tooltip
|
|
81
|
+
left={tooltipLeftAxisYRight}
|
|
82
|
+
style={{
|
|
83
|
+
...baseStyles,
|
|
84
|
+
...cardStyles,
|
|
85
|
+
transform: 'translateX(-70%) translateY(-80%)'
|
|
86
|
+
}}
|
|
87
|
+
top={tooltipTopAxisYRight}
|
|
62
88
|
>
|
|
63
89
|
<Typography variant="caption">{tooltipDataAxisYRight}</Typography>
|
|
64
|
-
</
|
|
90
|
+
</Tooltip.Tooltip>
|
|
65
91
|
)}
|
|
66
92
|
</>
|
|
67
93
|
);
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import { alpha } from '@mui/system';
|
|
2
|
+
|
|
1
3
|
interface Props {
|
|
2
4
|
lineColor: string;
|
|
3
5
|
x: number;
|
|
4
6
|
y: number;
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
const Point = ({ lineColor, x, y }: Props): JSX.Element =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
const Point = ({ lineColor, x, y }: Props): JSX.Element => (
|
|
10
|
+
<circle
|
|
11
|
+
fill={alpha(lineColor, 0.5)}
|
|
12
|
+
r={4}
|
|
13
|
+
stroke={lineColor}
|
|
14
|
+
strokeWidth={2}
|
|
15
|
+
style={{
|
|
16
|
+
transform: `translate(${x}px, ${y}px)`,
|
|
17
|
+
transition: 'transform 0.08s ease-out'
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
19
21
|
|
|
20
22
|
export default Point;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { Curve } from '@visx/visx';
|
|
4
5
|
|
|
5
6
|
import { Button } from '@mui/material';
|
|
6
7
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
@@ -335,6 +336,15 @@ export const Graph: Story = {
|
|
|
335
336
|
args: argumentsData
|
|
336
337
|
};
|
|
337
338
|
|
|
339
|
+
export const GraphWithStepCurve: Story = {
|
|
340
|
+
...Template,
|
|
341
|
+
argTypes,
|
|
342
|
+
args: {
|
|
343
|
+
...argumentsData,
|
|
344
|
+
curve: Curve.curveStep
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
338
348
|
export const GraphWithTimePeriod: Story = {
|
|
339
349
|
...WithTimePeriod,
|
|
340
350
|
args: {
|