@hitachivantara/uikit-react-viz 5.1.1 → 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.
Files changed (30) hide show
  1. package/dist/cjs/components/BarChart/BarChart.cjs +16 -0
  2. package/dist/cjs/components/BarChart/BarChart.cjs.map +1 -0
  3. package/dist/cjs/components/BaseChart/BaseChart.cjs +423 -0
  4. package/dist/cjs/components/BaseChart/BaseChart.cjs.map +1 -0
  5. package/dist/cjs/components/{LineChart/LineChart.styles.cjs → BaseChart/BaseChart.styles.cjs} +2 -2
  6. package/dist/cjs/components/{LineChart/LineChart.styles.cjs.map → BaseChart/BaseChart.styles.cjs.map} +1 -1
  7. package/dist/cjs/components/LineChart/LineChart.cjs +8 -386
  8. package/dist/cjs/components/LineChart/LineChart.cjs.map +1 -1
  9. package/dist/cjs/index.cjs +2 -0
  10. package/dist/cjs/index.cjs.map +1 -1
  11. package/dist/cjs/providers/Provider.cjs +2 -103
  12. package/dist/cjs/providers/Provider.cjs.map +1 -1
  13. package/dist/cjs/utils/registerThemes.cjs +106 -0
  14. package/dist/cjs/utils/registerThemes.cjs.map +1 -0
  15. package/dist/esm/components/BarChart/BarChart.js +16 -0
  16. package/dist/esm/components/BarChart/BarChart.js.map +1 -0
  17. package/dist/esm/components/BaseChart/BaseChart.js +402 -0
  18. package/dist/esm/components/BaseChart/BaseChart.js.map +1 -0
  19. package/dist/esm/components/{LineChart/LineChart.styles.js → BaseChart/BaseChart.styles.js} +2 -2
  20. package/dist/esm/components/{LineChart/LineChart.styles.js.map → BaseChart/BaseChart.styles.js.map} +1 -1
  21. package/dist/esm/components/LineChart/LineChart.js +8 -365
  22. package/dist/esm/components/LineChart/LineChart.js.map +1 -1
  23. package/dist/esm/index.js +2 -0
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/providers/Provider.js +1 -83
  26. package/dist/esm/providers/Provider.js.map +1 -1
  27. package/dist/esm/utils/registerThemes.js +87 -0
  28. package/dist/esm/utils/registerThemes.js.map +1 -0
  29. package/dist/types/index.d.ts +126 -79
  30. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.styles.js","sources":["../../../../src/components/LineChart/LineChart.styles.tsx"],"sourcesContent":["import { theme, createClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport const { useClasses, staticClasses } = createClasses(\"HvLineChart\", {\n /** Single tooltip styles */\n singleTooltipRoot: {\n width: \"fit-content\",\n boxShadow: theme.colors.shadow,\n backgroundColor: theme.colors.atmo1,\n padding: theme.space.sm,\n display: \"flex\",\n },\n singleTooltipTitle: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.semibold,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n singleTooltipValue: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.normal,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n marginLeft: theme.space.xs,\n },\n /** Multiple tooltip styles */\n multipleTooltipRoot: {\n width: \"fit-content\",\n boxShadow: theme.colors.shadow,\n backgroundColor: theme.colors.atmo1,\n },\n multipleTooltipTitleContainer: {\n padding: `15px ${theme.space.sm}`,\n borderBottom: `3px solid ${theme.colors.atmo2}`,\n },\n multipleTooltipTitle: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.semibold,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n multipleTooltipValuesContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n padding: theme.space.sm,\n\n \"& > *:not(:last-child)\": { paddingBottom: theme.space.sm },\n },\n multipleTooltipSeriesContainer: {\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n },\n multipleTooltipSeriesNameContainer: {\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n marginRight: theme.space.sm,\n },\n multipleTooltipSeriesColor: {\n width: \"10px\",\n height: \"10px\",\n marginRight: \"5px\",\n },\n multipleTooltipSeriesName: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.semibold,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n multipleTooltipSeriesValue: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.normal,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n});\n"],"names":["useClasses","staticClasses","createClasses","singleTooltipRoot","width","boxShadow","theme","colors","shadow","backgroundColor","atmo1","padding","space","sm","display","singleTooltipTitle","fontFamily","body","fontWeight","fontWeights","semibold","fontSize","fontSizes","color","secondary","singleTooltipValue","normal","marginLeft","xs","multipleTooltipRoot","multipleTooltipTitleContainer","borderBottom","atmo2","multipleTooltipTitle","multipleTooltipValuesContainer","flexDirection","paddingBottom","multipleTooltipSeriesContainer","justifyContent","alignItems","multipleTooltipSeriesNameContainer","marginRight","multipleTooltipSeriesColor","height","multipleTooltipSeriesName","multipleTooltipSeriesValue"],"mappings":";AAEa,MAAA;AAAA,EAAEA;AAAAA,EAAYC;AAAc,IAAIC,cAAc,eAAe;AAAA;AAAA,EAExEC,mBAAmB;AAAA,IACjBC,OAAO;AAAA,IACPC,WAAWC,MAAMC,OAAOC;AAAAA,IACxBC,iBAAiBH,MAAMC,OAAOG;AAAAA,IAC9BC,SAASL,MAAMM,MAAMC;AAAAA,IACrBC,SAAS;AAAA,EACX;AAAA,EACAC,oBAAoB;AAAA,IAClBC,YAAYV,MAAMU,WAAWC;AAAAA,IAC7BC,YAAYZ,MAAMa,YAAYC;AAAAA,IAC9BC,UAAUf,MAAMgB,UAAUT;AAAAA,IAC1BU,OAAOjB,MAAMC,OAAOiB;AAAAA,EACtB;AAAA,EACAC,oBAAoB;AAAA,IAClBT,YAAYV,MAAMU,WAAWC;AAAAA,IAC7BC,YAAYZ,MAAMa,YAAYO;AAAAA,IAC9BL,UAAUf,MAAMgB,UAAUT;AAAAA,IAC1BU,OAAOjB,MAAMC,OAAOiB;AAAAA,IACpB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AAMU,WAAWC;AAAAA,IAC7BC,YAAYZ,MAAMa,YAAYO;AAAAA,IAC9BL,UAAUf,MAAMgB,UAAUT;AAAAA,IAC1BU,OAAOjB,MAAMC,OAAOiB;AAAAA,EACtB;AACF,CAAC;"}
