@hitachivantara/uikit-react-viz 5.16.7 → 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.
- package/dist/{esm/BaseChart → BaseChart}/BaseChart.js +1 -1
- package/dist/{types/index.d.ts → index.d.ts} +6 -4
- package/dist/{esm/index.js → index.js} +3 -2
- package/dist/{esm/providers → providers}/Provider.js +9 -5
- package/dist/{esm/utils → utils}/registerTheme.js +1 -1
- package/package.json +12 -12
- package/dist/cjs/BarChart/BarChart.cjs +0 -138
- package/dist/cjs/BaseChart/BaseChart.cjs +0 -77
- package/dist/cjs/Boxplot/Boxplot.cjs +0 -116
- package/dist/cjs/Boxplot/Boxplot.styles.cjs +0 -26
- package/dist/cjs/Boxplot/useBoxplot.cjs +0 -72
- package/dist/cjs/Boxplot/useBoxplotData.cjs +0 -40
- package/dist/cjs/ConfusionMatrix/ConfusionMatrix.cjs +0 -182
- package/dist/cjs/ConfusionMatrix/ConfusionMatrix.styles.cjs +0 -29
- package/dist/cjs/ConfusionMatrix/utils.cjs +0 -142
- package/dist/cjs/DonutChart/DonutChart.cjs +0 -111
- package/dist/cjs/Heatmap/Heatmap.cjs +0 -127
- package/dist/cjs/Heatmap/Heatmap.styles.cjs +0 -26
- package/dist/cjs/LineChart/LineChart.cjs +0 -136
- package/dist/cjs/ScatterPlot/ScatterPlot.cjs +0 -128
- package/dist/cjs/Treemap/Treemap.cjs +0 -72
- package/dist/cjs/hooks/tooltip/styles.cjs +0 -80
- package/dist/cjs/hooks/tooltip/useTooltip.cjs +0 -116
- package/dist/cjs/hooks/useData.cjs +0 -164
- package/dist/cjs/hooks/useDataZoom.cjs +0 -27
- package/dist/cjs/hooks/useDataset.cjs +0 -16
- package/dist/cjs/hooks/useGrid.cjs +0 -39
- package/dist/cjs/hooks/useLegend.cjs +0 -46
- package/dist/cjs/hooks/useOption.cjs +0 -20
- package/dist/cjs/hooks/useSeries.cjs +0 -119
- package/dist/cjs/hooks/useVisualMap.cjs +0 -57
- package/dist/cjs/hooks/useVizTheme.cjs +0 -8
- package/dist/cjs/hooks/useXAxis.cjs +0 -64
- package/dist/cjs/hooks/useYAxis.cjs +0 -58
- package/dist/cjs/index.cjs +0 -25
- package/dist/cjs/providers/Provider.cjs +0 -20
- package/dist/cjs/utils/index.cjs +0 -193
- package/dist/cjs/utils/registerTheme.cjs +0 -142
- package/dist/esm/hooks/useVizTheme.js +0 -8
- /package/dist/{esm/BarChart → BarChart}/BarChart.js +0 -0
- /package/dist/{esm/Boxplot → Boxplot}/Boxplot.js +0 -0
- /package/dist/{esm/Boxplot → Boxplot}/Boxplot.styles.js +0 -0
- /package/dist/{esm/Boxplot → Boxplot}/useBoxplot.js +0 -0
- /package/dist/{esm/Boxplot → Boxplot}/useBoxplotData.js +0 -0
- /package/dist/{esm/ConfusionMatrix → ConfusionMatrix}/ConfusionMatrix.js +0 -0
- /package/dist/{esm/ConfusionMatrix → ConfusionMatrix}/ConfusionMatrix.styles.js +0 -0
- /package/dist/{esm/ConfusionMatrix → ConfusionMatrix}/utils.js +0 -0
- /package/dist/{esm/DonutChart → DonutChart}/DonutChart.js +0 -0
- /package/dist/{esm/Heatmap → Heatmap}/Heatmap.js +0 -0
- /package/dist/{esm/Heatmap → Heatmap}/Heatmap.styles.js +0 -0
- /package/dist/{esm/LineChart → LineChart}/LineChart.js +0 -0
- /package/dist/{esm/ScatterPlot → ScatterPlot}/ScatterPlot.js +0 -0
- /package/dist/{esm/Treemap → Treemap}/Treemap.js +0 -0
- /package/dist/{esm/hooks → hooks}/tooltip/styles.js +0 -0
- /package/dist/{esm/hooks → hooks}/tooltip/useTooltip.js +0 -0
- /package/dist/{esm/hooks → hooks}/useData.js +0 -0
- /package/dist/{esm/hooks → hooks}/useDataZoom.js +0 -0
- /package/dist/{esm/hooks → hooks}/useDataset.js +0 -0
- /package/dist/{esm/hooks → hooks}/useGrid.js +0 -0
- /package/dist/{esm/hooks → hooks}/useLegend.js +0 -0
- /package/dist/{esm/hooks → hooks}/useOption.js +0 -0
- /package/dist/{esm/hooks → hooks}/useSeries.js +0 -0
- /package/dist/{esm/hooks → hooks}/useVisualMap.js +0 -0
- /package/dist/{esm/hooks → hooks}/useXAxis.js +0 -0
- /package/dist/{esm/hooks → hooks}/useYAxis.js +0 -0
- /package/dist/{esm/utils → utils}/index.js +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const useDataZoom = ({
|
|
5
|
-
showHorizontal = false
|
|
6
|
-
}) => {
|
|
7
|
-
const option = react.useMemo(() => {
|
|
8
|
-
return {
|
|
9
|
-
dataZoom: showHorizontal ? [
|
|
10
|
-
{
|
|
11
|
-
show: true,
|
|
12
|
-
type: "slider",
|
|
13
|
-
orient: "horizontal"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
show: true,
|
|
17
|
-
type: "inside",
|
|
18
|
-
orient: "horizontal",
|
|
19
|
-
zoomOnMouseWheel: "shift",
|
|
20
|
-
moveOnMouseWheel: true
|
|
21
|
-
}
|
|
22
|
-
] : []
|
|
23
|
-
};
|
|
24
|
-
}, [showHorizontal]);
|
|
25
|
-
return option;
|
|
26
|
-
};
|
|
27
|
-
exports.useDataZoom = useDataZoom;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const useDataset = (data) => {
|
|
5
|
-
return react.useMemo(() => {
|
|
6
|
-
return {
|
|
7
|
-
dataset: {
|
|
8
|
-
source: data.columnNames().reduce((acc, c) => {
|
|
9
|
-
acc[c] = data.array(c);
|
|
10
|
-
return acc;
|
|
11
|
-
}, {})
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}, [data]);
|
|
15
|
-
};
|
|
16
|
-
exports.useDataset = useDataset;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const useGrid = ({
|
|
5
|
-
top,
|
|
6
|
-
left,
|
|
7
|
-
right,
|
|
8
|
-
bottom,
|
|
9
|
-
width,
|
|
10
|
-
height
|
|
11
|
-
}) => {
|
|
12
|
-
const option = react.useMemo(() => {
|
|
13
|
-
return {
|
|
14
|
-
// if no value is defined we shouldn't pass anything because echarts doesn't behave well otherwise
|
|
15
|
-
grid: {
|
|
16
|
-
...top != null && {
|
|
17
|
-
top
|
|
18
|
-
},
|
|
19
|
-
...bottom != null && {
|
|
20
|
-
bottom
|
|
21
|
-
},
|
|
22
|
-
...left != null && {
|
|
23
|
-
left
|
|
24
|
-
},
|
|
25
|
-
...right != null && {
|
|
26
|
-
right
|
|
27
|
-
},
|
|
28
|
-
...width != null && {
|
|
29
|
-
width
|
|
30
|
-
},
|
|
31
|
-
...height != null && {
|
|
32
|
-
height
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}, [top, left, right, bottom, height, width]);
|
|
37
|
-
return option;
|
|
38
|
-
};
|
|
39
|
-
exports.useGrid = useGrid;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const index = require("../utils/index.cjs");
|
|
5
|
-
const useLegend = ({
|
|
6
|
-
series,
|
|
7
|
-
show,
|
|
8
|
-
icon,
|
|
9
|
-
formatter,
|
|
10
|
-
position: positionProp,
|
|
11
|
-
direction = "horizontal"
|
|
12
|
-
}) => {
|
|
13
|
-
const option = react.useMemo(() => {
|
|
14
|
-
const position = {
|
|
15
|
-
y: positionProp?.y ?? "top",
|
|
16
|
-
x: positionProp?.x ?? "center"
|
|
17
|
-
};
|
|
18
|
-
return {
|
|
19
|
-
legend: {
|
|
20
|
-
show: show ?? (Array.isArray(series) && series.length > 1),
|
|
21
|
-
itemGap: 20,
|
|
22
|
-
formatter,
|
|
23
|
-
orient: direction,
|
|
24
|
-
...position,
|
|
25
|
-
...icon && { icon: index.getLegendIcon(icon) },
|
|
26
|
-
...!icon && {
|
|
27
|
-
data: show !== false && Array.isArray(series) ? series.map((s) => {
|
|
28
|
-
let iconType = "line";
|
|
29
|
-
if (s.areaStyle != null) {
|
|
30
|
-
iconType = "square";
|
|
31
|
-
}
|
|
32
|
-
if (s.type === "scatter") {
|
|
33
|
-
iconType = "circle";
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
name: s.name,
|
|
37
|
-
icon: index.getLegendIcon(iconType)
|
|
38
|
-
};
|
|
39
|
-
}) : void 0
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}, [series, show, icon, formatter, positionProp, direction]);
|
|
44
|
-
return option;
|
|
45
|
-
};
|
|
46
|
-
exports.useLegend = useLegend;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const useOption = ({
|
|
5
|
-
option: optionProp,
|
|
6
|
-
onOptionChange
|
|
7
|
-
}) => {
|
|
8
|
-
const option = react.useMemo(() => {
|
|
9
|
-
const baseOption = {
|
|
10
|
-
aria: {
|
|
11
|
-
enabled: true
|
|
12
|
-
},
|
|
13
|
-
animation: false
|
|
14
|
-
};
|
|
15
|
-
const opt = { ...baseOption, ...optionProp };
|
|
16
|
-
return onOptionChange ? onOptionChange(opt) : opt;
|
|
17
|
-
}, [onOptionChange, optionProp]);
|
|
18
|
-
return option;
|
|
19
|
-
};
|
|
20
|
-
exports.useOption = useOption;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const index = require("../utils/index.cjs");
|
|
5
|
-
const useSeries = ({
|
|
6
|
-
groupBy,
|
|
7
|
-
type,
|
|
8
|
-
data,
|
|
9
|
-
measuresMapping,
|
|
10
|
-
nameFormatter,
|
|
11
|
-
stack,
|
|
12
|
-
emptyCellMode,
|
|
13
|
-
radius,
|
|
14
|
-
horizontal = false,
|
|
15
|
-
area = false,
|
|
16
|
-
areaOpacity = 0.5
|
|
17
|
-
}) => {
|
|
18
|
-
const groupByKey = index.getGroupKey(groupBy);
|
|
19
|
-
const option = react.useMemo(() => {
|
|
20
|
-
return {
|
|
21
|
-
series: data.columnNames().filter((c) => c !== groupByKey).map((c) => {
|
|
22
|
-
const measure = index.getMeasure(c, measuresMapping);
|
|
23
|
-
let pieOps = {};
|
|
24
|
-
let lineOps = {};
|
|
25
|
-
let barOps = {};
|
|
26
|
-
let scatterOps = {};
|
|
27
|
-
if (type === "scatter") {
|
|
28
|
-
const yAxisId = typeof measure !== "string" ? measure.yAxis : void 0;
|
|
29
|
-
scatterOps = {
|
|
30
|
-
yAxisId,
|
|
31
|
-
encode: {
|
|
32
|
-
x: groupByKey,
|
|
33
|
-
y: c
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
if (type === "pie") {
|
|
38
|
-
pieOps = {
|
|
39
|
-
encode: {
|
|
40
|
-
value: c,
|
|
41
|
-
itemName: groupByKey
|
|
42
|
-
},
|
|
43
|
-
labelLine: {
|
|
44
|
-
show: false
|
|
45
|
-
},
|
|
46
|
-
label: {
|
|
47
|
-
show: false
|
|
48
|
-
},
|
|
49
|
-
emphasis: {
|
|
50
|
-
label: {
|
|
51
|
-
show: false
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
radius
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
if (type === "line" || type === "bar") {
|
|
58
|
-
const sampling = typeof measure !== "string" ? measure.sampling : void 0;
|
|
59
|
-
const yAxisId = typeof measure !== "string" ? measure.yAxis : void 0;
|
|
60
|
-
const stackName = typeof measure !== "string" ? measure.stack ?? stack ?? void 0 : stack ?? void 0;
|
|
61
|
-
const axisOps = {
|
|
62
|
-
sampling,
|
|
63
|
-
yAxisId,
|
|
64
|
-
stack: stackName,
|
|
65
|
-
encode: horizontal ? {
|
|
66
|
-
x: c,
|
|
67
|
-
y: groupByKey
|
|
68
|
-
} : {
|
|
69
|
-
x: groupByKey,
|
|
70
|
-
y: c
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
if (type === "bar") {
|
|
74
|
-
barOps = {
|
|
75
|
-
...axisOps,
|
|
76
|
-
barMaxWidth: 90,
|
|
77
|
-
barMinWidth: 3
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (type === "line") {
|
|
81
|
-
const showSymbol = typeof measure !== "string" ? !measure.hideSymbol : true;
|
|
82
|
-
const connectNulls = typeof measure !== "string" && measure.emptyCellMode ? measure.emptyCellMode === "connect" : emptyCellMode === "connect";
|
|
83
|
-
const isArea = typeof measure !== "string" ? measure.area ?? area : area;
|
|
84
|
-
const aOpacity = typeof measure !== "string" ? measure.areaOpacity ?? areaOpacity : areaOpacity;
|
|
85
|
-
lineOps = {
|
|
86
|
-
...axisOps,
|
|
87
|
-
connectNulls,
|
|
88
|
-
showSymbol,
|
|
89
|
-
areaStyle: isArea ? { opacity: aOpacity } : void 0
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
id: `series~${groupByKey}~${c}`,
|
|
95
|
-
type,
|
|
96
|
-
name: nameFormatter ? nameFormatter(c) : c,
|
|
97
|
-
...pieOps,
|
|
98
|
-
...barOps,
|
|
99
|
-
...lineOps,
|
|
100
|
-
...scatterOps
|
|
101
|
-
};
|
|
102
|
-
})
|
|
103
|
-
};
|
|
104
|
-
}, [
|
|
105
|
-
data,
|
|
106
|
-
groupByKey,
|
|
107
|
-
measuresMapping,
|
|
108
|
-
type,
|
|
109
|
-
nameFormatter,
|
|
110
|
-
radius,
|
|
111
|
-
stack,
|
|
112
|
-
horizontal,
|
|
113
|
-
emptyCellMode,
|
|
114
|
-
area,
|
|
115
|
-
areaOpacity
|
|
116
|
-
]);
|
|
117
|
-
return option;
|
|
118
|
-
};
|
|
119
|
-
exports.useSeries = useSeries;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const index = require("../utils/index.cjs");
|
|
5
|
-
const useVisualMap = ({
|
|
6
|
-
show = true,
|
|
7
|
-
direction = "horizontal",
|
|
8
|
-
type = "continuous",
|
|
9
|
-
pieces,
|
|
10
|
-
max,
|
|
11
|
-
min,
|
|
12
|
-
colorScale,
|
|
13
|
-
position: positionProp,
|
|
14
|
-
...others
|
|
15
|
-
}) => {
|
|
16
|
-
const option = react.useMemo(() => {
|
|
17
|
-
return {
|
|
18
|
-
visualMap: {
|
|
19
|
-
type,
|
|
20
|
-
show,
|
|
21
|
-
...pieces && {
|
|
22
|
-
pieces
|
|
23
|
-
},
|
|
24
|
-
...type === "piecewise" && {
|
|
25
|
-
itemSymbol: index.getLegendIcon("square"),
|
|
26
|
-
itemGap: 20,
|
|
27
|
-
itemHeight: 16,
|
|
28
|
-
itemWidth: 16
|
|
29
|
-
},
|
|
30
|
-
...colorScale && {
|
|
31
|
-
max,
|
|
32
|
-
min,
|
|
33
|
-
inRange: {
|
|
34
|
-
color: colorScale
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
orient: direction,
|
|
38
|
-
top: positionProp?.y || "top",
|
|
39
|
-
left: positionProp?.x || "center",
|
|
40
|
-
...others
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}, [
|
|
44
|
-
colorScale,
|
|
45
|
-
direction,
|
|
46
|
-
max,
|
|
47
|
-
min,
|
|
48
|
-
others,
|
|
49
|
-
pieces,
|
|
50
|
-
positionProp?.x,
|
|
51
|
-
positionProp?.y,
|
|
52
|
-
show,
|
|
53
|
-
type
|
|
54
|
-
]);
|
|
55
|
-
return option;
|
|
56
|
-
};
|
|
57
|
-
exports.useVisualMap = useVisualMap;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const Provider = require("../providers/Provider.cjs");
|
|
5
|
-
const useVizTheme = () => {
|
|
6
|
-
return react.useContext(Provider.HvVizContext);
|
|
7
|
-
};
|
|
8
|
-
exports.useVizTheme = useVizTheme;
|
|
@@ -1,64 +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 index = require("../utils/index.cjs");
|
|
6
|
-
const useXAxis = ({
|
|
7
|
-
id,
|
|
8
|
-
type = "categorical",
|
|
9
|
-
labelFormatter,
|
|
10
|
-
labelRotation,
|
|
11
|
-
name,
|
|
12
|
-
maxValue,
|
|
13
|
-
minValue,
|
|
14
|
-
scale = false,
|
|
15
|
-
data,
|
|
16
|
-
position,
|
|
17
|
-
nameProps
|
|
18
|
-
}) => {
|
|
19
|
-
const { colors } = uikitReactUtils.useTheme();
|
|
20
|
-
const option = react.useMemo(() => {
|
|
21
|
-
const nameStyleKeys = nameProps ? Object.keys(nameProps).filter((key) => key !== "location") : void 0;
|
|
22
|
-
const nameStyle = nameProps && nameStyleKeys ? nameStyleKeys.reduce((acc, curr) => {
|
|
23
|
-
acc[curr] = curr === "color" && colors?.[nameProps[curr]] || nameProps[curr];
|
|
24
|
-
return acc;
|
|
25
|
-
}, {}) : void 0;
|
|
26
|
-
return {
|
|
27
|
-
xAxis: {
|
|
28
|
-
id,
|
|
29
|
-
type: index.getAxisType(type),
|
|
30
|
-
name,
|
|
31
|
-
scale,
|
|
32
|
-
axisLabel: {
|
|
33
|
-
rotate: labelRotation ?? 0,
|
|
34
|
-
formatter: labelFormatter
|
|
35
|
-
},
|
|
36
|
-
max: maxValue === "max" ? "dataMax" : maxValue,
|
|
37
|
-
min: minValue === "min" ? "dataMin" : minValue,
|
|
38
|
-
...nameProps?.location && {
|
|
39
|
-
nameLocation: nameProps.location
|
|
40
|
-
},
|
|
41
|
-
...nameStyle && {
|
|
42
|
-
nameTextStyle: nameStyle
|
|
43
|
-
},
|
|
44
|
-
...data && { data },
|
|
45
|
-
...position && { position }
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}, [
|
|
49
|
-
nameProps,
|
|
50
|
-
id,
|
|
51
|
-
type,
|
|
52
|
-
name,
|
|
53
|
-
scale,
|
|
54
|
-
labelRotation,
|
|
55
|
-
labelFormatter,
|
|
56
|
-
maxValue,
|
|
57
|
-
minValue,
|
|
58
|
-
data,
|
|
59
|
-
position,
|
|
60
|
-
colors
|
|
61
|
-
]);
|
|
62
|
-
return option;
|
|
63
|
-
};
|
|
64
|
-
exports.useXAxis = useXAxis;
|
|
@@ -1,58 +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 index = require("../utils/index.cjs");
|
|
6
|
-
const useYAxis = ({
|
|
7
|
-
axes,
|
|
8
|
-
defaultType = "continuous"
|
|
9
|
-
}) => {
|
|
10
|
-
const { colors } = uikitReactUtils.useTheme();
|
|
11
|
-
const createAxis = react.useCallback(
|
|
12
|
-
({
|
|
13
|
-
id,
|
|
14
|
-
type,
|
|
15
|
-
name,
|
|
16
|
-
labelFormatter,
|
|
17
|
-
labelRotation,
|
|
18
|
-
maxValue,
|
|
19
|
-
minValue,
|
|
20
|
-
nameProps,
|
|
21
|
-
data,
|
|
22
|
-
position
|
|
23
|
-
}) => {
|
|
24
|
-
const nameStyleKeys = nameProps ? Object.keys(nameProps).filter((key) => key !== "location") : void 0;
|
|
25
|
-
const nameStyle = nameProps && nameStyleKeys ? nameStyleKeys.reduce((acc, curr) => {
|
|
26
|
-
acc[curr] = curr === "color" && colors?.[nameProps[curr]] || nameProps[curr];
|
|
27
|
-
return acc;
|
|
28
|
-
}, {}) : void 0;
|
|
29
|
-
return {
|
|
30
|
-
id,
|
|
31
|
-
type: index.getAxisType(type) ?? index.getAxisType(defaultType),
|
|
32
|
-
name,
|
|
33
|
-
axisLabel: {
|
|
34
|
-
rotate: labelRotation ?? 0,
|
|
35
|
-
formatter: labelFormatter
|
|
36
|
-
},
|
|
37
|
-
max: maxValue === "max" ? "dataMax" : maxValue,
|
|
38
|
-
min: minValue === "min" ? "dataMin" : minValue,
|
|
39
|
-
...nameProps?.location && {
|
|
40
|
-
nameLocation: nameProps?.location
|
|
41
|
-
},
|
|
42
|
-
...nameStyle && {
|
|
43
|
-
nameTextStyle: nameStyle
|
|
44
|
-
},
|
|
45
|
-
...data && { data },
|
|
46
|
-
...position && { position }
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
[colors, defaultType]
|
|
50
|
-
);
|
|
51
|
-
const option = react.useMemo(() => {
|
|
52
|
-
return {
|
|
53
|
-
yAxis: Array.isArray(axes) ? axes.map((axis) => createAxis(axis)) : [createAxis({})]
|
|
54
|
-
};
|
|
55
|
-
}, [axes, createAxis]);
|
|
56
|
-
return option;
|
|
57
|
-
};
|
|
58
|
-
exports.useYAxis = useYAxis;
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Provider = require("./providers/Provider.cjs");
|
|
4
|
-
const index = require("./utils/index.cjs");
|
|
5
|
-
const BaseChart = require("./BaseChart/BaseChart.cjs");
|
|
6
|
-
const BarChart = require("./BarChart/BarChart.cjs");
|
|
7
|
-
const Boxplot = require("./Boxplot/Boxplot.cjs");
|
|
8
|
-
const ConfusionMatrix = require("./ConfusionMatrix/ConfusionMatrix.cjs");
|
|
9
|
-
const DonutChart = require("./DonutChart/DonutChart.cjs");
|
|
10
|
-
const Heatmap = require("./Heatmap/Heatmap.cjs");
|
|
11
|
-
const LineChart = require("./LineChart/LineChart.cjs");
|
|
12
|
-
const ScatterPlot = require("./ScatterPlot/ScatterPlot.cjs");
|
|
13
|
-
const Treemap = require("./Treemap/Treemap.cjs");
|
|
14
|
-
exports.HvVizContext = Provider.HvVizContext;
|
|
15
|
-
exports.HvVizProvider = Provider.HvVizProvider;
|
|
16
|
-
exports.getHvArqueroCombinedFilters = index.getHvArqueroCombinedFilters;
|
|
17
|
-
exports.HvBaseChart = BaseChart.HvBaseChart;
|
|
18
|
-
exports.HvBarChart = BarChart.HvBarChart;
|
|
19
|
-
exports.HvBoxplot = Boxplot.HvBoxplot;
|
|
20
|
-
exports.HvConfusionMatrix = ConfusionMatrix.HvConfusionMatrix;
|
|
21
|
-
exports.HvDonutChart = DonutChart.HvDonutChart;
|
|
22
|
-
exports.HvHeatmap = Heatmap.HvHeatmap;
|
|
23
|
-
exports.HvLineChart = LineChart.HvLineChart;
|
|
24
|
-
exports.HvScatterPlot = ScatterPlot.HvScatterPlot;
|
|
25
|
-
exports.HvTreemapChart = Treemap.HvTreemapChart;
|
|
@@ -1,20 +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 uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
6
|
-
const registerTheme = require("../utils/registerTheme.cjs");
|
|
7
|
-
const HvVizContext = react.createContext({
|
|
8
|
-
theme: void 0
|
|
9
|
-
});
|
|
10
|
-
const HvVizProvider = ({ children }) => {
|
|
11
|
-
const { activeTheme, selectedMode, selectedTheme } = uikitReactUtils.useTheme();
|
|
12
|
-
const value = react.useMemo(() => {
|
|
13
|
-
const themeName = `${selectedTheme}-${selectedMode}`;
|
|
14
|
-
registerTheme.registerTheme(themeName, selectedMode, activeTheme);
|
|
15
|
-
return { theme: themeName, activeTheme };
|
|
16
|
-
}, [selectedTheme, selectedMode, activeTheme]);
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.jsx(HvVizContext.Provider, { value, children });
|
|
18
|
-
};
|
|
19
|
-
exports.HvVizContext = HvVizContext;
|
|
20
|
-
exports.HvVizProvider = HvVizProvider;
|
package/dist/cjs/utils/index.cjs
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const arquero = require("arquero");
|
|
4
|
-
const getAxisType = (type) => {
|
|
5
|
-
switch (type) {
|
|
6
|
-
case "categorical":
|
|
7
|
-
return "category";
|
|
8
|
-
case "time":
|
|
9
|
-
return "time";
|
|
10
|
-
case "continuous":
|
|
11
|
-
return "value";
|
|
12
|
-
default:
|
|
13
|
-
return void 0;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const getGroupKey = (groupBy) => Array.isArray(groupBy) ? groupBy.join("_") : groupBy;
|
|
17
|
-
const getLegendIcon = (icon) => {
|
|
18
|
-
switch (icon) {
|
|
19
|
-
case "circle":
|
|
20
|
-
return "circle";
|
|
21
|
-
case "square":
|
|
22
|
-
return "path://M0,0L16,0L16,16L0,16L0,0Z";
|
|
23
|
-
case "line":
|
|
24
|
-
default:
|
|
25
|
-
return "path://M0,0L16,0L16,2L0,2Z";
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const getMeasure = (name, mapping) => {
|
|
29
|
-
let measure;
|
|
30
|
-
let count = 0;
|
|
31
|
-
for (const key of Object.keys(mapping)) {
|
|
32
|
-
if (name.includes(key) && key.length >= count) {
|
|
33
|
-
count = key.length;
|
|
34
|
-
measure = mapping[key];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return measure ?? Object.values(mapping)[0];
|
|
38
|
-
};
|
|
39
|
-
const getFilterFunction = (operation, field, value) => {
|
|
40
|
-
const valueArray = Array.isArray(value) ? value : [value];
|
|
41
|
-
if (valueArray.length === 0) return () => true;
|
|
42
|
-
switch (operation) {
|
|
43
|
-
case "is": {
|
|
44
|
-
return (row) => valueArray.includes(row[field]);
|
|
45
|
-
}
|
|
46
|
-
case "isNot": {
|
|
47
|
-
return (row) => !valueArray.includes(row[field]);
|
|
48
|
-
}
|
|
49
|
-
case "contains":
|
|
50
|
-
return (row) => {
|
|
51
|
-
let include = false;
|
|
52
|
-
for (const val of valueArray) {
|
|
53
|
-
if (String(row[field]).includes(String(val))) {
|
|
54
|
-
include = true;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return include;
|
|
58
|
-
};
|
|
59
|
-
case "notContains":
|
|
60
|
-
return (row) => {
|
|
61
|
-
let include = true;
|
|
62
|
-
for (const val of valueArray) {
|
|
63
|
-
if (String(row[field]).includes(String(val))) {
|
|
64
|
-
include = false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return include;
|
|
68
|
-
};
|
|
69
|
-
case "greaterThan":
|
|
70
|
-
return (row) => {
|
|
71
|
-
let include = false;
|
|
72
|
-
for (const val of valueArray) {
|
|
73
|
-
if (row[field] > val) {
|
|
74
|
-
include = true;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return include;
|
|
78
|
-
};
|
|
79
|
-
case "greaterThanOrEqual":
|
|
80
|
-
return (row) => {
|
|
81
|
-
let include = false;
|
|
82
|
-
for (const val of valueArray) {
|
|
83
|
-
if (row[field] >= val) {
|
|
84
|
-
include = true;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return include;
|
|
88
|
-
};
|
|
89
|
-
case "lessThan":
|
|
90
|
-
return (row) => {
|
|
91
|
-
let include = false;
|
|
92
|
-
for (const val of valueArray) {
|
|
93
|
-
if (row[field] < val) {
|
|
94
|
-
include = true;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return include;
|
|
98
|
-
};
|
|
99
|
-
case "lessThanOrEqual":
|
|
100
|
-
return (row) => {
|
|
101
|
-
let include = false;
|
|
102
|
-
for (const val of valueArray) {
|
|
103
|
-
if (row[field] <= val) {
|
|
104
|
-
include = true;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return include;
|
|
108
|
-
};
|
|
109
|
-
case "between":
|
|
110
|
-
return (row) => row[field] >= valueArray[0] && row[field] <= valueArray[1];
|
|
111
|
-
case "ends":
|
|
112
|
-
return (row) => {
|
|
113
|
-
let include = false;
|
|
114
|
-
for (const val of valueArray) {
|
|
115
|
-
if (String(row[field]).endsWith(String(val))) {
|
|
116
|
-
include = true;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return include;
|
|
120
|
-
};
|
|
121
|
-
case "notEnds":
|
|
122
|
-
return (row) => {
|
|
123
|
-
let include = true;
|
|
124
|
-
for (const val of valueArray) {
|
|
125
|
-
if (String(row[field]).endsWith(String(val))) {
|
|
126
|
-
include = false;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return include;
|
|
130
|
-
};
|
|
131
|
-
case "starts":
|
|
132
|
-
return (row) => {
|
|
133
|
-
let include = false;
|
|
134
|
-
for (const val of valueArray) {
|
|
135
|
-
if (String(row[field]).startsWith(String(val))) {
|
|
136
|
-
include = true;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return include;
|
|
140
|
-
};
|
|
141
|
-
case "notStarts":
|
|
142
|
-
return (row) => {
|
|
143
|
-
let include = true;
|
|
144
|
-
for (const val of valueArray) {
|
|
145
|
-
if (String(row[field]).startsWith(String(val))) {
|
|
146
|
-
include = false;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return include;
|
|
150
|
-
};
|
|
151
|
-
default:
|
|
152
|
-
throw new Error("Unsupported operation");
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const getHvArqueroCombinedFilters = (row, filters) => {
|
|
156
|
-
return filters.every((filter) => {
|
|
157
|
-
const { field, operation, value } = filter;
|
|
158
|
-
const filterFunction = Object.hasOwn(row, field) ? getFilterFunction(operation, field, value) : () => true;
|
|
159
|
-
return filterFunction(row);
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
const normalizeColumnName = (string) => {
|
|
163
|
-
return string.replace(/[^a-zA-Z0-9]/g, "__");
|
|
164
|
-
};
|
|
165
|
-
const processTableData = (data) => {
|
|
166
|
-
let tableData;
|
|
167
|
-
if (data instanceof arquero.internal.ColumnTable) {
|
|
168
|
-
tableData = data;
|
|
169
|
-
} else if (Array.isArray(data)) {
|
|
170
|
-
tableData = arquero.from(data);
|
|
171
|
-
} else {
|
|
172
|
-
tableData = arquero.table(data);
|
|
173
|
-
}
|
|
174
|
-
const nameMapping = {};
|
|
175
|
-
const reversedNameMapping = {};
|
|
176
|
-
for (const column of tableData.columnNames()) {
|
|
177
|
-
const normalizedName = normalizeColumnName(column);
|
|
178
|
-
nameMapping[column] = normalizedName;
|
|
179
|
-
reversedNameMapping[normalizedName] = column;
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
data: tableData.select(nameMapping),
|
|
183
|
-
mapping: reversedNameMapping
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
exports.getAxisType = getAxisType;
|
|
187
|
-
exports.getFilterFunction = getFilterFunction;
|
|
188
|
-
exports.getGroupKey = getGroupKey;
|
|
189
|
-
exports.getHvArqueroCombinedFilters = getHvArqueroCombinedFilters;
|
|
190
|
-
exports.getLegendIcon = getLegendIcon;
|
|
191
|
-
exports.getMeasure = getMeasure;
|
|
192
|
-
exports.normalizeColumnName = normalizeColumnName;
|
|
193
|
-
exports.processTableData = processTableData;
|