@centreon/ui 26.11.4 → 26.11.5
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
|
@@ -378,7 +378,7 @@ const Chart = ({
|
|
|
378
378
|
)}
|
|
379
379
|
{additionalLines?.map((additionalLine) => (
|
|
380
380
|
<AdditionalLine
|
|
381
|
-
key={additionalLine
|
|
381
|
+
key={JSON.stringify(additionalLine)}
|
|
382
382
|
{...additionalLine}
|
|
383
383
|
graphWidth={graphWidth}
|
|
384
384
|
yScale={yScalesPerUnit[additionalLine.unit]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ScaleLinear } from 'd3-scale';
|
|
2
|
-
import { useMemo } from 'react';
|
|
2
|
+
import { ReactElement, useMemo } from 'react';
|
|
3
3
|
|
|
4
4
|
import type { AdditionalLineProps } from '../models';
|
|
5
5
|
|
|
6
6
|
interface Props extends AdditionalLineProps {
|
|
7
7
|
graphWidth: number;
|
|
8
|
-
yScale
|
|
8
|
+
yScale?: ScaleLinear<number, number>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const AdditionalLine = ({
|
|
@@ -14,8 +14,12 @@ const AdditionalLine = ({
|
|
|
14
14
|
text,
|
|
15
15
|
graphWidth,
|
|
16
16
|
yScale
|
|
17
|
-
}: Props):
|
|
18
|
-
const positionY = useMemo(() => yScale(yValue), [yValue, yScale]);
|
|
17
|
+
}: Props): ReactElement | null => {
|
|
18
|
+
const positionY = useMemo(() => yScale?.(yValue), [yValue, yScale]);
|
|
19
|
+
|
|
20
|
+
if (positionY === undefined) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
19
23
|
|
|
20
24
|
return (
|
|
21
25
|
<g>
|