1
+ {"version":3,"file":"BaseChart.styles.js","sources":["../../../../src/components/BaseChart/BaseChart.styles.tsx"],"sourcesContent":["import { theme, createClasses } from \"@hitachivantara/uikit-react-core\";\n\nexport const { useClasses, staticClasses } = createClasses(\"HvBaseChart\", {\n /** Single tooltip styles */\n singleTooltipRoot: {\n width: \"fit-content\",\n boxShadow: theme.colors.shadow,\n backgroundColor: theme.colors.atmo1,\n padding: theme.space.sm,\n display: \"flex\",\n },\n singleTooltipTitle: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.semibold,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n singleTooltipValue: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.normal,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n marginLeft: theme.space.xs,\n },\n /** Multiple tooltip styles */\n multipleTooltipRoot: {\n width: \"fit-content\",\n boxShadow: theme.colors.shadow,\n backgroundColor: theme.colors.atmo1,\n },\n multipleTooltipTitleContainer: {\n padding: `15px ${theme.space.sm}`,\n borderBottom: `3px solid ${theme.colors.atmo2}`,\n },\n multipleTooltipTitle: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.semibold,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n multipleTooltipValuesContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n padding: theme.space.sm,\n\n \"& > *:not(:last-child)\": { paddingBottom: theme.space.sm },\n },\n multipleTooltipSeriesContainer: {\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n },\n multipleTooltipSeriesNameContainer: {\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n marginRight: theme.space.sm,\n },\n multipleTooltipSeriesColor: {\n width: \"10px\",\n height: \"10px\",\n marginRight: \"5px\",\n },\n multipleTooltipSeriesName: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.semibold,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n multipleTooltipSeriesValue: {\n fontFamily: theme.fontFamily.body,\n fontWeight: theme.fontWeights.normal,\n fontSize: theme.fontSizes.sm,\n color: theme.colors.secondary,\n },\n});\n"],"names":["useClasses","staticClasses","createClasses","singleTooltipRoot","width","boxShadow","theme","colors","shadow","backgroundColor","atmo1","padding","space","sm","display","singleTooltipTitle","fontFamily","body","fontWeight","fontWeights","semibold","fontSize","fontSizes","color","secondary","singleTooltipValue","normal","marginLeft","xs","multipleTooltipRoot","multipleTooltipTitleContainer","borderBottom","atmo2","multipleTooltipTitle","multipleTooltipValuesContainer","flexDirection","paddingBottom","multipleTooltipSeriesContainer","justifyContent","alignItems","multipleTooltipSeriesNameContainer","marginRight","multipleTooltipSeriesColor","height","multipleTooltipSeriesName","multipleTooltipSeriesValue"],"mappings":";AAEa,MAAA;AAAA,EAAEA;AAAAA,EAAYC;AAAc,IAAIC,cAAc,eAAe;AAAA;AAAA,EAExEC,mBAAmB;AAAA,IACjBC,OAAO;AAAA,IACPC,WAAWC,MAAMC,OAAOC;AAAAA,IACxBC,iBAAiBH,MAAMC,OAAOG;AAAAA,IAC9BC,SAASL,MAAMM,MAAMC;AAAAA,IACrBC,SAAS;AAAA,EACX;AAAA,EACAC,oBAAoB;AAAA,IAClBC,YAAYV,MAAMU,WAAWC;AAAAA,IAC7BC,YAAYZ,MAAMa,YAAYC;AAAAA,IAC9BC,UAAUf,MAAMgB,UAAUT;AAAAA,IAC1BU,OAAOjB,MAAMC,OAAOiB;AAAAA,EACtB;AAAA,EACAC,oBAAoB;AAAA,IAClBT,YAAYV,MAAMU,WAAWC;AAAAA,IAC7BC,YAAYZ,MAAMa,YAAYO;AAAAA,IAC9BL,UAA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MC,OAAOiB;AAAAA,EACtB;AAAA,EACAqB,4BAA4B;AAAA,IAC1B7B,YAAYV,MAAMU,WAAWC;AAAAA,IAC7BC,YAAYZ,MAAMa,YAAYO;AAAAA,IAC9BL,UAAUf,MAAMgB,UAAUT;AAAAA,IAC1BU,OAAOjB,MAAMC,OAAOiB;AAAAA,EACtB;AACF,CAAC;"}
@@ -1,374 +1,17 @@
1
- import { useRef, useMemo, useState, useEffect } from "react";
2
- import { DatasetComponent, GridComponent, AriaComponent, TooltipComponent, LegendComponent, DataZoomSliderComponent, DataZoomInsideComponent } from "echarts/components";
3
- import { CanvasRenderer } from "echarts/renderers";
4
- import * as echarts from "echarts/core";
5
- import { LineChart } from "echarts/charts";
6
- import ReactECharts from "echarts-for-react";
7
- import { internal, from, table, desc, not } from "arquero";
8
- import { getAxisType } from "../../utils/getAxisType.js";
9
- import { getAgFunc } from "../../utils/getAgFunc.js";
10
- import { getLegendIcon } from "../../utils/getLegendIcon.js";
11
- import { useVizTheme } from "../../hooks/useVizTheme.js";
12
- import { useClasses } from "./LineChart.styles.js";
13
1
  import { jsx } from "@emotion/react/jsx-runtime";
