@hitachivantara/uikit-react-viz 5.16.6 → 6.0.0-next.1

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.
Files changed (66) hide show
  1. package/dist/{esm/BaseChart → BaseChart}/BaseChart.js +1 -1
  2. package/dist/{types/index.d.ts → index.d.ts} +6 -4
  3. package/dist/{esm/index.js → index.js} +3 -2
  4. package/dist/{esm/providers → providers}/Provider.js +9 -5
  5. package/dist/{esm/utils → utils}/registerTheme.js +1 -1
  6. package/package.json +12 -12
  7. package/dist/cjs/BarChart/BarChart.cjs +0 -138
  8. package/dist/cjs/BaseChart/BaseChart.cjs +0 -77
  9. package/dist/cjs/Boxplot/Boxplot.cjs +0 -116
  10. package/dist/cjs/Boxplot/Boxplot.styles.cjs +0 -26
  11. package/dist/cjs/Boxplot/useBoxplot.cjs +0 -72
  12. package/dist/cjs/Boxplot/useBoxplotData.cjs +0 -40
  13. package/dist/cjs/ConfusionMatrix/ConfusionMatrix.cjs +0 -182
  14. package/dist/cjs/ConfusionMatrix/ConfusionMatrix.styles.cjs +0 -29
  15. package/dist/cjs/ConfusionMatrix/utils.cjs +0 -142
  16. package/dist/cjs/DonutChart/DonutChart.cjs +0 -111
  17. package/dist/cjs/Heatmap/Heatmap.cjs +0 -127
  18. package/dist/cjs/Heatmap/Heatmap.styles.cjs +0 -26
  19. package/dist/cjs/LineChart/LineChart.cjs +0 -136
  20. package/dist/cjs/ScatterPlot/ScatterPlot.cjs +0 -128
  21. package/dist/cjs/Treemap/Treemap.cjs +0 -72
  22. package/dist/cjs/hooks/tooltip/styles.cjs +0 -80
  23. package/dist/cjs/hooks/tooltip/useTooltip.cjs +0 -116
  24. package/dist/cjs/hooks/useData.cjs +0 -164
  25. package/dist/cjs/hooks/useDataZoom.cjs +0 -27
  26. package/dist/cjs/hooks/useDataset.cjs +0 -16
  27. package/dist/cjs/hooks/useGrid.cjs +0 -39
  28. package/dist/cjs/hooks/useLegend.cjs +0 -46
  29. package/dist/cjs/hooks/useOption.cjs +0 -20
  30. package/dist/cjs/hooks/useSeries.cjs +0 -119
  31. package/dist/cjs/hooks/useVisualMap.cjs +0 -57
  32. package/dist/cjs/hooks/useVizTheme.cjs +0 -8
  33. package/dist/cjs/hooks/useXAxis.cjs +0 -64
  34. package/dist/cjs/hooks/useYAxis.cjs +0 -58
  35. package/dist/cjs/index.cjs +0 -25
  36. package/dist/cjs/providers/Provider.cjs +0 -20
  37. package/dist/cjs/utils/index.cjs +0 -193
  38. package/dist/cjs/utils/registerTheme.cjs +0 -142
  39. package/dist/esm/hooks/useVizTheme.js +0 -8
  40. /package/dist/{esm/BarChart → BarChart}/BarChart.js +0 -0
  41. /package/dist/{esm/Boxplot → Boxplot}/Boxplot.js +0 -0
  42. /package/dist/{esm/Boxplot → Boxplot}/Boxplot.styles.js +0 -0
  43. /package/dist/{esm/Boxplot → Boxplot}/useBoxplot.js +0 -0
  44. /package/dist/{esm/Boxplot → Boxplot}/useBoxplotData.js +0 -0
  45. /package/dist/{esm/ConfusionMatrix → ConfusionMatrix}/ConfusionMatrix.js +0 -0
  46. /package/dist/{esm/ConfusionMatrix → ConfusionMatrix}/ConfusionMatrix.styles.js +0 -0
  47. /package/dist/{esm/ConfusionMatrix → ConfusionMatrix}/utils.js +0 -0
  48. /package/dist/{esm/DonutChart → DonutChart}/DonutChart.js +0 -0
  49. /package/dist/{esm/Heatmap → Heatmap}/Heatmap.js +0 -0
  50. /package/dist/{esm/Heatmap → Heatmap}/Heatmap.styles.js +0 -0
  51. /package/dist/{esm/LineChart → LineChart}/LineChart.js +0 -0
  52. /package/dist/{esm/ScatterPlot → ScatterPlot}/ScatterPlot.js +0 -0
  53. /package/dist/{esm/Treemap → Treemap}/Treemap.js +0 -0
  54. /package/dist/{esm/hooks → hooks}/tooltip/styles.js +0 -0
  55. /package/dist/{esm/hooks → hooks}/tooltip/useTooltip.js +0 -0
  56. /package/dist/{esm/hooks → hooks}/useData.js +0 -0
  57. /package/dist/{esm/hooks → hooks}/useDataZoom.js +0 -0
  58. /package/dist/{esm/hooks → hooks}/useDataset.js +0 -0
  59. /package/dist/{esm/hooks → hooks}/useGrid.js +0 -0
  60. /package/dist/{esm/hooks → hooks}/useLegend.js +0 -0
  61. /package/dist/{esm/hooks → hooks}/useOption.js +0 -0
  62. /package/dist/{esm/hooks → hooks}/useSeries.js +0 -0
  63. /package/dist/{esm/hooks → hooks}/useVisualMap.js +0 -0
  64. /package/dist/{esm/hooks → hooks}/useXAxis.js +0 -0
  65. /package/dist/{esm/hooks → hooks}/useYAxis.js +0 -0
  66. /package/dist/{esm/utils → utils}/index.js +0 -0
