@centreon/ui 24.10.21 → 24.10.22
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
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
-
import { memo, useRef } from "react";
|
|
3
2
|
import "dayjs/locale/en";
|
|
4
3
|
import "dayjs/locale/es";
|
|
5
4
|
import "dayjs/locale/fr";
|
|
6
5
|
import "dayjs/locale/pt";
|
|
6
|
+
import { memo, useRef } from "react";
|
|
7
|
+
|
|
8
|
+
import { NoData } from "@centreon/ui";
|
|
9
|
+
|
|
7
10
|
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
8
11
|
import timezonePlugin from "dayjs/plugin/timezone";
|
|
9
12
|
import utcPlugin from "dayjs/plugin/utc";
|
|
@@ -31,6 +34,10 @@ interface Props extends Partial<LineChartProps> {
|
|
|
31
34
|
thresholds?: Thresholds;
|
|
32
35
|
getRef?: (ref: React.RefObject<HTMLDivElement | null>) => void;
|
|
33
36
|
containerStyle?: string;
|
|
37
|
+
transformMatrix?: {
|
|
38
|
+
fx?: (pointX: number) => number;
|
|
39
|
+
fy?: (pointY: number) => number;
|
|
40
|
+
};
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
const WrapperChart = ({
|
|
@@ -52,8 +59,8 @@ const WrapperChart = ({
|
|
|
52
59
|
annotationEvent,
|
|
53
60
|
legend = {
|
|
54
61
|
display: true,
|
|
55
|
-
mode:
|
|
56
|
-
placement:
|
|
62
|
+
mode: "grid",
|
|
63
|
+
placement: "bottom",
|
|
57
64
|
},
|
|
58
65
|
header,
|
|
59
66
|
lineStyle,
|
|
@@ -62,11 +69,14 @@ const WrapperChart = ({
|
|
|
62
69
|
thresholdUnit,
|
|
63
70
|
limitLegend,
|
|
64
71
|
getRef,
|
|
72
|
+
transformMatrix,
|
|
73
|
+
additionalLines,
|
|
74
|
+
min,
|
|
75
|
+
max,
|
|
76
|
+
boundariesUnit,
|
|
65
77
|
...rest
|
|
66
78
|
}: Props): JSX.Element | null => {
|
|
67
79
|
const { classes, cx } = useChartStyles();
|
|
68
|
-
const ref = useRef<HTMLDivElement | null>(null);
|
|
69
|
-
|
|
70
80
|
const { adjustedData } = useChartData({ data, end, start });
|
|
71
81
|
|
|
72
82
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
@@ -97,13 +107,17 @@ const WrapperChart = ({
|
|
|
97
107
|
);
|
|
98
108
|
}
|
|
99
109
|
|
|
110
|
+
if (!adjustedData) {
|
|
111
|
+
return <NoData />;
|
|
112
|
+
}
|
|
113
|
+
|
|
100
114
|
return (
|
|
101
115
|
<div
|
|
102
116
|
ref={combinedRef}
|
|
103
117
|
className={cx(classes.wrapperContainer, rest?.containerStyle)}
|
|
104
118
|
>
|
|
105
119
|
{!responsiveHeight || !data ? (
|
|
106
|
-
<Loading height={height ||
|
|
120
|
+
<Loading height={height || "100%"} width={width} />
|
|
107
121
|
) : (
|
|
108
122
|
<Chart
|
|
109
123
|
annotationEvent={annotationEvent}
|
|
@@ -125,6 +139,12 @@ const WrapperChart = ({
|
|
|
125
139
|
tooltip={tooltip}
|
|
126
140
|
width={width || responsiveWidth || 0}
|
|
127
141
|
zoomPreview={zoomPreview}
|
|
142
|
+
skipIntersectionObserver={rest.skipIntersectionObserver}
|
|
143
|
+
additionalLines={additionalLines}
|
|
144
|
+
transformMatrix={transformMatrix}
|
|
145
|
+
min={min}
|
|
146
|
+
max={max}
|
|
147
|
+
boundariesUnit={boundariesUnit}
|
|
128
148
|
/>
|
|
129
149
|
)}
|
|
130
150
|
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Typography } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
5
|
+
import { labelNoDataForThisPeriod } from '../../Chart/translatedLabels';
|
|
6
|
+
|
|
7
|
+
const NoData = () => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
return (
|
|
10
|
+
<div className={'flex items-center justify-center h-full'}>
|
|
11
|
+
<Typography align="center" variant="body1">
|
|
12
|
+
{t(labelNoDataForThisPeriod)}
|
|
13
|
+
</Typography>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default NoData;
|
package/src/Graph/index.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export type { ParentSizeProps } from
|
|
2
|
-
export { default as
|
|
3
|
-
export {
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export { default as
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export * from
|
|
1
|
+
export type { ParentSizeProps } from "@visx/responsive/lib/components/ParentSize";
|
|
2
|
+
export { default as BarChart } from "./BarChart/BarChart";
|
|
3
|
+
export { BarStack } from "./BarStack";
|
|
4
|
+
export { default as LineChart } from "./Chart";
|
|
5
|
+
export { default as ThresholdLines } from "./Chart/BasicComponents/Lines/Threshold";
|
|
6
|
+
export * from "./Chart/models";
|
|
7
|
+
export { default as useLineChartData } from "./Chart/useChartData";
|
|
8
|
+
export { default as Header } from "./common/BaseChart/Header";
|
|
9
|
+
export { default as NoData } from "./common/Error/NoData";
|
|
10
|
+
export type { LineChartData, Threshold, Thresholds } from "./common/models";
|
|
11
|
+
export * from "./common/timeSeries";
|
|
12
|
+
export type { Metric } from "./common/timeSeries/models";
|
|
13
|
+
export { Gauge } from "./Gauge";
|
|
14
|
+
export { HeatMap } from "./HeatMap";
|
|
15
|
+
export { PieChart } from "./PieChart";
|
|
16
|
+
export * from "./PieChart/models";
|
|
17
|
+
export { SingleBar } from "./SingleBar";
|
|
18
|
+
export { Text as GraphText } from "./Text";
|
|
19
|
+
export { Timeline } from "./Timeline";
|
|
20
|
+
export * from "./Tree";
|