14
- echarts.use([LineChart, CanvasRenderer, DatasetComponent, GridComponent, AriaComponent, TooltipComponent, LegendComponent, DataZoomSliderComponent, DataZoomInsideComponent]);
2
+ import { HvBaseChart } from "../BaseChart/BaseChart.js";
15
3
  const HvLineChart = ({
16
- data,
17
- groupBy,
18
- splitBy,
19
- measures,
20
- sortBy,
21
- xAxis,
22
- yAxis,
23
- legend,
24
- tooltip,
25
- seriesNameFormatter,
26
4
  area = false,
27
- stack,
28
5
  emptyCellMode = "void",
29
- horizontalRangeSlider,
30
6
  areaOpacity = 0.5,
31
- classes: classesProp = {},
32
- grid
7
+ ...others
33
8
  }) => {
34
- const {
35
- theme
36
- } = useVizTheme();
37
- const {
38
- classes
39
- } = useClasses(classesProp);
40
- const currentTheme = useRef(theme);
41
- const chartRef = useRef(null);
42
- const isMounted = useRef(false);
43
- const groupByKey = Array.isArray(groupBy) ? groupBy.join("_") : groupBy;
44
- const chartData = useMemo(() => {
45
- let tableData;
46
- if (data instanceof internal.ColumnTable) {
47
- tableData = data;
48
- } else if (Array.isArray(data)) {
49
- tableData = from(data);
50
- } else {
51
- tableData = table(data);
52
- }
53
- const groupByFields = groupBy ? Array.isArray(groupBy) ? groupBy : [groupBy] : [];
54
- const splitByFields = Array.isArray(splitBy) ? splitBy : splitBy != null ? [splitBy] : [];
55
- const measuresFields = measures == null ? {} : typeof measures === "string" ? {
56
- [measures]: getAgFunc("sum", measures)
57
- } : Array.isArray(measures) ? measures.reduce((acc, value) => {
58
- let field;
59
- let agFunction;
60
- if (typeof value === "string") {
61
- field = value;
62
- agFunction = "sum";
63
- } else {
64
- field = value.field;
65
- agFunction = value.agg ?? "sum";
66
- }
67
- return {
68
- ...acc,
69
- [field]: getAgFunc(agFunction, field)
70
- };
71
- }, {}) : {
72
- [measures.field]: getAgFunc(measures.agg ?? "sum", measures.field)
73
- };
74
- const sortByFields = sortBy == null ? {} : typeof sortBy === "string" ? {
75
- [sortBy]: "asc"
76
- } : Array.isArray(sortBy) ? sortBy.reduce((acc, value) => {
77
- let field;
78
- let orderFunction;
79
- if (typeof value === "string") {
80
- field = value;
81
- orderFunction = "asc";
82
- } else {
83
- field = value.field;
84
- orderFunction = value.order ?? "asc";
85
- }
86
- return {
87
- ...acc,
88
- [field]: orderFunction
89
- };
90
- }, {}) : {
91
- [sortBy.field]: sortBy.order ?? "asc"
92
- };
93
- const allFields = [...groupByFields, ...splitByFields, ...Object.keys(measuresFields)];
94
- tableData = tableData.select(...allFields);
95
- if (groupByFields.length > 0) {
96
- tableData = tableData.groupby(groupByFields);
97
- }
98
- if (splitByFields.length > 0) {
99
- tableData = tableData.pivot(splitByFields, measuresFields);
100
- } else {
101
- tableData = tableData.rollup(measuresFields);
102
- }
103
- if (groupByFields.length > 1) {
104
- const expression = `d => ${groupByFields.map((field) => `d.${field}`).join(" + '_' + ")}`;
105
- tableData = tableData.derive({
106
- [groupByKey]: expression
107
- }, {
108
- after: groupByFields[groupByFields.length - 1]
109
- });
110
- }
111
- if (Object.keys(sortByFields).length > 0) {
112
- tableData = tableData.orderby(...Object.keys(sortByFields).filter((key) => allFields.includes(key)).map((key) => sortByFields[key] === "desc" ? desc(key) : key));
113
- }
114
- if (groupByFields.length > 1) {
115
- tableData = tableData.select(not(...groupByFields));
116
- }
117
- return tableData;
118
- }, [data, groupBy, groupByKey, splitBy, measures, sortBy]);
119
- const chartDataset = useMemo(() => {
120
- return {
121
- dataset: {
122
- source: chartData.columnNames().reduce((acc, c) => ({
123
- ...acc,
124
- [c]: chartData.array(c)
125
- }), {})
126
- }
127
- };
128
- }, [chartData]);
129
- const chartXAxis = useMemo(() => {
130
- return {
131
- xAxis: {
132
- type: getAxisType(xAxis == null ? void 0 : xAxis.type) ?? "category",
133
- name: xAxis == null ? void 0 : xAxis.name,
134
- scale: true,
135
- axisLabel: {
136
- rotate: (xAxis == null ? void 0 : xAxis.labelRotation) ?? 0,
137
- formatter: xAxis == null ? void 0 : xAxis.labelFormatter
138
- },
139
- max: (xAxis == null ? void 0 : xAxis.maxValue) === "max" ? "dataMax" : xAxis == null ? void 0 : xAxis.maxValue,
140
- min: (xAxis == null ? void 0 : xAxis.minValue) === "min" ? "dataMin" : xAxis == null ? void 0 : xAxis.minValue
141
- }
142
- };
143
- }, [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]);
144
- const chartYAxis = useMemo(() => {
145
- if (!yAxis || !Array.isArray(yAxis)) {
146
- return {
147
- yAxis: {
148
- id: yAxis == null ? void 0 : yAxis.id,
149
- type: getAxisType(yAxis == null ? void 0 : yAxis.type) ?? "value",
150
- name: yAxis == null ? void 0 : yAxis.name,
151
- axisLabel: {
152
- rotate: (yAxis == null ? void 0 : yAxis.labelRotation) ?? 0,
153
- formatter: yAxis == null ? void 0 : yAxis.labelFormatter
154
- },
155
- max: (yAxis == null ? void 0 : yAxis.maxValue) === "max" ? "dataMax" : yAxis == null ? void 0 : yAxis.maxValue,
156
- min: (yAxis == null ? void 0 : yAxis.minValue) === "min" ? "dataMin" : yAxis == null ? void 0 : yAxis.minValue
157
- }
158
- };
159
- }
160
- return {
161
- yAxis: yAxis.map((axis) => ({
162
- id: axis == null ? void 0 : axis.id,
163
- type: getAxisType(axis == null ? void 0 : axis.type) ?? "value",
164
- name: axis == null ? void 0 : axis.name,
165
- axisLabel: {
166
- rotate: (axis == null ? void 0 : axis.labelRotation) ?? 0,
167
- formatter: axis == null ? void 0 : axis.labelFormatter
168
- },
169
- max: (axis == null ? void 0 : axis.maxValue) === "max" ? "dataMax" : axis == null ? void 0 : axis.maxValue,
170
- min: (axis == null ? void 0 : axis.minValue) === "min" ? "dataMin" : axis == null ? void 0 : axis.minValue
171
- }))
172
- };
173
- }, [yAxis]);
174
- const getMeasure = (name, msr) => {
175
- const measureName = name.split("_")[0];
176
- const measuresArray = Array.isArray(msr) ? msr : [msr];
177
- return measuresArray.find((m) => {
178
- if (typeof m === "string") {
179
- return m === measureName;
180
- }
181
- return m.field === measureName;
182
- }) ?? measuresArray[0];
183
- };
184
- const chartSeries = useMemo(() => {
185
- return {
186
- series: chartData.columnNames().filter((c) => c !== groupByKey).map((c) => {
187
- const measure = getMeasure(c, measures);
188
- const showSymbol = typeof measure !== "string" ? !measure.hideSymbol : true;
189
- const sampling = typeof measure !== "string" ? measure.sampling : void 0;
190
- const yAxisId = typeof measure !== "string" ? measure.yAxis : void 0;
191
- const isArea = typeof measure !== "string" ? measure.area ?? area : area;
192
- const aOpacity = typeof measure !== "string" ? measure.areaOpacity ?? areaOpacity : areaOpacity;
193
- const stackName = typeof measure !== "string" ? measure.stack ?? stack ?? void 0 : stack ?? void 0;
194
- const connectNulls = typeof measure !== "string" && measure.emptyCellMode ? measure.emptyCellMode === "connect" : emptyCellMode === "connect";
195
- return {
196
- id: `series~${groupByKey}~${c}`,
197
- name: seriesNameFormatter ? seriesNameFormatter(c) : c,
198
- encode: {
199
- x: groupByKey,
200
- y: c
201
- },
202
- type: "line",
203
- showSymbol,
204
- sampling,
205
- areaStyle: isArea ? {
206
- opacity: aOpacity
207
- } : void 0,
208
- connectNulls,
209
- stack: stackName,
210
- yAxisId
211
- };
212
- })
213
- };
214
- }, [chartData, groupByKey, area, stack, seriesNameFormatter, emptyCellMode, areaOpacity, measures]);
215
- const renderTooltip = (params, single, msr, cls, formatter) => {
216
- const tooltipTitle = params[0].value[params[0].encode.x[0]];
217
- if (single) {
218
- const measure = getMeasure(params[0].dimensionNames[params[0].encode.y[0]], msr);
219
- const value = params[0].value[params[0].encode.y[0]];
220
- const formattedValue = typeof measure !== "string" && measure.valueFormatter ? measure.valueFormatter(value) : formatter ? formatter(value) : value;
221
- return `
222
- <div class="${cls == null ? void 0 : cls.singleTooltipRoot}">
223
- <p class="${cls == null ? void 0 : cls.singleTooltipTitle}">${tooltipTitle}</p>
224
- <p class="${cls == null ? void 0 : cls.singleTooltipValue}">${formattedValue}</p>
225
- </div>
226
- `;
227
- }
228
- return `
229
- <div class="${cls == null ? void 0 : cls.multipleTooltipRoot}">
230
- <div class="${cls == null ? void 0 : cls.multipleTooltipTitleContainer}">
231
- <div>
232
- <p class="${cls == null ? void 0 : cls.multipleTooltipTitle}">${tooltipTitle}</p>
233
- </div>
234
- </div>
235
- <div class="${cls == null ? void 0 : cls.multipleTooltipValuesContainer}">
236
- ${params.map((s) => {
237
- const measure = getMeasure(s.dimensionNames[s.encode.y[0]], msr);
238
- const value = s.value[s.encode.y[0]];
239
- const formattedValue = typeof measure !== "string" && measure.valueFormatter ? measure.valueFormatter(value) : formatter ? formatter(value) : value;
240
- return `
241
- <div key="${s.seriesName}" class="${cls == null ? void 0 : cls.multipleTooltipSeriesContainer}">
242
- <div class="${cls == null ? void 0 : cls.multipleTooltipSeriesNameContainer}">
243
- <p style="background-color: ${s.color};" class="${cls == null ? void 0 : cls.multipleTooltipSeriesColor}" />
244
- <p class="${cls == null ? void 0 : cls.multipleTooltipSeriesName}">${s.seriesName}</p>
245
- </div>
246
- <p class="${cls == null ? void 0 : cls.multipleTooltipSeriesValue}">${formattedValue}</p>
247
- </div>
248
- `;
249
- }).join(" ")}
250
- </div>
251
- </div>
252
- `;
253
- };
254
- const chartTooltip = useMemo(() => {
255
- return {
256
- tooltip: {
257
- confine: false,
258
- show: (tooltip == null ? void 0 : tooltip.show) ?? true,
259
- trigger: "axis",
260
- position: (point, params, dom, rect, size) => {
261
- return [point[0], point[1] - size.contentSize[1]];
262
- },
263
- formatter: (params) => renderTooltip(params, (tooltip == null ? void 0 : tooltip.type) === "single", measures, classes, tooltip == null ? void 0 : tooltip.valueFormatter)
264
- }
265
- };
266
- }, [tooltip == null ? void 0 : tooltip.show, tooltip == null ? void 0 : tooltip.valueFormatter, tooltip == null ? void 0 : tooltip.type, classes, measures]);
267
- const chartLegend = useMemo(() => {
268
- return {
269
- legend: {
270
- show: (legend == null ? void 0 : legend.show) ?? (Array.isArray(chartSeries.series) && chartSeries.series.length > 1),
271
- itemGap: 20,
272
- data: (legend == null ? void 0 : legend.show) !== false && Array.isArray(chartSeries.series) ? chartSeries.series.map((s) => {
273
- return {
274
- name: s.name,
275
- icon: getLegendIcon(s.areaStyle != null)
276
- };
277
- }) : void 0
278
- }
279
- };
280
- }, [chartSeries, legend == null ? void 0 : legend.show]);
281
- const chartHorizontalRangerSlider = useMemo(() => {
282
- return {
283
- dataZoom: [{
284
- show: (horizontalRangeSlider == null ? void 0 : horizontalRangeSlider.show) ?? false,
285
- type: "slider",
286
- orient: "horizontal"
287
- }, {
288
- show: (horizontalRangeSlider == null ? void 0 : horizontalRangeSlider.show) ?? false,
289
- type: "inside",
290
- orient: "horizontal",
291
- zoomOnMouseWheel: "shift",
292
- moveOnMouseWheel: true
293
- }]
294
- };
295
- }, [horizontalRangeSlider == null ? void 0 : horizontalRangeSlider.show]);
296
- const chartGrid = useMemo(() => {
297
- return {
298
- // if no value is defined we shouldn't pass anything because echarts doesn't behave well otherwise
299
- grid: {
300
- ...(grid == null ? void 0 : grid.top) != null && {
301
- top: grid.top
302
- },
303
- ...(grid == null ? void 0 : grid.bottom) != null && {
304
- bottom: grid.bottom
305
- },
306
- ...(grid == null ? void 0 : grid.left) != null && {
307
- left: grid.left
308
- },
309
- ...(grid == null ? void 0 : grid.right) != null && {
310
- right: grid.right
311
- }
312
- }
313
- };
314
- }, [grid == null ? void 0 : grid.bottom, grid == null ? void 0 : grid.left, grid == null ? void 0 : grid.right, grid == null ? void 0 : grid.top]);
315
- const [initialOption, setInitialOption] = useState({
316
- aria: {
317
- enabled: true
318
- },
319
- animation: false,
320
- ...chartDataset,
321
- ...chartXAxis,
322
- ...chartYAxis,
323
- ...chartSeries,
324
- ...chartTooltip,
325
- ...chartLegend,
326
- ...chartHorizontalRangerSlider,
327
- ...chartGrid
328
- });
329
- useEffect(() => {
330
- var _a;
331
- if (!isMounted.current) {
332
- isMounted.current = true;
333
- return;
334
- }
335
- if (theme !== currentTheme.current) {
336
- setInitialOption({
337
- aria: {
338
- enabled: true
339
- },
340
- animation: false,
341
- ...chartDataset,
342
- ...chartXAxis,
343
- ...chartYAxis,
344
- ...chartSeries,
345
- ...chartTooltip,
346
- ...chartLegend,
347
- ...chartHorizontalRangerSlider,
348
- ...chartGrid
349
- });
350
- currentTheme.current = theme;
351
- return;
352
- }
353
- (_a = chartRef.current) == null ? void 0 : _a.getEchartsInstance().setOption({
354
- ...chartDataset,
355
- ...chartXAxis,
356
- ...chartYAxis,
357
- ...chartSeries,
358
- ...chartLegend,
359
- ...chartTooltip,
360
- ...chartHorizontalRangerSlider,
361
- ...chartGrid
362
- }, {
363
- replaceMerge: ["xAxis", "yAxis", "series", "dataset"]
364
- });
365
- }, [theme, chartDataset, chartXAxis, chartYAxis, chartSeries, chartLegend, chartTooltip, chartHorizontalRangerSlider, chartGrid]);
366
- return /* @__PURE__ */ jsx(ReactECharts, {
367
- ref: chartRef,
368
- echarts,
369
- option: initialOption,
370
- theme,
371
- notMerge: true
9
+ return /* @__PURE__ */ jsx(HvBaseChart, {
10
+ type: "line",
11
+ area,
12
+ emptyCellMode,
13
+ areaOpacity,
14
+ ...others
372
15
  });
373
16
  };
374
17
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.js","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,QAAQC,IAAI,CACVC,WACAC,gBACAC,kBACAC,eACAC,eACAC,kBACAC,iBACAC,yBACAC,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;AAA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,EAAAA,CACJ;AAEDW,YAAU,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,6BACGgB,cAAY;AAAA,IACXC,KAAKtJ;AAAAA,IACLnC;AAAAA,IACA0L,QAAQb;AAAAA,IACR/I;AAAAA,IACA6J,UAAQ;AAAA,EAAA,CACT;AAEL;"}
1
+ {"version":3,"file":"LineChart.js","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,6BACGC,aAAW;AAAA,IACVC,MAAK;AAAA,IACLL;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IAAyB,GACrBC;AAAAA,EAAAA,CACL;AAEL;"}
package/dist/esm/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { HvLineChart } from "./components/LineChart/LineChart.js";
2
+ import { HvBarChart } from "./components/BarChart/BarChart.js";
2
3
  import { HvVizContext, HvVizProvider } from "./providers/Provider.js";
3
4
  export {
5
+ HvBarChart,
4
6
  HvLineChart,
5
7
  HvVizContext,
6
8
  HvVizProvider
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,5 +1,5 @@
1
1
  import { useTheme } from "@hitachivantara/uikit-react-core";
2
- import * as echarts from "echarts/core";
2
+ import { registerThemes } from "../utils/registerThemes.js";
3
3
  import { createContext, useState, useEffect, useMemo } from "react";
4
4
  import { jsx } from "@emotion/react/jsx-runtime";
5
5
  const HvVizContext = createContext({
@@ -15,88 +15,6 @@ const HvVizProvider = ({
15
15
  selectedTheme
16
16
  } = useTheme();
17
17
  const [theme, setTheme] = useState();
18
- const registerThemes = (themeName, modes, themeStructure) => {
19
- modes.forEach((mode) => {
20
- const baseText = {
21
- color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].secondary,
22
- fontWeight: themeStructure == null ? void 0 : themeStructure.fontWeights.normal,
23
- fontSize: themeStructure == null ? void 0 : themeStructure.fontSizes.sm,
24
- fontFamily: themeStructure == null ? void 0 : themeStructure.fontFamily.body
25
- };
26
- const customAxis = {
27
- nameTextStyle: {
28
- ...baseText
29
- },
30
- axisLine: {
31
- show: true,
32
- lineStyle: {
33
- color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].atmo3
34
- }
35
- },
36
- axisTick: {
37
- show: true,
38
- lineStyle: {
39
- color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].atmo3
40
- }
41
- },
42
- axisLabel: {
43
- color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].secondary_80,
44
- fontWeight: themeStructure == null ? void 0 : themeStructure.fontWeights.normal,
45
- fontSize: themeStructure == null ? void 0 : themeStructure.fontSizes.sm,
46
- fontFamily: themeStructure == null ? void 0 : themeStructure.fontFamily.body
47
- },
48
- splitLine: {
49
- show: true,
50
- lineStyle: {
51
- color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].atmo3
52
- }
53
- }
54
- };
55
- echarts.registerTheme(`${themeName}-${mode}`, {
56
- 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],
57
- legend: {
58
- textStyle: {
59
- ...baseText
60
- }
61
- },
62
- tooltip: {
63
- borderWidth: 0,
64
- padding: 0,
65
- textStyle: {
66
- ...baseText
67
- },
68
- axisPointer: {
69
- lineStyle: {
70
- color: themeStructure == null ? void 0 : themeStructure.colors.modes[mode].secondary,
71
- width: 1
72
- }
73
- }
74
- },
75
- dataZoom: {
76
- textStyle: {
77
- ...baseText
78
- }
79
- },
80
- categoryAxis: {
81
- ...customAxis
82
- },
83
- valueAxis: {
84
- ...customAxis
85
- },
86
- logAxis: {
87
- ...customAxis
88
- },
89
- timeAxis: {
90
- ...customAxis
91
- },
92
- line: {
93
- lineStyle: {
94
- width: 2
95
- }
96
- }
97
- });
98
- });
99
- };
100
18
  useEffect(() => {
101
19
  registerThemes(selectedTheme, colorModes, activeTheme);
102
20
  }, [selectedTheme, colorModes, activeTheme]);
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import { HvTheme, useTheme } from \"@hitachivantara/uikit-react-core\";\nimport * as echarts from \"echarts/core\";\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 const registerThemes = (\n themeName: string,\n modes: string[],\n themeStructure?: HvTheme\n ) => {\n modes.forEach((mode) => {\n const baseText = {\n color: themeStructure?.colors.modes[mode].secondary,\n fontWeight: themeStructure?.fontWeights.normal,\n fontSize: themeStructure?.fontSizes.sm,\n fontFamily: themeStructure?.fontFamily.body,\n };\n\n const customAxis = {\n nameTextStyle: {\n ...baseText,\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n axisTick: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n axisLabel: {\n color: themeStructure?.colors.modes[mode].secondary_80,\n fontWeight: themeStructure?.fontWeights.normal,\n fontSize: themeStructure?.fontSizes.sm,\n fontFamily: themeStructure?.fontFamily.body,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n };\n\n echarts.registerTheme(`${themeName}-${mode}`, {\n color: [\n themeStructure?.colors.modes[mode].cat1,\n themeStructure?.colors.modes[mode].cat2,\n themeStructure?.colors.modes[mode].cat3,\n themeStructure?.colors.modes[mode].cat4,\n themeStructure?.colors.modes[mode].cat5,\n themeStructure?.colors.modes[mode].cat6,\n ],\n legend: {\n textStyle: {\n ...baseText,\n },\n },\n tooltip: {\n borderWidth: 0,\n padding: 0,\n textStyle: {\n ...baseText,\n },\n axisPointer: {\n lineStyle: {\n color: themeStructure?.colors.modes[mode].secondary,\n width: 1,\n },\n },\n },\n dataZoom: {\n textStyle: { ...baseText },\n },\n categoryAxis: {\n ...customAxis,\n },\n valueAxis: {\n ...customAxis,\n },\n logAxis: {\n ...customAxis,\n },\n timeAxis: {\n ...customAxis,\n },\n line: {\n lineStyle: {\n width: 2,\n },\n },\n });\n });\n };\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","registerThemes","themeName","modes","themeStructure","forEach","mode","baseText","color","colors","secondary","fontWeight","fontWeights","normal","fontSize","fontSizes","sm","fontFamily","body","customAxis","nameTextStyle","axisLine","show","lineStyle","atmo3","axisTick","axisLabel","secondary_80","splitLine","registerTheme","cat1","cat2","cat3","cat4","cat5","cat6","legend","textStyle","tooltip","borderWidth","padding","axisPointer","width","dataZoom","categoryAxis","valueAxis","logAxis","timeAxis","line","useEffect","value","useMemo","_jsx","Provider"],"mappings":";;;;AAWO,MAAMA,eAAeC,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,SAAS;AAE1E,QAAM,CAACR,OAAOS,QAAQ,IAAIC,SAA6B;AAEvD,QAAMC,iBAAiBA,CACrBC,WACAC,OACAC,mBACG;AACHD,UAAME,QAASC,CAAS,SAAA;AACtB,YAAMC,WAAW;AAAA,QACfC,OAAOJ,iDAAgBK,OAAON,MAAMG,MAAMI;AAAAA,QAC1CC,YAAYP,iDAAgBQ,YAAYC;AAAAA,QACxCC,UAAUV,iDAAgBW,UAAUC;AAAAA,QACpCC,YAAYb,iDAAgBa,WAAWC;AAAAA,MAAAA;AAGzC,YAAMC,aAAa;AAAA,QACjBC,eAAe;AAAA,UACb,GAAGb;AAAAA,QACL;AAAA,QACAc,UAAU;AAAA,UACRC,MAAM;AAAA,UACNC,WAAW;AAAA,YACTf,OAAOJ,iDAAgBK,OAAON,MAAMG,MAAMkB;AAAAA,UAC5C;AAAA,QACF;AAAA,QACAC,UAAU;AAAA,UACRH,MAAM;AAAA,UACNC,WAAW;AAAA,YACTf,OAAOJ,iDAAgBK,OAAON,MAAMG,MAAMkB;AAAAA,UAC5C;AAAA,QACF;AAAA,QACAE,WA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ACR,GAAG5B;AAAAA,QACL;AAAA,QACA6B,MAAM;AAAA,UACJzB,WAAW;AAAA,YACTmB,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EAAA;AAGHO,YAAU,MAAM;AACCpD,mBAAAA,eAAeF,YAAYD,WAAW;AAAA,EACpD,GAAA,CAACG,eAAeF,YAAYD,WAAW,CAAC;AAE3CuD,YAAU,MAAM;AACJ,aAAA,GAAEpD,iBAAiBD,cAAc;AAAA,EAAA,GAC1C,CAACA,cAAcC,aAAa,CAAC;AAE1BqD,QAAAA,QAAQC,QACZ,OAAO;AAAA,IACL7D;AAAAA,EAAAA,IAEF,CAACA,KAAK,CACR;AAGE8D,SAAAA,oBAAChE,aAAaiE,UAAQ;AAAA,IAACH;AAAAA,IAAazD;AAAAA,EAAAA,CAAkC;AAE1E;"}
1
+ {"version":3,"file":"Provider.js","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,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,SAAS;AAE1E,QAAM,CAACR,OAAOS,QAAQ,IAAIC,SAA6B;AAEvDC,YAAU,MAAM;AACCJ,mBAAAA,eAAeF,YAAYD,WAAW;AAAA,EACpD,GAAA,CAACG,eAAeF,YAAYD,WAAW,CAAC;AAE3CO,YAAU,MAAM;AACJ,aAAA,GAAEJ,iBAAiBD,cAAc;AAAA,EAAA,GAC1C,CAACA,cAAcC,aAAa,CAAC;AAE1BK,QAAAA,QAAQC,QACZ,OAAO;AAAA,IACLb;AAAAA,EAAAA,IAEF,CAACA,KAAK,CACR;AAGEc,SAAAA,oBAAChB,aAAaiB,UAAQ;AAAA,IAACH;AAAAA,IAAaT;AAAAA,EAAAA,CAAkC;AAE1E;"}