@hitachivantara/uikit-react-viz 5.1.0 → 5.2.0
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/cjs/components/BarChart/BarChart.cjs +16 -0
- package/dist/cjs/components/BarChart/BarChart.cjs.map +1 -0
- package/dist/cjs/components/BaseChart/BaseChart.cjs +423 -0
- package/dist/cjs/components/BaseChart/BaseChart.cjs.map +1 -0
- package/dist/cjs/components/{LineChart/LineChart.styles.cjs → BaseChart/BaseChart.styles.cjs} +2 -2
- package/dist/cjs/components/{LineChart/LineChart.styles.cjs.map → BaseChart/BaseChart.styles.cjs.map} +1 -1
- package/dist/cjs/components/LineChart/LineChart.cjs +8 -386
- package/dist/cjs/components/LineChart/LineChart.cjs.map +1 -1
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/providers/Provider.cjs +2 -103
- package/dist/cjs/providers/Provider.cjs.map +1 -1
- package/dist/cjs/utils/registerThemes.cjs +106 -0
- package/dist/cjs/utils/registerThemes.cjs.map +1 -0
- package/dist/esm/components/BarChart/BarChart.js +16 -0
- package/dist/esm/components/BarChart/BarChart.js.map +1 -0
- package/dist/esm/components/BaseChart/BaseChart.js +402 -0
- package/dist/esm/components/BaseChart/BaseChart.js.map +1 -0
- package/dist/esm/components/{LineChart/LineChart.styles.js → BaseChart/BaseChart.styles.js} +2 -2
- package/dist/esm/components/{LineChart/LineChart.styles.js.map → BaseChart/BaseChart.styles.js.map} +1 -1
- package/dist/esm/components/LineChart/LineChart.js +8 -365
- package/dist/esm/components/LineChart/LineChart.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/Provider.js +1 -83
- package/dist/esm/providers/Provider.js.map +1 -1
- package/dist/esm/utils/registerThemes.js +87 -0
- package/dist/esm/utils/registerThemes.js.map +1 -0
- package/dist/types/index.d.ts +133 -81
- package/package.json +3 -3
|
@@ -1,397 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const components = require("echarts/components");
|
|
5
|
-
const renderers = require("echarts/renderers");
|
|
6
|
-
const echarts = require("echarts/core");
|
|
7
|
-
const charts = require("echarts/charts");
|
|
8
|
-
const ReactECharts = require("echarts-for-react");
|
|
9
|
-
const arquero = require("arquero");
|
|
10
|
-
const getAxisType = require("../../utils/getAxisType.cjs");
|
|
11
|
-
const getAgFunc = require("../../utils/getAgFunc.cjs");
|
|
12
|
-
const getLegendIcon = require("../../utils/getLegendIcon.cjs");
|
|
13
|
-
const useVizTheme = require("../../hooks/useVizTheme.cjs");
|
|
14
|
-
const LineChart_styles = require("./LineChart.styles.cjs");
|
|
15
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
|
-
const
|
|
17
|
-
function _interopNamespace(e) {
|
|
18
|
-
if (e && e.__esModule)
|
|
19
|
-
return e;
|
|
20
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
21
|
-
if (e) {
|
|
22
|
-
for (const k in e) {
|
|
23
|
-
if (k !== "default") {
|
|
24
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: () => e[k]
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
n.default = e;
|
|
33
|
-
return Object.freeze(n);
|
|
34
|
-
}
|
|
35
|
-
const echarts__namespace = /* @__PURE__ */ _interopNamespace(echarts);
|
|
36
|
-
const ReactECharts__default = /* @__PURE__ */ _interopDefault(ReactECharts);
|
|
37
|
-
echarts__namespace.use([charts.LineChart, renderers.CanvasRenderer, components.DatasetComponent, components.GridComponent, components.AriaComponent, components.TooltipComponent, components.LegendComponent, components.DataZoomSliderComponent, components.DataZoomInsideComponent]);
|
|
4
|
+
const BaseChart = require("../BaseChart/BaseChart.cjs");
|
|
38
5
|
const HvLineChart = ({
|
|
39
|
-
data,
|
|
40
|
-
groupBy,
|
|
41
|
-
splitBy,
|
|
42
|
-
measures,
|
|
43
|
-
sortBy,
|
|
44
|
-
xAxis,
|
|
45
|
-
yAxis,
|
|
46
|
-
legend,
|
|
47
|
-
tooltip,
|
|
48
|
-
seriesNameFormatter,
|
|
49
6
|
area = false,
|
|
50
|
-
stack,
|
|
51
7
|
emptyCellMode = "void",
|
|
52
|
-
horizontalRangeSlider,
|
|
53
8
|
areaOpacity = 0.5,
|
|
54
|
-
|
|
55
|
-
grid
|
|
9
|
+
...others
|
|
56
10
|
}) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const currentTheme = react.useRef(theme);
|
|
64
|
-
const chartRef = react.useRef(null);
|
|
65
|
-
const isMounted = react.useRef(false);
|
|
66
|
-
const groupByKey = Array.isArray(groupBy) ? groupBy.join("_") : groupBy;
|
|
67
|
-
const chartData = react.useMemo(() => {
|
|
68
|
-
let tableData;
|
|
69
|
-
if (data instanceof arquero.internal.ColumnTable) {
|
|
70
|
-
tableData = data;
|
|
71
|
-
} else if (Array.isArray(data)) {
|
|
72
|
-
tableData = arquero.from(data);
|
|
73
|
-
} else {
|
|
74
|
-
tableData = arquero.table(data);
|
|
75
|
-
}
|
|
76
|
-
const groupByFields = groupBy ? Array.isArray(groupBy) ? groupBy : [groupBy] : [];
|
|
77
|
-
const splitByFields = Array.isArray(splitBy) ? splitBy : splitBy != null ? [splitBy] : [];
|
|
78
|
-
const measuresFields = measures == null ? {} : typeof measures === "string" ? {
|
|
79
|
-
[measures]: getAgFunc.getAgFunc("sum", measures)
|
|
80
|
-
} : Array.isArray(measures) ? measures.reduce((acc, value) => {
|
|
81
|
-
let field;
|
|
82
|
-
let agFunction;
|
|
83
|
-
if (typeof value === "string") {
|
|
84
|
-
field = value;
|
|
85
|
-
agFunction = "sum";
|
|
86
|
-
} else {
|
|
87
|
-
field = value.field;
|
|
88
|
-
agFunction = value.agg ?? "sum";
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
...acc,
|
|
92
|
-
[field]: getAgFunc.getAgFunc(agFunction, field)
|
|
93
|
-
};
|
|
94
|
-
}, {}) : {
|
|
95
|
-
[measures.field]: getAgFunc.getAgFunc(measures.agg ?? "sum", measures.field)
|
|
96
|
-
};
|
|
97
|
-
const sortByFields = sortBy == null ? {} : typeof sortBy === "string" ? {
|
|
98
|
-
[sortBy]: "asc"
|
|
99
|
-
} : Array.isArray(sortBy) ? sortBy.reduce((acc, value) => {
|
|
100
|
-
let field;
|
|
101
|
-
let orderFunction;
|
|
102
|
-
if (typeof value === "string") {
|
|
103
|
-
field = value;
|
|
104
|
-
orderFunction = "asc";
|
|
105
|
-
} else {
|
|
106
|
-
field = value.field;
|
|
107
|
-
orderFunction = value.order ?? "asc";
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
...acc,
|
|
111
|
-
[field]: orderFunction
|
|
112
|
-
};
|
|
113
|
-
}, {}) : {
|
|
114
|
-
[sortBy.field]: sortBy.order ?? "asc"
|
|
115
|
-
};
|
|
116
|
-
const allFields = [...groupByFields, ...splitByFields, ...Object.keys(measuresFields)];
|
|
117
|
-
tableData = tableData.select(...allFields);
|
|
118
|
-
if (groupByFields.length > 0) {
|
|
119
|
-
tableData = tableData.groupby(groupByFields);
|
|
120
|
-
}
|
|
121
|
-
if (splitByFields.length > 0) {
|
|
122
|
-
tableData = tableData.pivot(splitByFields, measuresFields);
|
|
123
|
-
} else {
|
|
124
|
-
tableData = tableData.rollup(measuresFields);
|
|
125
|
-
}
|
|
126
|
-
if (groupByFields.length > 1) {
|
|
127
|
-
const expression = `d => ${groupByFields.map((field) => `d.${field}`).join(" + '_' + ")}`;
|
|
128
|
-
tableData = tableData.derive({
|
|
129
|
-
[groupByKey]: expression
|
|
130
|
-
}, {
|
|
131
|
-
after: groupByFields[groupByFields.length - 1]
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (Object.keys(sortByFields).length > 0) {
|
|
135
|
-
tableData = tableData.orderby(...Object.keys(sortByFields).filter((key) => allFields.includes(key)).map((key) => sortByFields[key] === "desc" ? arquero.desc(key) : key));
|
|
136
|
-
}
|
|
137
|
-
if (groupByFields.length > 1) {
|
|
138
|
-
tableData = tableData.select(arquero.not(...groupByFields));
|
|
139
|
-
}
|
|
140
|
-
return tableData;
|
|
141
|
-
}, [data, groupBy, groupByKey, splitBy, measures, sortBy]);
|
|
142
|
-
const chartDataset = react.useMemo(() => {
|
|
143
|
-
return {
|
|
144
|
-
dataset: {
|
|
145
|
-
source: chartData.columnNames().reduce((acc, c) => ({
|
|
146
|
-
...acc,
|
|
147
|
-
[c]: chartData.array(c)
|
|
148
|
-
}), {})
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}, [chartData]);
|
|
152
|
-
const chartXAxis = react.useMemo(() => {
|
|
153
|
-
return {
|
|
154
|
-
xAxis: {
|
|
155
|
-
type: getAxisType.getAxisType(xAxis == null ? void 0 : xAxis.type) ?? "category",
|
|
156
|
-
name: xAxis == null ? void 0 : xAxis.name,
|
|
157
|
-
scale: true,
|
|
158
|
-
axisLabel: {
|
|
159
|
-
rotate: (xAxis == null ? void 0 : xAxis.labelRotation) ?? 0,
|
|
160
|
-
formatter: xAxis == null ? void 0 : xAxis.labelFormatter
|
|
161
|
-
},
|
|
162
|
-
max: (xAxis == null ? void 0 : xAxis.maxValue) === "max" ? "dataMax" : xAxis == null ? void 0 : xAxis.maxValue,
|
|
163
|
-
min: (xAxis == null ? void 0 : xAxis.minValue) === "min" ? "dataMin" : xAxis == null ? void 0 : xAxis.minValue
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
}, [xAxis == null ? void 0 : xAxis.labelFormatter, xAxis == null ? void 0 : xAxis.labelRotation, xAxis == null ? void 0 : xAxis.name, xAxis == null ? void 0 : xAxis.type, xAxis == null ? void 0 : xAxis.maxValue, xAxis == null ? void 0 : xAxis.minValue]);
|
|
167
|
-
const chartYAxis = react.useMemo(() => {
|
|
168
|
-
if (!yAxis || !Array.isArray(yAxis)) {
|
|
169
|
-
return {
|
|
170
|
-
yAxis: {
|
|
171
|
-
id: yAxis == null ? void 0 : yAxis.id,
|
|
172
|
-
type: getAxisType.getAxisType(yAxis == null ? void 0 : yAxis.type) ?? "value",
|
|
173
|
-
name: yAxis == null ? void 0 : yAxis.name,
|
|
174
|
-
axisLabel: {
|
|
175
|
-
rotate: (yAxis == null ? void 0 : yAxis.labelRotation) ?? 0,
|
|
176
|
-
formatter: yAxis == null ? void 0 : yAxis.labelFormatter
|
|
177
|
-
},
|
|
178
|
-
max: (yAxis == null ? void 0 : yAxis.maxValue) === "max" ? "dataMax" : yAxis == null ? void 0 : yAxis.maxValue,
|
|
179
|
-
min: (yAxis == null ? void 0 : yAxis.minValue) === "min" ? "dataMin" : yAxis == null ? void 0 : yAxis.minValue
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
yAxis: yAxis.map((axis) => ({
|
|
185
|
-
id: axis == null ? void 0 : axis.id,
|
|
186
|
-
type: getAxisType.getAxisType(axis == null ? void 0 : axis.type) ?? "value",
|
|
187
|
-
name: axis == null ? void 0 : axis.name,
|
|
188
|
-
axisLabel: {
|
|
189
|
-
rotate: (axis == null ? void 0 : axis.labelRotation) ?? 0,
|
|
190
|
-
formatter: axis == null ? void 0 : axis.labelFormatter
|
|
191
|
-
},
|
|
192
|
-
max: (axis == null ? void 0 : axis.maxValue) === "max" ? "dataMax" : axis == null ? void 0 : axis.maxValue,
|
|
193
|
-
min: (axis == null ? void 0 : axis.minValue) === "min" ? "dataMin" : axis == null ? void 0 : axis.minValue
|
|
194
|
-
}))
|
|
195
|
-
};
|
|
196
|
-
}, [yAxis]);
|
|
197
|
-
const getMeasure = (name, msr) => {
|
|
198
|
-
const measureName = name.split("_")[0];
|
|
199
|
-
const measuresArray = Array.isArray(msr) ? msr : [msr];
|
|
200
|
-
return measuresArray.find((m) => {
|
|
201
|
-
if (typeof m === "string") {
|
|
202
|
-
return m === measureName;
|
|
203
|
-
}
|
|
204
|
-
return m.field === measureName;
|
|
205
|
-
}) ?? measuresArray[0];
|
|
206
|
-
};
|
|
207
|
-
const chartSeries = react.useMemo(() => {
|
|
208
|
-
return {
|
|
209
|
-
series: chartData.columnNames().filter((c) => c !== groupByKey).map((c) => {
|
|
210
|
-
const measure = getMeasure(c, measures);
|
|
211
|
-
const showSymbol = typeof measure !== "string" ? !measure.hideSymbol : true;
|
|
212
|
-
const sampling = typeof measure !== "string" ? measure.sampling : void 0;
|
|
213
|
-
const yAxisId = typeof measure !== "string" ? measure.yAxis : void 0;
|
|
214
|
-
const isArea = typeof measure !== "string" ? measure.area ?? area : area;
|
|
215
|
-
const aOpacity = typeof measure !== "string" ? measure.areaOpacity ?? areaOpacity : areaOpacity;
|
|
216
|
-
const stackName = typeof measure !== "string" ? measure.stack ?? stack ?? void 0 : stack ?? void 0;
|
|
217
|
-
const connectNulls = typeof measure !== "string" && measure.emptyCellMode ? measure.emptyCellMode === "connect" : emptyCellMode === "connect";
|
|
218
|
-
return {
|
|
219
|
-
id: `series~${groupByKey}~${c}`,
|
|
220
|
-
name: seriesNameFormatter ? seriesNameFormatter(c) : c,
|
|
221
|
-
encode: {
|
|
222
|
-
x: groupByKey,
|
|
223
|
-
y: c
|
|
224
|
-
},
|
|
225
|
-
type: "line",
|
|
226
|
-
showSymbol,
|
|
227
|
-
sampling,
|
|
228
|
-
areaStyle: isArea ? {
|
|
229
|
-
opacity: aOpacity
|
|
230
|
-
} : void 0,
|
|
231
|
-
connectNulls,
|
|
232
|
-
stack: stackName,
|
|
233
|
-
yAxisId
|
|
234
|
-
};
|
|
235
|
-
})
|
|
236
|
-
};
|
|
237
|
-
}, [chartData, groupByKey, area, stack, seriesNameFormatter, emptyCellMode, areaOpacity, measures]);
|
|
238
|
-
const renderTooltip = (params, single, msr, cls, formatter) => {
|
|
239
|
-
const tooltipTitle = params[0].value[params[0].encode.x[0]];
|
|
240
|
-
if (single) {
|
|
241
|
-
const measure = getMeasure(params[0].dimensionNames[params[0].encode.y[0]], msr);
|
|
242
|
-
const value = params[0].value[params[0].encode.y[0]];
|
|
243
|
-
const formattedValue = typeof measure !== "string" && measure.valueFormatter ? measure.valueFormatter(value) : formatter ? formatter(value) : value;
|
|
244
|
-
return `
|
|
245
|
-
<div class="${cls == null ? void 0 : cls.singleTooltipRoot}">
|
|
246
|
-
<p class="${cls == null ? void 0 : cls.singleTooltipTitle}">${tooltipTitle}</p>
|
|
247
|
-
<p class="${cls == null ? void 0 : cls.singleTooltipValue}">${formattedValue}</p>
|
|
248
|
-
</div>
|
|
249
|
-
`;
|
|
250
|
-
}
|
|
251
|
-
return `
|
|
252
|
-
<div class="${cls == null ? void 0 : cls.multipleTooltipRoot}">
|
|
253
|
-
<div class="${cls == null ? void 0 : cls.multipleTooltipTitleContainer}">
|
|
254
|
-
<div>
|
|
255
|
-
<p class="${cls == null ? void 0 : cls.multipleTooltipTitle}">${tooltipTitle}</p>
|
|
256
|
-
</div>
|
|
257
|
-
</div>
|
|
258
|
-
<div class="${cls == null ? void 0 : cls.multipleTooltipValuesContainer}">
|
|
259
|
-
${params.map((s) => {
|
|
260
|
-
const measure = getMeasure(s.dimensionNames[s.encode.y[0]], msr);
|
|
261
|
-
const value = s.value[s.encode.y[0]];
|
|
262
|
-
const formattedValue = typeof measure !== "string" && measure.valueFormatter ? measure.valueFormatter(value) : formatter ? formatter(value) : value;
|
|
263
|
-
return `
|
|
264
|
-
<div key="${s.seriesName}" class="${cls == null ? void 0 : cls.multipleTooltipSeriesContainer}">
|
|
265
|
-
<div class="${cls == null ? void 0 : cls.multipleTooltipSeriesNameContainer}">
|
|
266
|
-
<p style="background-color: ${s.color};" class="${cls == null ? void 0 : cls.multipleTooltipSeriesColor}" />
|
|
267
|
-
<p class="${cls == null ? void 0 : cls.multipleTooltipSeriesName}">${s.seriesName}</p>
|
|
268
|
-
</div>
|
|
269
|
-
<p class="${cls == null ? void 0 : cls.multipleTooltipSeriesValue}">${formattedValue}</p>
|
|
270
|
-
</div>
|
|
271
|
-
`;
|
|
272
|
-
}).join(" ")}
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
`;
|
|
276
|
-
};
|
|
277
|
-
const chartTooltip = react.useMemo(() => {
|
|
278
|
-
return {
|
|
279
|
-
tooltip: {
|
|
280
|
-
confine: false,
|
|
281
|
-
show: (tooltip == null ? void 0 : tooltip.show) ?? true,
|
|
282
|
-
trigger: "axis",
|
|
283
|
-
position: (point, params, dom, rect, size) => {
|
|
284
|
-
return [point[0], point[1] - size.contentSize[1]];
|
|
285
|
-
},
|
|
286
|
-
formatter: (params) => renderTooltip(params, (tooltip == null ? void 0 : tooltip.type) === "single", measures, classes, tooltip == null ? void 0 : tooltip.valueFormatter)
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
}, [tooltip == null ? void 0 : tooltip.show, tooltip == null ? void 0 : tooltip.valueFormatter, tooltip == null ? void 0 : tooltip.type, classes, measures]);
|
|
290
|
-
const chartLegend = react.useMemo(() => {
|
|
291
|
-
return {
|
|
292
|
-
legend: {
|
|
293
|
-
show: (legend == null ? void 0 : legend.show) ?? (Array.isArray(chartSeries.series) && chartSeries.series.length > 1),
|
|
294
|
-
itemGap: 20,
|
|
295
|
-
data: (legend == null ? void 0 : legend.show) !== false && Array.isArray(chartSeries.series) ? chartSeries.series.map((s) => {
|
|
296
|
-
return {
|
|
297
|
-
name: s.name,
|
|
298
|
-
icon: getLegendIcon.getLegendIcon(s.areaStyle != null)
|
|
299
|
-
};
|
|
300
|
-
}) : void 0
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
}, [chartSeries, legend == null ? void 0 : legend.show]);
|
|
304
|
-
const chartHorizontalRangerSlider = react.useMemo(() => {
|
|
305
|
-
return {
|
|
306
|
-
dataZoom: [{
|
|
307
|
-
show: (horizontalRangeSlider == null ? void 0 : horizontalRangeSlider.show) ?? false,
|
|
308
|
-
type: "slider",
|
|
309
|
-
orient: "horizontal"
|
|
310
|
-
}, {
|
|
311
|
-
show: (horizontalRangeSlider == null ? void 0 : horizontalRangeSlider.show) ?? false,
|
|
312
|
-
type: "inside",
|
|
313
|
-
orient: "horizontal",
|
|
314
|
-
zoomOnMouseWheel: "shift",
|
|
315
|
-
moveOnMouseWheel: true
|
|
316
|
-
}]
|
|
317
|
-
};
|
|
318
|
-
}, [horizontalRangeSlider == null ? void 0 : horizontalRangeSlider.show]);
|
|
319
|
-
const chartGrid = react.useMemo(() => {
|
|
320
|
-
return {
|
|
321
|
-
// if no value is defined we shouldn't pass anything because echarts doesn't behave well otherwise
|
|
322
|
-
grid: {
|
|
323
|
-
...(grid == null ? void 0 : grid.top) != null && {
|
|
324
|
-
top: grid.top
|
|
325
|
-
},
|
|
326
|
-
...(grid == null ? void 0 : grid.bottom) != null && {
|
|
327
|
-
bottom: grid.bottom
|
|
328
|
-
},
|
|
329
|
-
...(grid == null ? void 0 : grid.left) != null && {
|
|
330
|
-
left: grid.left
|
|
331
|
-
},
|
|
332
|
-
...(grid == null ? void 0 : grid.right) != null && {
|
|
333
|
-
right: grid.right
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
}, [grid == null ? void 0 : grid.bottom, grid == null ? void 0 : grid.left, grid == null ? void 0 : grid.right, grid == null ? void 0 : grid.top]);
|
|
338
|
-
const [initialOption, setInitialOption] = react.useState({
|
|
339
|
-
aria: {
|
|
340
|
-
enabled: true
|
|
341
|
-
},
|
|
342
|
-
animation: false,
|
|
343
|
-
...chartDataset,
|
|
344
|
-
...chartXAxis,
|
|
345
|
-
...chartYAxis,
|
|
346
|
-
...chartSeries,
|
|
347
|
-
...chartTooltip,
|
|
348
|
-
...chartLegend,
|
|
349
|
-
...chartHorizontalRangerSlider,
|
|
350
|
-
...chartGrid
|
|
351
|
-
});
|
|
352
|
-
react.useEffect(() => {
|
|
353
|
-
var _a;
|
|
354
|
-
if (!isMounted.current) {
|
|
355
|
-
isMounted.current = true;
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
if (theme !== currentTheme.current) {
|
|
359
|
-
setInitialOption({
|
|
360
|
-
aria: {
|
|
361
|
-
enabled: true
|
|
362
|
-
},
|
|
363
|
-
animation: false,
|
|
364
|
-
...chartDataset,
|
|
365
|
-
...chartXAxis,
|
|
366
|
-
...chartYAxis,
|
|
367
|
-
...chartSeries,
|
|
368
|
-
...chartTooltip,
|
|
369
|
-
...chartLegend,
|
|
370
|
-
...chartHorizontalRangerSlider,
|
|
371
|
-
...chartGrid
|
|
372
|
-
});
|
|
373
|
-
currentTheme.current = theme;
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
(_a = chartRef.current) == null ? void 0 : _a.getEchartsInstance().setOption({
|
|
377
|
-
...chartDataset,
|
|
378
|
-
...chartXAxis,
|
|
379
|
-
...chartYAxis,
|
|
380
|
-
...chartSeries,
|
|
381
|
-
...chartLegend,
|
|
382
|
-
...chartTooltip,
|
|
383
|
-
...chartHorizontalRangerSlider,
|
|
384
|
-
...chartGrid
|
|
385
|
-
}, {
|
|
386
|
-
replaceMerge: ["xAxis", "yAxis", "series", "dataset"]
|
|
387
|
-
});
|
|
388
|
-
}, [theme, chartDataset, chartXAxis, chartYAxis, chartSeries, chartLegend, chartTooltip, chartHorizontalRangerSlider, chartGrid]);
|
|
389
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ReactECharts__default.default, {
|
|
390
|
-
ref: chartRef,
|
|
391
|
-
echarts: echarts__namespace,
|
|
392
|
-
option: initialOption,
|
|
393
|
-
theme,
|
|
394
|
-
notMerge: true
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BaseChart.HvBaseChart, {
|
|
12
|
+
type: "line",
|
|
13
|
+
area,
|
|
14
|
+
emptyCellMode,
|
|
15
|
+
areaOpacity,
|
|
16
|
+
...others
|
|
395
17
|
});
|
|
396
18
|
};
|
|
397
19
|
exports.HvLineChart = HvLineChart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.cjs","sources":["../../../../src/components/LineChart/LineChart.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from \"react\";\n\nimport {\n DatasetComponent,\n GridComponent,\n TooltipComponent,\n AriaComponent,\n LegendComponent,\n DataZoomSliderComponent,\n DataZoomInsideComponent,\n} from \"echarts/components\";\nimport { CanvasRenderer } from \"echarts/renderers\";\nimport * as echarts from \"echarts/core\";\nimport { LineChart } from \"echarts/charts\";\nimport type {\n EChartsOption,\n LineSeriesOption,\n YAXisComponentOption,\n} from \"echarts\";\n\nimport ReactECharts from \"echarts-for-react\";\n\nimport { from, internal, not, table, desc } from \"arquero\";\nimport type ColumnTable from \"arquero/dist/types/table/column-table\";\n\nimport { ExtractNames } from \"@hitachivantara/uikit-react-core\";\n\nimport {\n HvChartAggregation,\n HvChartOrder,\n HvChartAxis,\n HvChartEmptyCellMode,\n HvChartSampling,\n HvChartTooltipType,\n} from \"@viz/types\";\nimport { getAgFunc, getAxisType, getLegendIcon } from \"@viz/utils\";\nimport { useVizTheme } from \"@viz/hooks\";\nimport { useClasses } from \"./LineChart.styles\";\n\nexport type HvLineChartClasses = ExtractNames<typeof useClasses>;\n\n// Register chart components\necharts.use([\n LineChart,\n CanvasRenderer,\n DatasetComponent,\n GridComponent,\n AriaComponent,\n TooltipComponent,\n LegendComponent,\n DataZoomSliderComponent,\n DataZoomInsideComponent,\n]);\n\ntype GroupByField = string;\ntype SplitByField = string;\n\ntype FullMeasuresField = {\n /** Column name. */\n field: string;\n /** Sampling function to use. */\n sampling?: HvChartSampling;\n /** Id of the yAxis. */\n yAxis?: string;\n /** Whether to hide the symbol for data points. Defaults to `false`. */\n hideSymbol?: boolean;\n /** Aggregation function to use. If no `agg` is defined, it will default to `sum`. */\n agg?: HvChartAggregation;\n /** Whether the area under the lines should be filled. If not specified, it defaults to the global `area` prop. */\n area?: boolean;\n /** Sets opacity of the filled area if `area` is true. If not specified, it defaults to the global `areaOpacity` prop. */\n areaOpacity?: number;\n /**\n * Stack name to use when the measure should be stacked.\n *\n * Measures stacked together have the same name.\n *\n * If not specified, it defaults to the global `stacked` prop.\n */\n stack?: string;\n /** Strategy to use when there are empty cells. If not specified, it defaults to the global `emptyCellMode` prop. */\n emptyCellMode?: HvChartEmptyCellMode;\n /** Formatter for the value in the tooltip. If not specified, it defaults to the one defined in the global `tooltip` prop. */\n valueFormatter?: (value?: string | number) => string;\n};\n\ntype MeasuresField = string | FullMeasuresField;\n\ntype FullSortByField = {\n /** Column name. */\n field: string;\n /** Order function to use. If no `order` is defined, it will default to `asc`. */\n order?: HvChartOrder;\n};\ntype SortByField = string | FullSortByField;\n\nexport interface HvLineChartProps {\n /** Chart data. */\n data:\n | Map<string | number, (string | number)[]>\n | Record<string | number, (string | number)[]>\n | Record<string | number, string | number>[]\n | ColumnTable;\n /** Columns to use to group the data. */\n groupBy: GroupByField | GroupByField[];\n /** Columns to measure on the chart. */\n measures: MeasuresField | MeasuresField[];\n /** Columns to use to split the measures. */\n splitBy?: SplitByField | SplitByField[];\n /** Columns to use to sort the data points. */\n sortBy?: SortByField | SortByField[];\n /**\n * Options for the xAxis, i.e. the horizontal axis.\n *\n * The default `type` for this axis is `categorical`.\n * */\n xAxis?: HvChartAxis;\n /**\n * Options for the yAxis, i.e. the vertical axis.\n *\n * The default `type` for this axis is `continuous`.\n * */\n yAxis?: HvChartAxis | [HvChartAxis, HvChartAxis];\n /** Tooltip options. */\n tooltip?: {\n /** Whether to show the tooltip or not. Defaults to `true`. */\n show?: boolean;\n /** Formatter for the value in the tooltip. */\n valueFormatter?: (value?: string | number) => string;\n /** Tooltip type: single line or multiple lines modes. The single line mode should only be used when there's one series. Defaults to `multiple`. */\n type?: HvChartTooltipType;\n };\n /** Legend options. */\n legend?: {\n /** Whether to show the legend or not. The legend will appear by default for multiple series. Otherwise, the legend will not be shown. */\n show?: boolean;\n };\n /** Formatter for the series names used on the tooltips and legend. */\n seriesNameFormatter?: (value?: string) => string;\n /** Strategy to use when there are empty cells. Defaults to `void`. */\n emptyCellMode?: HvChartEmptyCellMode;\n /** Whether the area under the lines should be filled. Defaults to `false`. */\n area?: boolean;\n /** Sets opacity of the filled area if `area` is true. Defaults to `0.5`. */\n areaOpacity?: number;\n /** Stack name to use when all the series should be stacked together. If not provided, the series are not stacked. */\n stack?: string;\n /** Ranger slider options for the horizontal axis. */\n horizontalRangeSlider?: {\n /** Whether to show the ranger slider or not. Defaults to `false`. */\n show?: boolean;\n };\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: Partial<HvLineChartClasses>;\n /** Grid options. */\n grid?: {\n /** Distance between the grid and the top of the container. */\n top?: string | number;\n /** Distance between the grid and the right side of the container. */\n right?: string | number;\n /** Distance between the grid and the left side of the container. */\n left?: string | number;\n /** Distance between the grid and the bottom of the container. */\n bottom?: string | number;\n };\n}\n\n/**\n * A line chart or line plot or line graph is a type of chart which displays information as a series of data points\n * connected by straight line segments. It is a basic type of chart common in many fields.\n */\nexport const HvLineChart = ({\n data,\n groupBy,\n splitBy,\n measures,\n sortBy,\n xAxis,\n yAxis,\n legend,\n tooltip,\n seriesNameFormatter,\n area = false,\n stack,\n emptyCellMode = \"void\",\n horizontalRangeSlider,\n areaOpacity = 0.5,\n classes: classesProp = {},\n grid,\n}: HvLineChartProps) => {\n const { theme } = useVizTheme();\n const { classes } = useClasses(classesProp);\n\n const currentTheme = useRef<string | undefined>(theme);\n const chartRef = useRef<ReactECharts>(null);\n const isMounted = useRef<boolean>(false);\n\n const groupByKey = Array.isArray(groupBy) ? groupBy.join(\"_\") : groupBy;\n\n const chartData = useMemo<ColumnTable>(() => {\n let tableData: ColumnTable;\n if (data instanceof internal.ColumnTable) {\n tableData = data;\n } else if (Array.isArray(data)) {\n tableData = from(data);\n } else {\n tableData = table(data);\n }\n\n const groupByFields = groupBy\n ? Array.isArray(groupBy)\n ? groupBy\n : [groupBy]\n : [];\n\n const splitByFields = Array.isArray(splitBy)\n ? splitBy\n : splitBy != null\n ? [splitBy]\n : [];\n\n const measuresFields: { [key: string]: string } =\n measures == null\n ? {}\n : typeof measures === \"string\"\n ? { [measures]: getAgFunc(\"sum\", measures) }\n : Array.isArray(measures)\n ? measures.reduce<{ [key: string]: string }>((acc, value) => {\n let field: string;\n let agFunction: HvChartAggregation;\n if (typeof value === \"string\") {\n field = value;\n agFunction = \"sum\";\n } else {\n field = value.field;\n agFunction = value.agg ?? \"sum\";\n }\n\n return {\n ...acc,\n [field]: getAgFunc(agFunction, field),\n };\n }, {})\n : {\n [measures.field]: getAgFunc(measures.agg ?? \"sum\", measures.field),\n };\n\n const sortByFields: { [key: string]: HvChartOrder } =\n sortBy == null\n ? {}\n : typeof sortBy === \"string\"\n ? { [sortBy]: \"asc\" }\n : Array.isArray(sortBy)\n ? sortBy.reduce<{ [key: string]: HvChartOrder }>((acc, value) => {\n let field: string;\n let orderFunction: HvChartOrder;\n if (typeof value === \"string\") {\n field = value;\n orderFunction = \"asc\";\n } else {\n field = value.field;\n orderFunction = value.order ?? \"asc\";\n }\n\n return {\n ...acc,\n [field]: orderFunction,\n };\n }, {})\n : { [sortBy.field]: sortBy.order ?? \"asc\" };\n\n const allFields = [\n ...groupByFields,\n ...splitByFields,\n ...Object.keys(measuresFields),\n ];\n\n // remove unneeded fields\n tableData = tableData.select(...allFields);\n\n // group by groupBy fields\n if (groupByFields.length > 0) {\n tableData = tableData.groupby(groupByFields);\n }\n\n if (splitByFields.length > 0) {\n // pivot by splitBy fields\n tableData = tableData.pivot(splitByFields, measuresFields);\n } else {\n // if there is no splitBy fields, just aggregate measures fields\n tableData = tableData.rollup(measuresFields);\n }\n\n // if grouped by multiple fields, create a new joint field\n // as the line chart doesn't implement hierarchical axis label grouping\n if (groupByFields.length > 1) {\n const expression = `d => ${groupByFields\n .map((field) => `d.${field}`)\n .join(\" + '_' + \")}`;\n\n tableData = tableData.derive(\n { [groupByKey]: expression },\n { after: groupByFields[groupByFields.length - 1] }\n );\n }\n\n // sort by sortBy fields\n if (Object.keys(sortByFields).length > 0) {\n tableData = tableData.orderby(\n ...Object.keys(sortByFields)\n // only sort by fields that are in the table, ignore the rest\n .filter((key) => allFields.includes(key))\n .map((key) => (sortByFields[key] === \"desc\" ? desc(key) : key))\n );\n }\n\n // if a derived field was created, remove the original fields\n if (groupByFields.length > 1) {\n tableData = tableData.select(not(...groupByFields));\n }\n\n return tableData;\n }, [data, groupBy, groupByKey, splitBy, measures, sortBy]);\n\n const chartDataset = useMemo<Pick<EChartsOption, \"dataset\">>(() => {\n return {\n dataset: {\n source: chartData.columnNames().reduce(\n (acc, c) => ({\n ...acc,\n [c]: chartData.array(c),\n }),\n {}\n ),\n },\n };\n }, [chartData]);\n\n const chartXAxis = useMemo<Pick<EChartsOption, \"xAxis\">>(() => {\n return {\n xAxis: {\n type: getAxisType(xAxis?.type) ?? \"category\",\n name: xAxis?.name,\n scale: true,\n axisLabel: {\n rotate: xAxis?.labelRotation ?? 0,\n formatter: xAxis?.labelFormatter,\n },\n max: xAxis?.maxValue === \"max\" ? \"dataMax\" : xAxis?.maxValue,\n min: xAxis?.minValue === \"min\" ? \"dataMin\" : xAxis?.minValue,\n },\n };\n }, [\n xAxis?.labelFormatter,\n xAxis?.labelRotation,\n xAxis?.name,\n xAxis?.type,\n xAxis?.maxValue,\n xAxis?.minValue,\n ]);\n\n const chartYAxis = useMemo<Pick<EChartsOption, \"yAxis\">>(() => {\n if (!yAxis || !Array.isArray(yAxis)) {\n return {\n yAxis: {\n id: yAxis?.id,\n type: getAxisType(yAxis?.type) ?? \"value\",\n name: yAxis?.name,\n axisLabel: {\n rotate: yAxis?.labelRotation ?? 0,\n formatter: yAxis?.labelFormatter,\n },\n max: yAxis?.maxValue === \"max\" ? \"dataMax\" : yAxis?.maxValue,\n min: yAxis?.minValue === \"min\" ? \"dataMin\" : yAxis?.minValue,\n },\n };\n }\n\n return {\n yAxis: yAxis.map<YAXisComponentOption>((axis) => ({\n id: axis?.id,\n type: getAxisType(axis?.type) ?? \"value\",\n name: axis?.name,\n axisLabel: {\n rotate: axis?.labelRotation ?? 0,\n formatter: axis?.labelFormatter,\n },\n max: axis?.maxValue === \"max\" ? \"dataMax\" : axis?.maxValue,\n min: axis?.minValue === \"min\" ? \"dataMin\" : axis?.minValue,\n })),\n };\n }, [yAxis]);\n\n const getMeasure = (name: string, msr: MeasuresField | MeasuresField[]) => {\n const measureName = name.split(\"_\")[0];\n const measuresArray = Array.isArray(msr) ? msr : [msr];\n // find the measure in measures array or return the first one\n return (\n measuresArray.find((m) => {\n if (typeof m === \"string\") {\n return m === measureName;\n }\n return m.field === measureName;\n }) ?? measuresArray[0]\n );\n };\n\n const chartSeries = useMemo<Pick<EChartsOption, \"series\">>(() => {\n return {\n series: chartData\n .columnNames()\n .filter((c) => c !== groupByKey)\n .map<LineSeriesOption>((c) => {\n const measure = getMeasure(c, measures);\n\n const showSymbol =\n typeof measure !== \"string\" ? !measure.hideSymbol : true;\n const sampling =\n typeof measure !== \"string\" ? measure.sampling : undefined;\n const yAxisId =\n typeof measure !== \"string\" ? measure.yAxis : undefined;\n const isArea =\n typeof measure !== \"string\" ? measure.area ?? area : area;\n const aOpacity =\n typeof measure !== \"string\"\n ? measure.areaOpacity ?? areaOpacity\n : areaOpacity;\n const stackName =\n typeof measure !== \"string\"\n ? measure.stack ?? stack ?? undefined\n : stack ?? undefined;\n const connectNulls =\n typeof measure !== \"string\" && measure.emptyCellMode\n ? measure.emptyCellMode === \"connect\"\n : emptyCellMode === \"connect\";\n\n return {\n id: `series~${groupByKey}~${c}`,\n name: seriesNameFormatter ? seriesNameFormatter(c) : c,\n encode: { x: groupByKey, y: c },\n type: \"line\",\n showSymbol,\n sampling,\n areaStyle: isArea ? { opacity: aOpacity } : undefined,\n connectNulls,\n stack: stackName,\n yAxisId,\n };\n }),\n };\n }, [\n chartData,\n groupByKey,\n area,\n stack,\n seriesNameFormatter,\n emptyCellMode,\n areaOpacity,\n measures,\n ]);\n\n const renderTooltip = (\n params: {\n seriesName: string;\n value: (string | number)[];\n encode: { [key: string]: number[] };\n color: string;\n dimensionNames: string[];\n }[],\n single: boolean,\n msr: MeasuresField | MeasuresField[],\n cls?: typeof classes,\n formatter?: (value?: string | number) => string\n ) => {\n const tooltipTitle = params[0].value[params[0].encode.x[0]];\n\n if (single) {\n const measure = getMeasure(\n params[0].dimensionNames[params[0].encode.y[0]],\n msr\n );\n const value = params[0].value[params[0].encode.y[0]];\n const formattedValue =\n typeof measure !== \"string\" && measure.valueFormatter\n ? measure.valueFormatter(value)\n : formatter\n ? formatter(value)\n : value;\n\n return `\n <div class=\"${cls?.singleTooltipRoot}\">\n <p class=\"${cls?.singleTooltipTitle}\">${tooltipTitle}</p>\n <p class=\"${cls?.singleTooltipValue}\">${formattedValue}</p>\n </div>\n `;\n }\n\n return `\n <div class=\"${cls?.multipleTooltipRoot}\">\n <div class=\"${cls?.multipleTooltipTitleContainer}\">\n <div>\n <p class=\"${cls?.multipleTooltipTitle}\">${tooltipTitle}</p>\n </div>\n </div>\n <div class=\"${cls?.multipleTooltipValuesContainer}\">\n ${params\n .map((s) => {\n const measure = getMeasure(s.dimensionNames[s.encode.y[0]], msr);\n const value = s.value[s.encode.y[0]];\n const formattedValue =\n typeof measure !== \"string\" && measure.valueFormatter\n ? measure.valueFormatter(value)\n : formatter\n ? formatter(value)\n : value;\n\n return `\n <div key=\"${s.seriesName}\" class=\"${cls?.multipleTooltipSeriesContainer}\">\n <div class=\"${cls?.multipleTooltipSeriesNameContainer}\">\n <p style=\"background-color: ${s.color};\" class=\"${cls?.multipleTooltipSeriesColor}\" />\n <p class=\"${cls?.multipleTooltipSeriesName}\">${s.seriesName}</p>\n </div>\n <p class=\"${cls?.multipleTooltipSeriesValue}\">${formattedValue}</p>\n </div>\n `;\n })\n .join(\" \")}\n </div>\n </div>\n `;\n };\n\n const chartTooltip = useMemo<Pick<EChartsOption, \"tooltip\">>(() => {\n return {\n tooltip: {\n confine: false,\n show: tooltip?.show ?? true,\n trigger: \"axis\",\n position: (point, params, dom, rect, size) => {\n return [point[0], point[1] - size.contentSize[1]];\n },\n formatter: (params) =>\n renderTooltip(\n params,\n tooltip?.type === \"single\",\n measures,\n classes,\n tooltip?.valueFormatter\n ),\n },\n };\n }, [\n tooltip?.show,\n tooltip?.valueFormatter,\n tooltip?.type,\n classes,\n measures,\n ]);\n\n const chartLegend = useMemo<Pick<EChartsOption, \"legend\">>(() => {\n return {\n legend: {\n show:\n legend?.show ??\n (Array.isArray(chartSeries.series) && chartSeries.series.length > 1),\n itemGap: 20,\n data:\n legend?.show !== false && Array.isArray(chartSeries.series)\n ? chartSeries.series.map((s) => {\n return {\n name: s.name as string,\n icon: getLegendIcon((s as any).areaStyle != null),\n };\n })\n : undefined,\n },\n };\n }, [chartSeries, legend?.show]);\n\n const chartHorizontalRangerSlider = useMemo<\n Pick<EChartsOption, \"dataZoom\">\n >(() => {\n return {\n dataZoom: [\n {\n show: horizontalRangeSlider?.show ?? false,\n type: \"slider\",\n orient: \"horizontal\",\n },\n {\n show: horizontalRangeSlider?.show ?? false,\n type: \"inside\",\n orient: \"horizontal\",\n zoomOnMouseWheel: \"shift\",\n moveOnMouseWheel: true,\n },\n ],\n };\n }, [horizontalRangeSlider?.show]);\n\n const chartGrid = useMemo(() => {\n return {\n // if no value is defined we shouldn't pass anything because echarts doesn't behave well otherwise\n grid: {\n ...(grid?.top != null && {\n top: grid.top,\n }),\n ...(grid?.bottom != null && {\n bottom: grid.bottom,\n }),\n ...(grid?.left != null && {\n left: grid.left,\n }),\n ...(grid?.right != null && {\n right: grid.right,\n }),\n },\n };\n }, [grid?.bottom, grid?.left, grid?.right, grid?.top]);\n\n const [initialOption, setInitialOption] = useState<EChartsOption>({\n aria: {\n enabled: true,\n },\n animation: false,\n ...chartDataset,\n ...chartXAxis,\n ...chartYAxis,\n ...chartSeries,\n ...chartTooltip,\n ...chartLegend,\n ...chartHorizontalRangerSlider,\n ...chartGrid,\n });\n\n useEffect(() => {\n if (!isMounted.current) {\n isMounted.current = true;\n return;\n }\n\n // when the theme changes echarts destroys the chart and mounts it again\n // thus we need to reset the initial option\n if (theme !== currentTheme.current) {\n setInitialOption({\n aria: {\n enabled: true,\n },\n animation: false,\n ...chartDataset,\n ...chartXAxis,\n ...chartYAxis,\n ...chartSeries,\n ...chartTooltip,\n ...chartLegend,\n ...chartHorizontalRangerSlider,\n ...chartGrid,\n });\n currentTheme.current = theme;\n return;\n }\n\n chartRef.current?.getEchartsInstance().setOption(\n {\n ...chartDataset,\n ...chartXAxis,\n ...chartYAxis,\n ...chartSeries,\n ...chartLegend,\n ...chartTooltip,\n ...chartHorizontalRangerSlider,\n ...chartGrid,\n },\n {\n replaceMerge: [\"xAxis\", \"yAxis\", \"series\", \"dataset\"],\n }\n );\n }, [\n theme,\n chartDataset,\n chartXAxis,\n chartYAxis,\n chartSeries,\n chartLegend,\n chartTooltip,\n chartHorizontalRangerSlider,\n chartGrid,\n ]);\n\n return (\n <ReactECharts\n ref={chartRef}\n echarts={echarts}\n option={initialOption}\n theme={theme}\n notMerge\n />\n );\n};\n"],"names":["echarts","use","LineChart","CanvasRenderer","DatasetComponent","GridComponent","AriaComponent","TooltipComponent","LegendComponent","DataZoomSliderComponent","DataZoomInsideComponent","HvLineChart","data","groupBy","splitBy","measures","sortBy","xAxis","yAxis","legend","tooltip","seriesNameFormatter","area","stack","emptyCellMode","horizontalRangeSlider","areaOpacity","classes","classesProp","grid","theme","useVizTheme","useClasses","currentTheme","useRef","chartRef","isMounted","groupByKey","Array","isArray","join","chartData","useMemo","tableData","internal","ColumnTable","from","table","groupByFields","splitByFields","measuresFields","getAgFunc","reduce","acc","value","field","agFunction","agg","sortByFields","orderFunction","order","allFields","Object","keys","select","length","groupby","pivot","rollup","expression","map","derive","after","orderby","filter","key","includes","desc","not","chartDataset","dataset","source","columnNames","c","array","chartXAxis","type","getAxisType","name","scale","axisLabel","rotate","labelRotation","formatter","labelFormatter","max","maxValue","min","minValue","chartYAxis","id","axis","getMeasure","msr","measureName","split","measuresArray","find","m","chartSeries","series","measure","showSymbol","hideSymbol","sampling","undefined","yAxisId","isArea","aOpacity","stackName","connectNulls","encode","x","y","areaStyle","opacity","renderTooltip","params","single","cls","tooltipTitle","dimensionNames","formattedValue","valueFormatter","singleTooltipRoot","singleTooltipTitle","singleTooltipValue","multipleTooltipRoot","multipleTooltipTitleContainer","multipleTooltipTitle","multipleTooltipValuesContainer","s","seriesName","multipleTooltipSeriesContainer","multipleTooltipSeriesNameContainer","color","multipleTooltipSeriesColor","multipleTooltipSeriesName","multipleTooltipSeriesValue","chartTooltip","confine","show","trigger","position","point","dom","rect","size","contentSize","chartLegend","itemGap","icon","getLegendIcon","chartHorizontalRangerSlider","dataZoom","orient","zoomOnMouseWheel","moveOnMouseWheel","chartGrid","top","bottom","left","right","initialOption","setInitialOption","useState","aria","enabled","animation","useEffect","current","getEchartsInstance","setOption","replaceMerge","ReactECharts","ref","option","notMerge"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CAA,mBAAQC,IAAI,CACVC,kBACAC,UAAAA,gBACAC,WAAAA,kBACAC,WAAAA,eACAC,WAAAA,eACAC,WACAC,kBAAAA,WAAAA,iBACAC,oCACAC,WAAAA,uBAAuB,CACxB;AAuHM,MAAMC,cAAcA,CAAC;AAAA,EAC1BC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,OAAO;AAAA,EACPC;AAAAA,EACAC,gBAAgB;AAAA,EAChBC;AAAAA,EACAC,cAAc;AAAA,EACdC,SAASC,cAAc,CAAC;AAAA,EACxBC;AACgB,MAAM;AAChB,QAAA;AAAA,IAAEC;AAAAA,MAAUC,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IACH,GAAGM;AAAAA,IACH,GAAGc;AAAAA,IACH,GAAGU;AAAAA,IACH,GAAGwC;AAAAA,IACH,GAAGU;AAAAA,IACH,GAAGI;AAAAA,IACH,GAAGK;AAAAA,EAAAA,CACJ;AAEDW,QAAAA,UAAU,MAAM;;AACV,QAAA,CAAC/I,UAAUgJ,SAAS;AACtBhJ,gBAAUgJ,UAAU;AACpB;AAAA,IACF;AAIItJ,QAAAA,UAAUG,aAAamJ,SAAS;AACjB,uBAAA;AAAA,QACfJ,MAAM;AAAA,UACJC,SAAS;AAAA,QACX;AAAA,QACAC,WAAW;AAAA,QACX,GAAGnG;AAAAA,QACH,GAAGM;AAAAA,QACH,GAAGc;AAAAA,QACH,GAAGU;AAAAA,QACH,GAAGwC;AAAAA,QACH,GAAGU;AAAAA,QACH,GAAGI;AAAAA,QACH,GAAGK;AAAAA,MAAAA,CACJ;AACDvI,mBAAamJ,UAAUtJ;AACvB;AAAA,IACF;AAESsJ,mBAAAA,YAAAA,mBAASC,qBAAqBC,UACrC;AAAA,MACE,GAAGvG;AAAAA,MACH,GAAGM;AAAAA,MACH,GAAGc;AAAAA,MACH,GAAGU;AAAAA,MACH,GAAGkD;AAAAA,MACH,GAAGV;AAAAA,MACH,GAAGc;AAAAA,MACH,GAAGK;AAAAA,IAAAA,GAEL;AAAA,MACEe,cAAc,CAAC,SAAS,SAAS,UAAU,SAAS;AAAA,IAAA;AAAA,EAG1D,GAAG,CACDzJ,OACAiD,cACAM,YACAc,YACAU,aACAkD,aACAV,cACAc,6BACAK,SAAS,CACV;AAED,wCACGgB,sBAAAA,SAAY;AAAA,IACXC,KAAKtJ;AAAAA,IAAAA,SACLnC;AAAAA,IACA0L,QAAQb;AAAAA,IACR/I;AAAAA,IACA6J,UAAQ;AAAA,EAAA,CACT;AAEL;;"}
|
|
1
|
+
{"version":3,"file":"LineChart.cjs","sources":["../../../../src/components/LineChart/LineChart.tsx"],"sourcesContent":["import {\n HvBaseChart,\n HvBaseChartClasses,\n HvBaseChartCommonProps,\n HvBaseChartLineProps,\n} from \"../BaseChart\";\n\nexport interface HvLineChartClasses extends HvBaseChartClasses {}\n\nexport interface HvLineChartProps\n extends HvBaseChartCommonProps,\n HvBaseChartLineProps {\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvLineChartClasses;\n}\n\n/**\n * A line chart or line plot or line graph is a type of chart which displays information as a series of data points\n * connected by straight line segments. It is a basic type of chart common in many fields.\n */\nexport const HvLineChart = ({\n area = false,\n emptyCellMode = \"void\",\n areaOpacity = 0.5,\n ...others\n}: HvLineChartProps) => {\n return (\n <HvBaseChart\n type=\"line\"\n area={area}\n emptyCellMode={emptyCellMode}\n areaOpacity={areaOpacity}\n {...others}\n />\n );\n};\n"],"names":["HvLineChart","area","emptyCellMode","areaOpacity","others","HvBaseChart","type"],"mappings":";;;;AAoBO,MAAMA,cAAcA,CAAC;AAAA,EAC1BC,OAAO;AAAA,EACPC,gBAAgB;AAAA,EAChBC,cAAc;AAAA,EACd,GAAGC;AACa,MAAM;AACtB,wCACGC,UAAAA,aAAW;AAAA,IACVC,MAAK;AAAA,IACLL;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IAAyB,GACrBC;AAAAA,EAAAA,CACL;AAEL;;"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const LineChart = require("./components/LineChart/LineChart.cjs");
|
|
4
|
+
const BarChart = require("./components/BarChart/BarChart.cjs");
|
|
4
5
|
const Provider = require("./providers/Provider.cjs");
|
|
5
6
|
exports.HvLineChart = LineChart.HvLineChart;
|
|
7
|
+
exports.HvBarChart = BarChart.HvBarChart;
|
|
6
8
|
exports.HvVizContext = Provider.HvVizContext;
|
|
7
9
|
exports.HvVizProvider = Provider.HvVizProvider;
|
|
8
10
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const uikitReactCore = require("@hitachivantara/uikit-react-core");
|
|
4
|
-
const
|
|
4
|
+
const registerThemes = require("../utils/registerThemes.cjs");
|
|
5
5
|
const react = require("react");
|
|
6
6
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule)
|
|
9
|
-
return e;
|
|
10
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
-
if (e) {
|
|
12
|
-
for (const k in e) {
|
|
13
|
-
if (k !== "default") {
|
|
14
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: () => e[k]
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
n.default = e;
|
|
23
|
-
return Object.freeze(n);
|
|
24
|
-
}
|
|
25
|
-
const echarts__namespace = /* @__PURE__ */ _interopNamespace(echarts);
|
|
26
7
|
const HvVizContext = react.createContext({
|
|
27
8
|
theme: void 0
|
|
28
9
|
});
|
|
@@ -36,90 +17,8 @@ const HvVizProvider = ({
|
|
|
36
17
|
selectedTheme
|
|
37
18
|
} = uikitReactCore.useTheme();
|
|
38
19
|
const [theme, setTheme] = react.useState();
|
|
39
|
-
const registerThemes = (themeName, modes, themeStructure) => {
|
|
40
|
-
modes.forEach((mode) => {
|
|
41
|
-
const baseText = {
|
|
42
|
-
color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].secondary,
|
|
43
|
-
fontWeight: themeStructure == null ? void 0 : themeStructure.fontWeights.normal,
|
|
44
|
-
fontSize: themeStructure == null ? void 0 : themeStructure.fontSizes.sm,
|
|
45
|
-
fontFamily: themeStructure == null ? void 0 : themeStructure.fontFamily.body
|
|
46
|
-
};
|
|
47
|
-
const customAxis = {
|
|
48
|
-
nameTextStyle: {
|
|
49
|
-
...baseText
|
|
50
|
-
},
|
|
51
|
-
axisLine: {
|
|
52
|
-
show: true,
|
|
53
|
-
lineStyle: {
|
|
54
|
-
color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].atmo3
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
axisTick: {
|
|
58
|
-
show: true,
|
|
59
|
-
lineStyle: {
|
|
60
|
-
color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].atmo3
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
axisLabel: {
|
|
64
|
-
color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].secondary_80,
|
|
65
|
-
fontWeight: themeStructure == null ? void 0 : themeStructure.fontWeights.normal,
|
|
66
|
-
fontSize: themeStructure == null ? void 0 : themeStructure.fontSizes.sm,
|
|
67
|
-
fontFamily: themeStructure == null ? void 0 : themeStructure.fontFamily.body
|
|
68
|
-
},
|
|
69
|
-
splitLine: {
|
|
70
|
-
show: true,
|
|
71
|
-
lineStyle: {
|
|
72
|
-
color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].atmo3
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
echarts__namespace.registerTheme(`${themeName}-${mode}`, {
|
|
77
|
-
color: [themeStructure == null ? void 0 : themeStructure.colors.modes[mode].cat1, themeStructure == null ? void 0 : themeStructure.colors.modes[mode].cat2, themeStructure == null ? void 0 : themeStructure.colors.modes[mode].cat3, themeStructure == null ? void 0 : themeStructure.colors.modes[mode].cat4, themeStructure == null ? void 0 : themeStructure.colors.modes[mode].cat5, themeStructure == null ? void 0 : themeStructure.colors.modes[mode].cat6],
|
|
78
|
-
legend: {
|
|
79
|
-
textStyle: {
|
|
80
|
-
...baseText
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
tooltip: {
|
|
84
|
-
borderWidth: 0,
|
|
85
|
-
padding: 0,
|
|
86
|
-
textStyle: {
|
|
87
|
-
...baseText
|
|
88
|
-
},
|
|
89
|
-
axisPointer: {
|
|
90
|
-
lineStyle: {
|
|
91
|
-
color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].secondary,
|
|
92
|
-
width: 1
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
dataZoom: {
|
|
97
|
-
textStyle: {
|
|
98
|
-
...baseText
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
categoryAxis: {
|
|
102
|
-
...customAxis
|
|
103
|
-
},
|
|
104
|
-
valueAxis: {
|
|
105
|
-
...customAxis
|
|
106
|
-
},
|
|
107
|
-
logAxis: {
|
|
108
|
-
...customAxis
|
|
109
|
-
},
|
|
110
|
-
timeAxis: {
|
|
111
|
-
...customAxis
|
|
112
|
-
},
|
|
113
|
-
line: {
|
|
114
|
-
lineStyle: {
|
|
115
|
-
width: 2
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
20
|
react.useEffect(() => {
|
|
122
|
-
registerThemes(selectedTheme, colorModes, activeTheme);
|
|
21
|
+
registerThemes.registerThemes(selectedTheme, colorModes, activeTheme);
|
|
123
22
|
}, [selectedTheme, colorModes, activeTheme]);
|
|
124
23
|
react.useEffect(() => {
|
|
125
24
|
setTheme(`${selectedTheme}-${selectedMode}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.cjs","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Provider.cjs","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import { useTheme } from \"@hitachivantara/uikit-react-core\";\nimport { registerThemes } from \"@viz/utils\";\nimport { createContext, useEffect, useMemo, useState } from \"react\";\n\nexport interface HvVizContextValue {\n /**\n * Current theme\n */\n theme?: string;\n}\n\nexport const HvVizContext = createContext<HvVizContextValue>({\n theme: undefined,\n});\n\nexport interface HvVizProviderProps {\n /**\n * Component tree.\n */\n children?: React.ReactNode;\n}\n\n/**\n * Enables theming capabilities for visualizations.\n *\n * Without this provider the visualizations will not comply to the UI Kit themes.\n *\n * This provider should always be used in combination with the `HvProvider` from\n * the core package since the former uses the themes provided by the latter.\n *\n * `HvVizProvider` should always be used after `HvProvider` like so to work properly:\n *\n * ```\n * <HvProvider>\n * <HvVizProvider>\n * (...)\n * </HvVizProvider>\n * </HvProvider>\n * ```\n */\nexport const HvVizProvider = ({ children }: HvVizProviderProps) => {\n const { activeTheme, colorModes, selectedMode, selectedTheme } = useTheme();\n\n const [theme, setTheme] = useState<string | undefined>();\n\n useEffect(() => {\n registerThemes(selectedTheme, colorModes, activeTheme);\n }, [selectedTheme, colorModes, activeTheme]);\n\n useEffect(() => {\n setTheme(`${selectedTheme}-${selectedMode}`);\n }, [selectedMode, selectedTheme]);\n\n const value = useMemo<HvVizContextValue>(\n () => ({\n theme,\n }),\n [theme]\n );\n\n return (\n <HvVizContext.Provider value={value}>{children}</HvVizContext.Provider>\n );\n};\n"],"names":["HvVizContext","createContext","theme","undefined","HvVizProvider","children","activeTheme","colorModes","selectedMode","selectedTheme","useTheme","setTheme","useState","useEffect","value","useMemo","_jsx","Provider"],"mappings":";;;;;;AAWO,MAAMA,eAAeC,MAAAA,cAAiC;AAAA,EAC3DC,OAAOC;AACT,CAAC;AA2BM,MAAMC,gBAAgBA,CAAC;AAAA,EAAEC;AAA6B,MAAM;AAC3D,QAAA;AAAA,IAAEC;AAAAA,IAAaC;AAAAA,IAAYC;AAAAA,IAAcC;AAAAA,MAAkBC,eAAS,SAAA;AAE1E,QAAM,CAACR,OAAOS,QAAQ,IAAIC,MAA6B,SAAA;AAEvDC,QAAAA,UAAU,MAAM;AACCJ,mBAAAA,eAAAA,eAAeF,YAAYD,WAAW;AAAA,EACpD,GAAA,CAACG,eAAeF,YAAYD,WAAW,CAAC;AAE3CO,QAAAA,UAAU,MAAM;AACJ,aAAA,GAAEJ,iBAAiBD,cAAc;AAAA,EAAA,GAC1C,CAACA,cAAcC,aAAa,CAAC;AAE1BK,QAAAA,QAAQC,MAAAA,QACZ,OAAO;AAAA,IACLb;AAAAA,EAAAA,IAEF,CAACA,KAAK,CACR;AAGEc,SAAAA,2BAAAA,IAAChB,aAAaiB,UAAQ;AAAA,IAACH;AAAAA,IAAaT;AAAAA,EAAAA,CAAkC;AAE1E;;;"}
|