@@ -1,182 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const charts = require("echarts/charts");
6
- const components = require("echarts/components");
7
- const echarts = require("echarts/core");
8
- const index = require("../utils/index.cjs");
9
- const ConfusionMatrix_styles = require("./ConfusionMatrix.styles.cjs");
10
- const utils = require("./utils.cjs");
11
- const useVisualMap = require("../hooks/useVisualMap.cjs");
12
- const useData = require("../hooks/useData.cjs");
13
- const useTooltip = require("../hooks/tooltip/useTooltip.cjs");
14
- const useYAxis = require("../hooks/useYAxis.cjs");
15
- const useXAxis = require("../hooks/useXAxis.cjs");
16
- const useGrid = require("../hooks/useGrid.cjs");
17
- const useOption = require("../hooks/useOption.cjs");
18
- const BaseChart = require("../BaseChart/BaseChart.cjs");
19
- function _interopNamespace(e) {
20
- if (e && e.__esModule) return e;
21
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
22
- if (e) {
23
- for (const k in e) {
24
- if (k !== "default") {
25
- const d = Object.getOwnPropertyDescriptor(e, k);
26
- Object.defineProperty(n, k, d.get ? d : {
27
- enumerable: true,
28
- get: () => e[k]
29
- });
30
- }
31
- }
32
- }
33
- n.default = e;
34
- return Object.freeze(n);
35
- }
36
- const echarts__namespace = /* @__PURE__ */ _interopNamespace(echarts);
37
- echarts__namespace.use([
38
- charts.HeatmapChart,
39
- components.VisualMapComponent,
40
- components.GridComponent,
41
- components.TooltipComponent
42
- ]);
43
- const HvConfusionMatrix = react.forwardRef(function HvConfusionMatrix2(props, ref) {
44
- const {
45
- legend,
46
- groupBy,
47
- measure,
48
- sortBy,
49
- splitBy,
50
- filters,
51
- grid,
52
- data: dataProp,
53
- tooltip,
54
- xAxis,
55
- yAxis,
56
- colorScale: colorScaleProp,
57
- delta,
58
- valuesProps,
59
- width,
60
- height,
61
- format = "square",
62
- classes: classesProp,
63
- onOptionChange,
64
- ...others
65
- } = props;
66
- const { classes } = ConfusionMatrix_styles.useClasses(classesProp);
67
- const groupByKey = index.getGroupKey(groupBy);
68
- const { data: chartData } = useData.useData({
69
- data: dataProp,
70
- groupBy,
71
- measures: [measure],
72
- sortBy: sortBy ?? groupBy,
73
- // automatically orders x axis to create the confusion matrix
74
- splitBy,
75
- filters,
76
- delta: typeof delta === "string" ? delta : void 0
77
- });
78
- const colorScale = utils.useColorScale({
79
- delta: !!delta,
80
- data: chartData,
81
- custom: colorScaleProp,
82
- filterKey: groupByKey
83
- });
84
- const chartVisualMap = useVisualMap.useVisualMap({
85
- show: colorScale?.pieces != null,
86
- type: colorScale?.pieces != null ? "piecewise" : "continuous",
87
- ...colorScale,
88
- ...legend
89
- });
90
- const chartTooltip = useTooltip.useTooltip({
91
- component: (params) => {
92
- const value = params?.series?.[0].value;
93
- const fmtValue = typeof measure !== "string" && measure.valueFormatter ? measure.valueFormatter(value) : tooltip?.valueFormatter ? tooltip?.valueFormatter(value) : value;
94
- const ftmTitle = tooltip?.titleFormatter ? tooltip.titleFormatter(params?.title) : params?.title;
95
- const content = `${ftmTitle} - ${params?.series?.[0].name}: ${fmtValue}`;
96
- return `
97
- <div class="${classes.tooltipRoot}">
98
- <div class="${classes.tooltipContainer}">
99
- <div>
100
- <p class="${classes.tooltipText}">${content}</p>
101
- </div>
102
- </div>
103
- </div>`;
104
- },
105
- ...tooltip
106
- });
107
- const chartYAxis = useYAxis.useYAxis({
108
- axes: [
109
- {
110
- type: "categorical",
111
- name: "True Label",
112
- position: "left",
113
- ...yAxis,
114
- nameProps: {
115
- location: "center",
116
- padding: yAxis?.nameProps?.location == null || yAxis?.nameProps?.location === "center" ? yAxis?.position === "right" ? [50, 0, 0, 0] : [0, 0, 50, 0] : void 0,
117
- ...yAxis?.nameProps
118
- },
119
- data: chartData.columnNames().filter((p) => p !== groupByKey).reverse()
120
- }
121
- ]
122
- });
123
- const chartXAxis = useXAxis.useXAxis({
124
- name: "Predicted Value",
125
- position: "top",
126
- ...xAxis,
127
- nameProps: {
128
- location: "center",
129
- padding: xAxis?.nameProps?.location == null || xAxis?.nameProps?.location === "center" ? xAxis?.position === "bottom" ? [30, 0, 0, 0] : [0, 0, 30, 0] : void 0,
130
- ...xAxis?.nameProps
131
- },
132
- data: chartData.array(groupByKey)
133
- });
134
- const chartSeries = utils.useSeries({
135
- data: chartData,
136
- filterKey: groupByKey,
137
- valuesProps,
138
- delta: !!(delta && colorScale == null)
139
- });
140
- const chartGridLayout = utils.useGridLayout({
141
- data: chartData,
142
- format,
143
- filterKey: groupByKey,
144
- visualMapVisible: chartVisualMap.visualMap.show,
145
- visualMapYPosition: chartVisualMap.visualMap.top,
146
- xAxisPosition: chartXAxis.xAxis.position
147
- });
148
- const chartGrid = useGrid.useGrid({
149
- // If sizes are provided, the grid size should automatically adapt to the values provided
150
- width: width != null ? void 0 : chartGridLayout.size.width,
151
- height: height != null ? void 0 : chartGridLayout.size.height,
152
- ...chartGridLayout.padding,
153
- ...grid
154
- });
155
- const size = react.useMemo(() => {
156
- return {
157
- width,
158
- // Echarts has a problem were the height is always set to 300px
159
- // Thus, we need to update the height to make sure the chart is not cut out
160
- height: height ?? chartGridLayout.size.height + chartGridLayout.padding.bottom + chartGridLayout.padding.top
161
- };
162
- }, [
163
- chartGridLayout.padding.bottom,
164
- chartGridLayout.padding.top,
165
- chartGridLayout.size.height,
166
- height,
167
- width
168
- ]);
169
- const option = useOption.useOption({
170
- option: {
171
- ...chartVisualMap,
172
- ...chartTooltip,
173
- ...chartGrid,
174
- ...chartXAxis,
175
- ...chartYAxis,
176
- ...chartSeries
177
- },
178
- onOptionChange
179
- });
180
- return /* @__PURE__ */ jsxRuntime.jsx(BaseChart.HvBaseChart, { ref, option, ...size, ...others });
181
- });
182
- exports.HvConfusionMatrix = HvConfusionMatrix;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
4
- const uikitStyles = require("@hitachivantara/uikit-styles");
5
- const { useClasses, staticClasses } = uikitReactUtils.createClasses(
6
- "HvConfusionMatrix",
7
- {
8
- tooltipRoot: {
9
- backgroundColor: uikitStyles.theme.colors.bgContainer,
10
- width: "fit-content",
11
- minWidth: 150,
12
- boxShadow: uikitStyles.theme.colors.shadow,
13
- zIndex: uikitStyles.theme.zIndices.sticky
14
- },
15
- tooltipContainer: {
16
- padding: uikitStyles.theme.spacing("15px", "sm"),
17
- display: "flex",
18
- flexDirection: "column"
19
- },
20
- tooltipText: {
21
- fontFamily: uikitStyles.theme.fontFamily.body,
22
- fontWeight: uikitStyles.theme.fontWeights.normal,
23
- fontSize: uikitStyles.theme.fontSizes.sm,
24
- color: uikitStyles.theme.colors.text
25
- }
26
- }
27
- );
28
- exports.staticClasses = staticClasses;
29
- exports.useClasses = useClasses;
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const react = require("react");
4
- const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
5
- const useColorScale = ({
6
- data,
7
- delta,
8
- custom,
9
- filterKey
10
- }) => {
11
- const { colors } = uikitReactUtils.useTheme();
12
- const colorScale = react.useMemo(() => {
13
- if (custom == null && delta) {
14
- return;
15
- }
16
- if (custom && typeof custom[0] === "object") {
17
- return {
18
- pieces: custom.reduce((acc, curr) => {
19
- acc.push({
20
- ...curr,
21
- color: colors?.[curr.color] || curr.color
22
- });
23
- return acc;
24
- }, [])
25
- };
26
- }
27
- const flatData = data.columnNames().filter((p) => p !== filterKey).reduce((acc, c) => {
28
- acc.push(...data.array(c));
29
- return acc;
30
- }, []);
31
- const max = Math.max(...flatData);
32
- const min = Math.min(...flatData);
33
- const parsedColors = custom?.map(
34
- (c) => typeof c === "string" ? colors?.[c] || c : c.color
35
- );
36
- return {
37
- colorScale: parsedColors || [colors?.textLight || "", colors?.cat3 || ""],
38
- max,
39
- min
40
- };
41
- }, [colors, custom, data, filterKey, delta]);
42
- return colorScale;
43
- };
44
- const useSeries = ({
45
- data,
46
- filterKey,
47
- delta,
48
- valuesProps
49
- }) => {
50
- const { colors } = uikitReactUtils.useTheme();
51
- const getDeltaColor = react.useCallback(
52
- (value, diagonal) => {
53
- if (diagonal && value > 0 || !diagonal && value < 0) {
54
- return colors?.positive;
55
- }
56
- if (diagonal && value < 0 || !diagonal && value > 0) {
57
- return colors?.negative;
58
- }
59
- return colors?.textLight;
60
- },
61
- [colors]
62
- );
63
- const chartSeries = react.useMemo(() => {
64
- return {
65
- series: {
66
- id: `series~${filterKey}`,
67
- type: "heatmap",
68
- label: {
69
- show: true,
70
- ...valuesProps,
71
- ...valuesProps?.color && {
72
- color: colors?.[valuesProps.color] || valuesProps.color
73
- }
74
- },
75
- emphasis: {
76
- disabled: true
77
- },
78
- data: data.columnNames().filter((p) => p !== filterKey).reduce((acc, c, j) => {
79
- const row = data.array(c).reduce((racc, rv, i) => {
80
- racc.push({
81
- value: [data.array(filterKey)[i], c, rv != null ? rv : "-"],
82
- ...delta && {
83
- visualMap: false,
84
- itemStyle: {
85
- color: getDeltaColor(rv, i === j)
86
- }
87
- }
88
- });
89
- return racc;
90
- }, []);
91
- acc.push(...row);
92
- return acc;
93
- }, [])
94
- }
95
- };
96
- }, [colors, data, delta, filterKey, getDeltaColor, valuesProps]);
97
- return chartSeries;
98
- };
99
- const SQUARE_SIZE = 52;
100
- const useGridLayout = ({
101
- data,
102
- filterKey,
103
- format,
104
- xAxisPosition,
105
- visualMapVisible,
106
- visualMapYPosition
107
- }) => {
108
- const size = react.useMemo(() => {
109
- const nCols = data.array(filterKey).length;
110
- const nRows = data.columnNames().filter((p) => p !== filterKey).length;
111
- const itemHeight = format === "square" ? SQUARE_SIZE : SQUARE_SIZE / 2;
112
- return {
113
- padding: {
114
- bottom: xAxisPosition === "bottom" || visualMapVisible && visualMapYPosition === "bottom" ? 60 : 20,
115
- top: xAxisPosition === "top" || visualMapVisible && visualMapYPosition === "top" ? 60 : 20,
116
- ...visualMapVisible && visualMapYPosition === "bottom" && xAxisPosition === "bottom" && {
117
- bottom: 100
118
- },
119
- ...visualMapVisible && visualMapYPosition === "top" && xAxisPosition === "top" && {
120
- top: 100
121
- },
122
- left: 80,
123
- right: 80
124
- },
125
- size: {
126
- height: Math.max(itemHeight * nRows, itemHeight * 8),
127
- width: Math.max(SQUARE_SIZE * nCols, SQUARE_SIZE * 8)
128
- }
129
- };
130
- }, [
131
- data,
132
- filterKey,
133
- format,
134
- visualMapVisible,
135
- visualMapYPosition,
136
- xAxisPosition
137
- ]);
138
- return size;
139
- };
140
- exports.useColorScale = useColorScale;
141
- exports.useGridLayout = useGridLayout;
142
- exports.useSeries = useSeries;
@@ -1,111 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const charts = require("echarts/charts");
6
- const components = require("echarts/components");
7
- const echarts = require("echarts/core");
8
- const useData = require("../hooks/useData.cjs");
9
- const useDataset = require("../hooks/useDataset.cjs");
10
- const useSeries = require("../hooks/useSeries.cjs");
11
- const useLegend = require("../hooks/useLegend.cjs");
12
- const useTooltip = require("../hooks/tooltip/useTooltip.cjs");
13
- const useGrid = require("../hooks/useGrid.cjs");
14
- const useOption = require("../hooks/useOption.cjs");
15
- const BaseChart = require("../BaseChart/BaseChart.cjs");
16
- function _interopNamespace(e) {
17
- if (e && e.__esModule) return e;
18
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
19
- if (e) {
20
- for (const k in e) {
21
- if (k !== "default") {
22
- const d = Object.getOwnPropertyDescriptor(e, k);
23
- Object.defineProperty(n, k, d.get ? d : {
24
- enumerable: true,
25
- get: () => e[k]
26
- });
27
- }
28
- }
29
- }
30
- n.default = e;
31
- return Object.freeze(n);
32
- }
33
- const echarts__namespace = /* @__PURE__ */ _interopNamespace(echarts);
34
- echarts__namespace.use([
35
- charts.PieChart,
36
- components.DatasetComponent,
37
- components.GridComponent,
38
- components.TooltipComponent,
39
- components.LegendComponent
40
- ]);
41
- const HvDonutChart = react.forwardRef(
42
- function HvDonutChart2(props, ref) {
43
- const {
44
- data,
45
- groupBy,
46
- classes,
47
- legend,
48
- tooltip,
49
- measure: measures,
50
- sortBy,
51
- filters,
52
- grid,
53
- width,
54
- height,
55
- type = "regular",
56
- slicesNameFormatter,
57
- onOptionChange,
58
- ...others
59
- } = props;
60
- const { data: chartData, mapping: measuresMapping } = useData.useData({
61
- data,
62
- groupBy,
63
- measures,
64
- sortBy,
65
- filters
66
- });
67
- const chartDataset = useDataset.useDataset(chartData);
68
- const chartSeries = useSeries.useSeries({
69
- type: "pie",
70
- data: chartData,
71
- groupBy,
72
- measuresMapping,
73
- radius: type === "thin" ? ["65%", "70%"] : ["55%", "70%"]
74
- });
75
- const chartLegend = useLegend.useLegend({
76
- ...legend,
77
- show: legend?.show ?? true,
78
- icon: "square",
79
- series: chartSeries.series,
80
- formatter: slicesNameFormatter
81
- });
82
- const chartTooltip = useTooltip.useTooltip({
83
- ...tooltip,
84
- measuresMapping,
85
- classes,
86
- nameFormatter: slicesNameFormatter
87
- });
88
- const chartGrid = useGrid.useGrid({ ...grid });
89
- const option = useOption.useOption({
90
- option: {
91
- ...chartSeries,
92
- ...chartDataset,
93
- ...chartLegend,
94
- ...chartTooltip,
95
- ...chartGrid
96
- },
97
- onOptionChange
98
- });
99
- return /* @__PURE__ */ jsxRuntime.jsx(
100
- BaseChart.HvBaseChart,
101
- {
102
- ref,
103
- option,
104
- width,
105
- height,
106
- ...others
107
- }
108
- );
109
- }
110
- );
111
- exports.HvDonutChart = HvDonutChart;
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const charts = require("echarts/charts");
6
- const components = require("echarts/components");
7
- const echarts = require("echarts/core");
8
- const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
9
- const Heatmap_styles = require("./Heatmap.styles.cjs");
10
- const useTooltip = require("../hooks/tooltip/useTooltip.cjs");
11
- const useXAxis = require("../hooks/useXAxis.cjs");
12
- const useYAxis = require("../hooks/useYAxis.cjs");
13
- const useVisualMap = require("../hooks/useVisualMap.cjs");
14
- const useOption = require("../hooks/useOption.cjs");
15
- const BaseChart = require("../BaseChart/BaseChart.cjs");
16
- function _interopNamespace(e) {
17
- if (e && e.__esModule) return e;
18
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
19
- if (e) {
20
- for (const k in e) {
21
- if (k !== "default") {
22
- const d = Object.getOwnPropertyDescriptor(e, k);
23
- Object.defineProperty(n, k, d.get ? d : {
24
- enumerable: true,
25
- get: () => e[k]
26
- });
27
- }
28
- }
29
- }
30
- n.default = e;
31
- return Object.freeze(n);
32
- }
33
- const echarts__namespace = /* @__PURE__ */ _interopNamespace(echarts);
34
- echarts__namespace.use([charts.HeatmapChart, components.TooltipComponent, components.VisualMapComponent]);
35
- const HvHeatmap = react.forwardRef(
36
- function HvHeatmap2(props, ref) {
37
- const {
38
- name,
39
- data,
40
- min,
41
- max,
42
- colorScale,
43
- xAxis,
44
- yAxis,
45
- classes: classesProp,
46
- tooltip,
47
- width,
48
- height,
49
- onOptionChange,
50
- ...others
51
- } = props;
52
- const { classes } = Heatmap_styles.useClasses(classesProp);
53
- const { colors } = uikitReactUtils.useTheme();
54
- const chartTooltip = useTooltip.useTooltip({
55
- component: (params) => {
56
- const value = params?.value;
57
- const title = params?.title;
58
- const valueToShow = value ? `${yAxis?.data?.[Number(value[1])]} - ${xAxis?.data?.[Number(value[0])]}: ${params?.series?.[0]?.name}` : "-";
59
- return `
60
- <div class="${classes.tooltipRoot}">
61
- <div class="${classes.tooltipContainer}">
62
- <div>
63
- <p class="${classes.tooltipText}">${title}</p>
64
- <p class="${classes.tooltipText}">${valueToShow}</p>
65
- </div>
66
- </div>
67
- </div>`;
68
- },
69
- ...tooltip
70
- });
71
- const chartXAxis = useXAxis.useXAxis({ type: "categorical", ...xAxis });
72
- const chartYAxis = useYAxis.useYAxis({
73
- defaultType: "categorical",
74
- axes: yAxis ? [yAxis] : []
75
- });
76
- const convertedColors = colorScale?.map(
77
- (color) => colors?.[color] || color
78
- );
79
- const chartVisualMap = useVisualMap.useVisualMap({
80
- min,
81
- max,
82
- orient: "horizontal",
83
- left: "center",
84
- calculable: true,
85
- position: {
86
- y: "bottom"
87
- },
88
- colorScale: convertedColors || ["#2D4B87", "#95AFE8", "#E7EDF9"]
89
- });
90
- const option = useOption.useOption({
91
- option: {
92
- xAxis: chartXAxis.xAxis,
93
- yAxis: chartYAxis.yAxis,
94
- visualMap: chartVisualMap.visualMap,
95
- series: [
96
- {
97
- name,
98
- type: "heatmap",
99
- data,
100
- label: {
101
- show: true
102
- },
103
- emphasis: {
104
- itemStyle: {
105
- shadowBlur: 10,
106
- shadowColor: "rgba(0, 0, 0, 0.5)"
107
- }
108
- }
109
- }
110
- ],
111
- ...chartTooltip
112
- },
113
- onOptionChange
114
- });
115
- return /* @__PURE__ */ jsxRuntime.jsx(
116
- BaseChart.HvBaseChart,
117
- {
118
- ref,
119
- option,
120
- width,
121
- height,
122
- ...others
123
- }
124
- );
125
- }
126
- );
127
- exports.HvHeatmap = HvHeatmap;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
4
- const uikitStyles = require("@hitachivantara/uikit-styles");
5
- const { useClasses, staticClasses } = uikitReactUtils.createClasses("HvHeatmap", {
6
- tooltipRoot: {
7
- backgroundColor: uikitStyles.theme.colors.bgContainer,
8
- width: "fit-content",
9
- minWidth: 150,
10
- boxShadow: uikitStyles.theme.colors.shadow,
11
- zIndex: uikitStyles.theme.zIndices.sticky
12
- },
13
- tooltipContainer: {
14
- padding: uikitStyles.theme.spacing("15px", "sm"),
15
- display: "flex",
16
- flexDirection: "column"
17
- },
18
- tooltipText: {
19
- fontFamily: uikitStyles.theme.fontFamily.body,
20
- fontWeight: uikitStyles.theme.fontWeights.normal,
21
- fontSize: uikitStyles.theme.fontSizes.sm,
22
- color: uikitStyles.theme.colors.text
23
- }
24
- });
25
- exports.staticClasses = staticClasses;
26
- exports.useClasses = useClasses;