@hitachivantara/uikit-react-viz 6.1.6 → 6.1.7
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/dist/BarChart/BarChart.js +86 -112
- package/dist/BaseChart/BaseChart.js +53 -51
- package/dist/Boxplot/Boxplot.js +68 -83
- package/dist/Boxplot/Boxplot.styles.js +22 -23
- package/dist/Boxplot/useBoxplot.js +56 -70
- package/dist/Boxplot/useBoxplotData.js +34 -37
- package/dist/ConfusionMatrix/ConfusionMatrix.js +151 -150
- package/dist/ConfusionMatrix/ConfusionMatrix.styles.js +23 -27
- package/dist/ConfusionMatrix/utils.js +105 -138
- package/dist/DonutChart/DonutChart.js +67 -85
- package/dist/Heatmap/Heatmap.js +81 -97
- package/dist/Heatmap/Heatmap.styles.js +22 -23
- package/dist/LineChart/LineChart.js +84 -110
- package/dist/ScatterPlot/ScatterPlot.js +80 -102
- package/dist/Treemap/Treemap.js +36 -50
- package/dist/hooks/tooltip/styles.js +76 -77
- package/dist/hooks/tooltip/useTooltip.js +66 -89
- package/dist/hooks/useData.js +122 -162
- package/dist/hooks/useDataZoom.js +17 -25
- package/dist/hooks/useDataset.js +10 -14
- package/dist/hooks/useGrid.js +21 -37
- package/dist/hooks/useLegend.js +35 -44
- package/dist/hooks/useOption.js +12 -18
- package/dist/hooks/useSeries.js +84 -117
- package/dist/hooks/useVisualMap.js +38 -55
- package/dist/hooks/useXAxis.js +42 -61
- package/dist/hooks/useYAxis.js +31 -55
- package/dist/index.js +2 -16
- package/dist/providers/Provider.js +41 -21
- package/dist/utils/index.js +120 -186
- package/dist/utils/registerTheme.js +84 -122
- package/package.json +4 -4
|
@@ -1,142 +1,109 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
2
|
import { useTheme } from "@hitachivantara/uikit-react-utils";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
);
|
|
34
|
-
return {
|
|
35
|
-
colorScale: parsedColors || [colors?.textLight || "", colors?.cat3 || ""],
|
|
36
|
-
max,
|
|
37
|
-
min
|
|
38
|
-
};
|
|
39
|
-
}, [colors, custom, data, filterKey, delta]);
|
|
40
|
-
return colorScale;
|
|
3
|
+
//#region src/ConfusionMatrix/utils.ts
|
|
4
|
+
var useColorScale = ({ data, delta, custom, filterKey }) => {
|
|
5
|
+
const { colors } = useTheme();
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
if (custom == null && delta) return;
|
|
8
|
+
if (custom && typeof custom[0] === "object") return { pieces: custom.reduce((acc, curr) => {
|
|
9
|
+
acc.push({
|
|
10
|
+
...curr,
|
|
11
|
+
color: colors?.[curr.color] || curr.color
|
|
12
|
+
});
|
|
13
|
+
return acc;
|
|
14
|
+
}, []) };
|
|
15
|
+
const flatData = data.columnNames().filter((p) => p !== filterKey).reduce((acc, c) => {
|
|
16
|
+
acc.push(...data.array(c));
|
|
17
|
+
return acc;
|
|
18
|
+
}, []);
|
|
19
|
+
const max = Math.max(...flatData);
|
|
20
|
+
const min = Math.min(...flatData);
|
|
21
|
+
return {
|
|
22
|
+
colorScale: custom?.map((c) => typeof c === "string" ? colors?.[c] || c : c.color) || [colors?.textLight || "", colors?.cat3 || ""],
|
|
23
|
+
max,
|
|
24
|
+
min
|
|
25
|
+
};
|
|
26
|
+
}, [
|
|
27
|
+
colors,
|
|
28
|
+
custom,
|
|
29
|
+
data,
|
|
30
|
+
filterKey,
|
|
31
|
+
delta
|
|
32
|
+
]);
|
|
41
33
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
87
|
-
return racc;
|
|
88
|
-
}, []);
|
|
89
|
-
acc.push(...row);
|
|
90
|
-
return acc;
|
|
91
|
-
}, [])
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}, [colors, data, delta, filterKey, getDeltaColor, valuesProps]);
|
|
95
|
-
return chartSeries;
|
|
34
|
+
var useSeries = ({ data, filterKey, delta, valuesProps }) => {
|
|
35
|
+
const { colors } = useTheme();
|
|
36
|
+
const getDeltaColor = useCallback((value, diagonal) => {
|
|
37
|
+
if (diagonal && value > 0 || !diagonal && value < 0) return colors?.positive;
|
|
38
|
+
if (diagonal && value < 0 || !diagonal && value > 0) return colors?.negative;
|
|
39
|
+
return colors?.textLight;
|
|
40
|
+
}, [colors]);
|
|
41
|
+
return useMemo(() => {
|
|
42
|
+
return { series: {
|
|
43
|
+
id: `series~${filterKey}`,
|
|
44
|
+
type: "heatmap",
|
|
45
|
+
label: {
|
|
46
|
+
show: true,
|
|
47
|
+
...valuesProps,
|
|
48
|
+
...valuesProps?.color && { color: colors?.[valuesProps.color] || valuesProps.color }
|
|
49
|
+
},
|
|
50
|
+
emphasis: { disabled: true },
|
|
51
|
+
data: data.columnNames().filter((p) => p !== filterKey).reduce((acc, c, j) => {
|
|
52
|
+
const row = data.array(c).reduce((racc, rv, i) => {
|
|
53
|
+
racc.push({
|
|
54
|
+
value: [
|
|
55
|
+
data.array(filterKey)[i],
|
|
56
|
+
c,
|
|
57
|
+
rv != null ? rv : "-"
|
|
58
|
+
],
|
|
59
|
+
...delta && {
|
|
60
|
+
visualMap: false,
|
|
61
|
+
itemStyle: { color: getDeltaColor(rv, i === j) }
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return racc;
|
|
65
|
+
}, []);
|
|
66
|
+
acc.push(...row);
|
|
67
|
+
return acc;
|
|
68
|
+
}, [])
|
|
69
|
+
} };
|
|
70
|
+
}, [
|
|
71
|
+
colors,
|
|
72
|
+
data,
|
|
73
|
+
delta,
|
|
74
|
+
filterKey,
|
|
75
|
+
getDeltaColor,
|
|
76
|
+
valuesProps
|
|
77
|
+
]);
|
|
96
78
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
width: Math.max(SQUARE_SIZE * nCols, SQUARE_SIZE * 8)
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}, [
|
|
129
|
-
data,
|
|
130
|
-
filterKey,
|
|
131
|
-
format,
|
|
132
|
-
visualMapVisible,
|
|
133
|
-
visualMapYPosition,
|
|
134
|
-
xAxisPosition
|
|
135
|
-
]);
|
|
136
|
-
return size;
|
|
137
|
-
};
|
|
138
|
-
export {
|
|
139
|
-
useColorScale,
|
|
140
|
-
useGridLayout,
|
|
141
|
-
useSeries
|
|
79
|
+
var SQUARE_SIZE = 52;
|
|
80
|
+
var useGridLayout = ({ data, filterKey, format, xAxisPosition, visualMapVisible, visualMapYPosition }) => {
|
|
81
|
+
return useMemo(() => {
|
|
82
|
+
const nCols = data.array(filterKey).length;
|
|
83
|
+
const nRows = data.columnNames().filter((p) => p !== filterKey).length;
|
|
84
|
+
const itemHeight = format === "square" ? SQUARE_SIZE : SQUARE_SIZE / 2;
|
|
85
|
+
return {
|
|
86
|
+
padding: {
|
|
87
|
+
bottom: xAxisPosition === "bottom" || visualMapVisible && visualMapYPosition === "bottom" ? 60 : 20,
|
|
88
|
+
top: xAxisPosition === "top" || visualMapVisible && visualMapYPosition === "top" ? 60 : 20,
|
|
89
|
+
...visualMapVisible && visualMapYPosition === "bottom" && xAxisPosition === "bottom" && { bottom: 100 },
|
|
90
|
+
...visualMapVisible && visualMapYPosition === "top" && xAxisPosition === "top" && { top: 100 },
|
|
91
|
+
left: 80,
|
|
92
|
+
right: 80
|
|
93
|
+
},
|
|
94
|
+
size: {
|
|
95
|
+
height: Math.max(itemHeight * nRows, itemHeight * 8),
|
|
96
|
+
width: Math.max(SQUARE_SIZE * nCols, SQUARE_SIZE * 8)
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}, [
|
|
100
|
+
data,
|
|
101
|
+
filterKey,
|
|
102
|
+
format,
|
|
103
|
+
visualMapVisible,
|
|
104
|
+
visualMapYPosition,
|
|
105
|
+
xAxisPosition
|
|
106
|
+
]);
|
|
142
107
|
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { useColorScale, useGridLayout, useSeries };
|
|
@@ -1,93 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PieChart } from "echarts/charts";
|
|
4
|
-
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from "echarts/components";
|
|
5
|
-
import * as echarts from "echarts/core";
|
|
1
|
+
import { HvBaseChart } from "../BaseChart/BaseChart.js";
|
|
2
|
+
import { useGrid } from "../hooks/useGrid.js";
|
|
6
3
|
import { useData } from "../hooks/useData.js";
|
|
7
4
|
import { useDataset } from "../hooks/useDataset.js";
|
|
8
5
|
import { useSeries } from "../hooks/useSeries.js";
|
|
9
6
|
import { useLegend } from "../hooks/useLegend.js";
|
|
10
7
|
import { useTooltip } from "../hooks/tooltip/useTooltip.js";
|
|
11
|
-
import { useGrid } from "../hooks/useGrid.js";
|
|
12
8
|
import { useOption } from "../hooks/useOption.js";
|
|
13
|
-
import {
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { DatasetComponent, GridComponent, LegendComponent, TooltipComponent } from "echarts/components";
|
|
11
|
+
import * as echarts from "echarts/core";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
import { PieChart } from "echarts/charts";
|
|
14
|
+
//#region src/DonutChart/DonutChart.tsx
|
|
14
15
|
echarts.use([
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
PieChart,
|
|
17
|
+
DatasetComponent,
|
|
18
|
+
GridComponent,
|
|
19
|
+
TooltipComponent,
|
|
20
|
+
LegendComponent
|
|
20
21
|
]);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
...chartGrid
|
|
76
|
-
},
|
|
77
|
-
onOptionChange
|
|
78
|
-
});
|
|
79
|
-
return /* @__PURE__ */ jsx(
|
|
80
|
-
HvBaseChart,
|
|
81
|
-
{
|
|
82
|
-
ref,
|
|
83
|
-
option,
|
|
84
|
-
width,
|
|
85
|
-
height,
|
|
86
|
-
...others
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
export {
|
|
92
|
-
HvDonutChart
|
|
93
|
-
};
|
|
22
|
+
/**
|
|
23
|
+
* Donut charts nicely convey the part-whole relationship and they have become
|
|
24
|
+
* the most recognizable chart types for representing proportions in business and data statistics.
|
|
25
|
+
*/
|
|
26
|
+
var HvDonutChart = forwardRef(function HvDonutChart(props, ref) {
|
|
27
|
+
const { data, groupBy, classes, legend, tooltip, measure: measures, sortBy, filters, grid, width, height, type = "regular", slicesNameFormatter, onOptionChange, ...others } = props;
|
|
28
|
+
const { data: chartData, mapping: measuresMapping } = useData({
|
|
29
|
+
data,
|
|
30
|
+
groupBy,
|
|
31
|
+
measures,
|
|
32
|
+
sortBy,
|
|
33
|
+
filters
|
|
34
|
+
});
|
|
35
|
+
const chartDataset = useDataset(chartData);
|
|
36
|
+
const chartSeries = useSeries({
|
|
37
|
+
type: "pie",
|
|
38
|
+
data: chartData,
|
|
39
|
+
groupBy,
|
|
40
|
+
measuresMapping,
|
|
41
|
+
radius: type === "thin" ? ["65%", "70%"] : ["55%", "70%"]
|
|
42
|
+
});
|
|
43
|
+
const chartLegend = useLegend({
|
|
44
|
+
...legend,
|
|
45
|
+
show: legend?.show ?? true,
|
|
46
|
+
icon: "square",
|
|
47
|
+
series: chartSeries.series,
|
|
48
|
+
formatter: slicesNameFormatter
|
|
49
|
+
});
|
|
50
|
+
const chartTooltip = useTooltip({
|
|
51
|
+
...tooltip,
|
|
52
|
+
measuresMapping,
|
|
53
|
+
classes,
|
|
54
|
+
nameFormatter: slicesNameFormatter
|
|
55
|
+
});
|
|
56
|
+
const chartGrid = useGrid({ ...grid });
|
|
57
|
+
return /* @__PURE__ */ jsx(HvBaseChart, {
|
|
58
|
+
ref,
|
|
59
|
+
option: useOption({
|
|
60
|
+
option: {
|
|
61
|
+
...chartSeries,
|
|
62
|
+
...chartDataset,
|
|
63
|
+
...chartLegend,
|
|
64
|
+
...chartTooltip,
|
|
65
|
+
...chartGrid
|
|
66
|
+
},
|
|
67
|
+
onOptionChange
|
|
68
|
+
}),
|
|
69
|
+
width,
|
|
70
|
+
height,
|
|
71
|
+
...others
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
export { HvDonutChart };
|
package/dist/Heatmap/Heatmap.js
CHANGED
|
@@ -1,42 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { HeatmapChart } from "echarts/charts";
|
|
4
|
-
import { TooltipComponent, VisualMapComponent } from "echarts/components";
|
|
5
|
-
import * as echarts from "echarts/core";
|
|
6
|
-
import { useTheme } from "@hitachivantara/uikit-react-utils";
|
|
7
|
-
import { useClasses } from "./Heatmap.styles.js";
|
|
8
|
-
import { useTooltip } from "../hooks/tooltip/useTooltip.js";
|
|
1
|
+
import { HvBaseChart } from "../BaseChart/BaseChart.js";
|
|
9
2
|
import { useXAxis } from "../hooks/useXAxis.js";
|
|
10
3
|
import { useYAxis } from "../hooks/useYAxis.js";
|
|
11
4
|
import { useVisualMap } from "../hooks/useVisualMap.js";
|
|
5
|
+
import { useTooltip } from "../hooks/tooltip/useTooltip.js";
|
|
12
6
|
import { useOption } from "../hooks/useOption.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return `
|
|
7
|
+
import { useClasses } from "./Heatmap.styles.js";
|
|
8
|
+
import { forwardRef } from "react";
|
|
9
|
+
import { TooltipComponent, VisualMapComponent } from "echarts/components";
|
|
10
|
+
import * as echarts from "echarts/core";
|
|
11
|
+
import { useTheme } from "@hitachivantara/uikit-react-utils";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
import { HeatmapChart } from "echarts/charts";
|
|
14
|
+
//#region src/Heatmap/Heatmap.tsx
|
|
15
|
+
echarts.use([
|
|
16
|
+
HeatmapChart,
|
|
17
|
+
TooltipComponent,
|
|
18
|
+
VisualMapComponent
|
|
19
|
+
]);
|
|
20
|
+
/**
|
|
21
|
+
* A Heatmap uses color gradients to represent data intensity across a surface.
|
|
22
|
+
*/
|
|
23
|
+
var HvHeatmap = forwardRef(function HvHeatmap(props, ref) {
|
|
24
|
+
const { name, data, min, max, colorScale, xAxis, yAxis, classes: classesProp, tooltip, width, height, onOptionChange, ...others } = props;
|
|
25
|
+
const { classes } = useClasses(classesProp);
|
|
26
|
+
const { colors } = useTheme();
|
|
27
|
+
const chartTooltip = useTooltip({
|
|
28
|
+
component: (params) => {
|
|
29
|
+
const value = params?.value;
|
|
30
|
+
const title = params?.title;
|
|
31
|
+
const valueToShow = value ? `${yAxis?.data?.[Number(value[1])]} - ${xAxis?.data?.[Number(value[0])]}: ${params?.series?.[0]?.name}` : "-";
|
|
32
|
+
return `
|
|
40
33
|
<div class="${classes.tooltipRoot}">
|
|
41
34
|
<div class="${classes.tooltipContainer}">
|
|
42
35
|
<div>
|
|
@@ -45,65 +38,56 @@ const HvHeatmap = forwardRef(
|
|
|
45
38
|
</div>
|
|
46
39
|
</div>
|
|
47
40
|
</div>`;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
height,
|
|
102
|
-
...others
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
export {
|
|
108
|
-
HvHeatmap
|
|
109
|
-
};
|
|
41
|
+
},
|
|
42
|
+
...tooltip
|
|
43
|
+
});
|
|
44
|
+
const chartXAxis = useXAxis({
|
|
45
|
+
type: "categorical",
|
|
46
|
+
...xAxis
|
|
47
|
+
});
|
|
48
|
+
const chartYAxis = useYAxis({
|
|
49
|
+
defaultType: "categorical",
|
|
50
|
+
axes: yAxis ? [yAxis] : []
|
|
51
|
+
});
|
|
52
|
+
const convertedColors = colorScale?.map((color) => colors?.[color] || color);
|
|
53
|
+
const chartVisualMap = useVisualMap({
|
|
54
|
+
min,
|
|
55
|
+
max,
|
|
56
|
+
orient: "horizontal",
|
|
57
|
+
left: "center",
|
|
58
|
+
calculable: true,
|
|
59
|
+
position: { y: "bottom" },
|
|
60
|
+
colorScale: convertedColors || [
|
|
61
|
+
"#2D4B87",
|
|
62
|
+
"#95AFE8",
|
|
63
|
+
"#E7EDF9"
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
return /* @__PURE__ */ jsx(HvBaseChart, {
|
|
67
|
+
ref,
|
|
68
|
+
option: useOption({
|
|
69
|
+
option: {
|
|
70
|
+
xAxis: chartXAxis.xAxis,
|
|
71
|
+
yAxis: chartYAxis.yAxis,
|
|
72
|
+
visualMap: chartVisualMap.visualMap,
|
|
73
|
+
series: [{
|
|
74
|
+
name,
|
|
75
|
+
type: "heatmap",
|
|
76
|
+
data,
|
|
77
|
+
label: { show: true },
|
|
78
|
+
emphasis: { itemStyle: {
|
|
79
|
+
shadowBlur: 10,
|
|
80
|
+
shadowColor: "rgba(0, 0, 0, 0.5)"
|
|
81
|
+
} }
|
|
82
|
+
}],
|
|
83
|
+
...chartTooltip
|
|
84
|
+
},
|
|
85
|
+
onOptionChange
|
|
86
|
+
}),
|
|
87
|
+
width,
|
|
88
|
+
height,
|
|
89
|
+
...others
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
export { HvHeatmap };
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
2
2
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
//#region src/Heatmap/Heatmap.styles.tsx
|
|
4
|
+
var { useClasses, staticClasses } = createClasses("HvHeatmap", {
|
|
5
|
+
tooltipRoot: {
|
|
6
|
+
backgroundColor: theme.colors.bgContainer,
|
|
7
|
+
width: "fit-content",
|
|
8
|
+
minWidth: 150,
|
|
9
|
+
boxShadow: theme.colors.shadow,
|
|
10
|
+
zIndex: theme.zIndices.sticky
|
|
11
|
+
},
|
|
12
|
+
tooltipContainer: {
|
|
13
|
+
padding: theme.spacing("15px", "sm"),
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column"
|
|
16
|
+
},
|
|
17
|
+
tooltipText: {
|
|
18
|
+
fontFamily: theme.fontFamily.body,
|
|
19
|
+
fontWeight: theme.fontWeights.normal,
|
|
20
|
+
fontSize: theme.fontSizes.sm,
|
|
21
|
+
color: theme.colors.text
|
|
22
|
+
}
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
useClasses
|
|
26
|
-
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { useClasses };
|