@react-fabric/chart 1.0.0-beta.53 → 1.0.0-beta.54

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 (39) hide show
  1. package/dist/cjs/charts/ActivityMap.js +16 -15
  2. package/dist/cjs/charts/CountSeries.js +12 -11
  3. package/dist/cjs/charts/DataSeries.js +23 -23
  4. package/dist/cjs/charts/MapSeries.js +6 -6
  5. package/dist/cjs/charts/TimeSeries.js +24 -24
  6. package/dist/cjs/charts/TimeSlider.js +9 -9
  7. package/dist/cjs/charts/WordBubble.js +5 -5
  8. package/dist/cjs/theme/darkBase.js +13 -5
  9. package/dist/cjs/theme/index.js +3 -3
  10. package/dist/cjs/theme/lightBase.js +18 -10
  11. package/dist/esm/charts/ActivityMap.js +16 -15
  12. package/dist/esm/charts/CountSeries.js +12 -11
  13. package/dist/esm/charts/DataSeries.js +23 -23
  14. package/dist/esm/charts/MapSeries.js +6 -6
  15. package/dist/esm/charts/TimeSeries.js +24 -24
  16. package/dist/esm/charts/TimeSlider.js +9 -9
  17. package/dist/esm/charts/WordBubble.js +5 -5
  18. package/dist/esm/theme/darkBase.js +13 -5
  19. package/dist/esm/theme/index.js +3 -3
  20. package/dist/esm/theme/lightBase.js +18 -10
  21. package/dist/types/charts/ActivityMap.d.ts +1 -1
  22. package/dist/types/charts/MapSeries.d.ts +7 -2
  23. package/dist/types/charts/TimeSlider.d.ts +1 -1
  24. package/dist/types/charts/WordBubble.d.ts +7 -2
  25. package/dist/types/theme/darkBase.d.ts +8 -0
  26. package/dist/types/theme/lightBase.d.ts +8 -0
  27. package/dist/types/types/index.d.ts +27 -11
  28. package/package.json +3 -3
  29. package/src/charts/ActivityMap.tsx +25 -22
  30. package/src/charts/CountSeries.tsx +22 -16
  31. package/src/charts/DataSeries.tsx +39 -21
  32. package/src/charts/MapSeries.tsx +8 -7
  33. package/src/charts/TimeSeries.tsx +49 -41
  34. package/src/charts/TimeSlider.tsx +12 -9
  35. package/src/charts/WordBubble.tsx +8 -7
  36. package/src/theme/darkBase.ts +12 -4
  37. package/src/theme/index.ts +3 -3
  38. package/src/theme/lightBase.ts +17 -9
  39. package/src/types/index.ts +34 -3
@@ -197,7 +197,7 @@ var DarkThemeBase = {
197
197
  splitLine: {
198
198
  show: true,
199
199
  lineStyle: {
200
- color: ["#444"]
200
+ color: ["#363636"]
201
201
  }
202
202
  },
203
203
  splitArea: {
@@ -231,7 +231,7 @@ var DarkThemeBase = {
231
231
  splitLine: {
232
232
  show: true,
233
233
  lineStyle: {
234
- color: ["#444"]
234
+ color: ["#363636"]
235
235
  }
236
236
  },
237
237
  splitArea: {
@@ -265,7 +265,7 @@ var DarkThemeBase = {
265
265
  splitLine: {
266
266
  show: true,
267
267
  lineStyle: {
268
- color: ["#444"]
268
+ color: ["#363636"]
269
269
  }
270
270
  },
271
271
  splitArea: {
@@ -299,7 +299,7 @@ var DarkThemeBase = {
299
299
  splitLine: {
300
300
  show: true,
301
301
  lineStyle: {
302
- color: ["#444"]
302
+ color: ["#363636"]
303
303
  }
304
304
  },
305
305
  splitArea: {
@@ -321,9 +321,17 @@ var DarkThemeBase = {
321
321
  },
322
322
  legend: {
323
323
  inactiveColor: "rgb(192 192 192 / .75)",
324
+ itemHeight: 8,
324
325
  textStyle: {
326
+ fontSize: 10,
325
327
  color: "#5d6d7d6"
326
- }
328
+ },
329
+ pageTextStyle: {
330
+ fontSize: 8
331
+ },
332
+ pageIconSize: 8,
333
+ pageIconColor: "#6997A3",
334
+ pageIconInactiveColor: "#474B4A"
327
335
  },
328
336
  tooltip: {
329
337
  backgroundColor: "#0C141D",
@@ -109,9 +109,9 @@ var registerThemes = function registerThemes(echarts) {
109
109
  registerTheme(echarts, "sunrise", ChartPalette.Sunrise, [ChartPalette.Sunrise[1], ChartPalette.Sunrise[4], ChartPalette.Sunrise[7]]);
110
110
  registerTheme(echarts, "ocean", ChartPalette.Ocean, [ChartPalette.Ocean[1], ChartPalette.Ocean[3], ChartPalette.Ocean[5]]);
111
111
  registerTheme(echarts, "wine", ChartPalette.Wine, [ChartPalette.Wine[1], ChartPalette.Wine[3], ChartPalette.Wine[5]]);
112
- registerTheme(echarts, "blue", ChartPalette.GreenBlue, [ChartPalette.GreenBlue[6], ChartPalette.GreenBlue[3], ChartPalette.GreenBlue[0]]);
113
- registerTheme(echarts, "green", ChartPalette.YellowGreen, [ChartPalette.YellowGreen[6], ChartPalette.YellowGreen[3], ChartPalette.YellowGreen[0]]);
114
- registerTheme(echarts, "red", ChartPalette.OrangeRed, [ChartPalette.OrangeRed[6], ChartPalette.OrangeRed[3], ChartPalette.OrangeRed[0]]);
112
+ registerTheme(echarts, "blue", ChartPalette.GreenBlue.slice().reverse(), [ChartPalette.GreenBlue[6], ChartPalette.GreenBlue[3], ChartPalette.GreenBlue[0]]);
113
+ registerTheme(echarts, "green", ChartPalette.YellowGreen.slice().reverse(), [ChartPalette.YellowGreen[6], ChartPalette.YellowGreen[3], ChartPalette.YellowGreen[0]]);
114
+ registerTheme(echarts, "red", ChartPalette.OrangeRed.slice().reverse(), [ChartPalette.OrangeRed[6], ChartPalette.OrangeRed[3], ChartPalette.OrangeRed[0]]);
115
115
  };
116
116
 
117
117
  export { registerTheme, registerThemes };
@@ -64,7 +64,7 @@ var LightThemeBase = {
64
64
  splitLine: {
65
65
  show: true,
66
66
  lineStyle: {
67
- color: ["#ccc"]
67
+ color: ["#d9d9d9"]
68
68
  }
69
69
  },
70
70
  splitArea: {
@@ -176,7 +176,7 @@ var LightThemeBase = {
176
176
  axisLine: {
177
177
  show: true,
178
178
  lineStyle: {
179
- color: "#cccccc"
179
+ color: "#c5c5c5"
180
180
  }
181
181
  },
182
182
  axisTick: {
@@ -195,7 +195,7 @@ var LightThemeBase = {
195
195
  splitLine: {
196
196
  show: true,
197
197
  lineStyle: {
198
- color: ["#eee"]
198
+ color: ["#d9d9d9"]
199
199
  }
200
200
  },
201
201
  splitArea: {
@@ -210,7 +210,7 @@ var LightThemeBase = {
210
210
  axisLine: {
211
211
  show: true,
212
212
  lineStyle: {
213
- color: "#cccccc"
213
+ color: "#c5c5c5"
214
214
  }
215
215
  },
216
216
  axisTick: {
@@ -229,7 +229,7 @@ var LightThemeBase = {
229
229
  splitLine: {
230
230
  show: true,
231
231
  lineStyle: {
232
- color: ["#eee"]
232
+ color: ["#d9d9d9"]
233
233
  }
234
234
  },
235
235
  splitArea: {
@@ -244,7 +244,7 @@ var LightThemeBase = {
244
244
  axisLine: {
245
245
  show: true,
246
246
  lineStyle: {
247
- color: "#cccccc"
247
+ color: "#969696"
248
248
  }
249
249
  },
250
250
  axisTick: {
@@ -263,7 +263,7 @@ var LightThemeBase = {
263
263
  splitLine: {
264
264
  show: true,
265
265
  lineStyle: {
266
- color: ["#eee"]
266
+ color: ["#d9d9d9"]
267
267
  }
268
268
  },
269
269
  splitArea: {
@@ -278,7 +278,7 @@ var LightThemeBase = {
278
278
  axisLine: {
279
279
  show: true,
280
280
  lineStyle: {
281
- color: "#cccccc"
281
+ color: "#969696"
282
282
  }
283
283
  },
284
284
  axisTick: {
@@ -297,7 +297,7 @@ var LightThemeBase = {
297
297
  splitLine: {
298
298
  show: true,
299
299
  lineStyle: {
300
- color: ["#eee"]
300
+ color: ["#d9d9d9"]
301
301
  }
302
302
  },
303
303
  splitArea: {
@@ -319,9 +319,17 @@ var LightThemeBase = {
319
319
  },
320
320
  legend: {
321
321
  inactiveColor: "rgb(96 96 96 / .75)",
322
+ itemHeight: 8,
322
323
  textStyle: {
324
+ fontSize: 10,
323
325
  color: "#565656"
324
- }
326
+ },
327
+ pageTextStyle: {
328
+ fontSize: 8
329
+ },
330
+ pageIconSize: 8,
331
+ pageIconColor: "#487884",
332
+ pageIconInactiveColor: "#CCD3D1"
325
333
  },
326
334
  tooltip: {
327
335
  backgroundColor: "#FCFDFD",
@@ -2,7 +2,7 @@ import { type FC } from "react";
2
2
  import { type BaseChart } from "../types";
3
3
  export interface ActivityMapProps extends BaseChart {
4
4
  heatmapPalette?: string[];
5
- data: Array<Array<[low: number, high: number, count: number]>>;
5
+ series: Array<Array<[low: number, high: number, count: number]>>;
6
6
  time?: "day-hour" | "month-day";
7
7
  type?: "scatter" | "heatmap";
8
8
  /**
@@ -1,6 +1,11 @@
1
1
  import { type FC } from "react";
2
- import { type BaseChart, type CountType } from "../types";
3
- export interface MapSeriesProps extends BaseChart, CountType {
2
+ import { type BaseChart } from "../types";
3
+ export interface MapSeriesProps extends BaseChart {
4
+ series: Array<{
5
+ id: string;
6
+ label?: string;
7
+ count: number;
8
+ }>;
4
9
  onClick?: (key: string) => void;
5
10
  }
6
11
  /**
@@ -1,7 +1,7 @@
1
1
  import { type FC } from "react";
2
2
  import { type BaseChart } from "../types";
3
3
  export interface TimeSliderProps extends BaseChart {
4
- data: Array<[Date, number]>;
4
+ series: Array<[Date, number]>;
5
5
  range?: {
6
6
  start: Date;
7
7
  end: Date;
@@ -1,6 +1,11 @@
1
1
  import { type FC } from "react";
2
- import { type BaseChart, type CountType } from "../types";
3
- export interface WordBubbleProps extends Omit<BaseChart, "theme">, CountType {
2
+ import { type BaseChart } from "../types";
3
+ export interface WordBubbleProps extends Omit<BaseChart, "theme"> {
4
+ series: Array<{
5
+ id: string;
6
+ label?: string;
7
+ count: number;
8
+ }>;
4
9
  onClick?: (key: string) => void;
5
10
  }
6
11
  /**
@@ -296,9 +296,17 @@ export declare const DarkThemeBase: {
296
296
  };
297
297
  legend: {
298
298
  inactiveColor: string;
299
+ itemHeight: number;
299
300
  textStyle: {
301
+ fontSize: number;
300
302
  color: string;
301
303
  };
304
+ pageTextStyle: {
305
+ fontSize: number;
306
+ };
307
+ pageIconSize: number;
308
+ pageIconColor: string;
309
+ pageIconInactiveColor: string;
302
310
  };
303
311
  tooltip: {
304
312
  backgroundColor: string;
@@ -294,9 +294,17 @@ export declare const LightThemeBase: {
294
294
  };
295
295
  legend: {
296
296
  inactiveColor: string;
297
+ itemHeight: number;
297
298
  textStyle: {
299
+ fontSize: number;
298
300
  color: string;
299
301
  };
302
+ pageTextStyle: {
303
+ fontSize: number;
304
+ };
305
+ pageIconSize: number;
306
+ pageIconColor: string;
307
+ pageIconInactiveColor: string;
300
308
  };
301
309
  tooltip: {
302
310
  backgroundColor: string;
@@ -1,8 +1,30 @@
1
+ import { type EChartOption } from "echarts";
1
2
  export type Theme = "default" | "activity" | "cloud" | "qualitative" | "diverging" | "sequential" | "spectral" | "uber" | "fireice" | "warming" | "sunrise" | "ocean" | "wine" | "red" | "green" | "blue";
2
3
  export interface BaseChart {
3
4
  title?: string;
5
+ /**
6
+ * The theme to be applied to the chart.
7
+ * This can be one of the predefined themes or a custom theme object.
8
+ * Predefined themes include "default", "activity", "cloud", "qualitative", "diverging", "sequential",
9
+ * "spectral", "uber", "fireice", "warming", "sunrise", "ocean", "wine", "red", "green", and "blue".
10
+ */
4
11
  theme?: Theme;
12
+ /**
13
+ * Additional options for the chart.
14
+ * This can include any ECharts options to customize the chart's appearance and behavior.
15
+ */
16
+ options?: EChartOption;
17
+ /**
18
+ * Whether to show the theme selector in the chart.
19
+ * This is useful for allowing users to switch between different themes.
20
+ * If set to true, the chart will render a toggle button group to select the theme.
21
+ */
5
22
  showThemeSelector?: boolean;
23
+ /**
24
+ * Whether to show the type selector in the chart.
25
+ * This is useful for charts that can have multiple types (e.g., line, column, etc.).
26
+ * If set to true, the chart will render a toggle button group to select the type.
27
+ */
6
28
  showTypeSelector?: boolean;
7
29
  onExport?: (chart: {
8
30
  title: string;
@@ -10,9 +32,7 @@ export interface BaseChart {
10
32
  }) => void;
11
33
  }
12
34
  export interface CountType {
13
- data: Array<{
14
- id: string;
15
- label?: string;
35
+ series: Array<EChartOption.SeriesPie & {
16
36
  count: number;
17
37
  }>;
18
38
  }
@@ -21,18 +41,14 @@ export interface SeriesType {
21
41
  valueAxisName?: string;
22
42
  valueFormat?: string;
23
43
  categories: string[];
24
- data: Array<{
25
- id: string;
26
- label?: string;
27
- values: number[];
44
+ series: Array<EChartOption.SeriesBar & {
45
+ data: number[];
28
46
  }>;
29
47
  }
30
48
  export interface TimeSeriesType {
31
49
  categoryAxisName?: string;
32
50
  valueAxisName?: string;
33
- data: Array<{
34
- id: string;
35
- label?: string;
36
- values: Array<[Date, number]>;
51
+ series: Array<EChartOption.SeriesBar & {
52
+ data: Array<[Date, number]>;
37
53
  }>;
38
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/chart",
3
- "version": "1.0.0-beta.53",
3
+ "version": "1.0.0-beta.54",
4
4
  "description": "RUF: Charting package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "watch": "npm-run-all -p watch:rollup watch:dts"
36
36
  },
37
37
  "dependencies": {
38
- "@react-fabric/core": "^1.0.0-beta.53",
38
+ "@react-fabric/core": "^1.0.0-beta.54",
39
39
  "@react-fabric/utilities": "^1.0.0-beta.52",
40
40
  "classnames": "^2.5.1",
41
41
  "color": "^4.2.3",
@@ -56,5 +56,5 @@
56
56
  "node": ">=18.12.0",
57
57
  "npm": ">=8.19.0"
58
58
  },
59
- "gitHead": "1042327831f9c908912c552d5c2704b765a6f9c2"
59
+ "gitHead": "242f15e3de29d365cce6f41f4ef99ab36bb6b995"
60
60
  }
@@ -31,17 +31,15 @@ import {
31
31
  import { isArray, isEmpty } from "@react-fabric/utilities";
32
32
  import { type EChartOption, type EChartsType } from "echarts";
33
33
  import { memo, useEffect, useRef, useState, type FC } from "react";
34
- import { ChartPalette } from "../theme/palettes";
35
34
  import { type BaseChart } from "../types";
36
35
  import { activityRenderer } from "../types/utils";
37
36
  import { ChartContainer } from "../wrapper/ChartContainer";
38
37
  import { ChartWrapper } from "../wrapper/ChartWrapper";
39
38
  import { PaletteSelect } from "../wrapper/PaletteSelect";
40
- import { E } from "react-router/dist/development/register-DCE0tH5m";
41
39
 
42
40
  export interface ActivityMapProps extends BaseChart {
43
41
  heatmapPalette?: string[];
44
- data: Array<Array<[low: number, high: number, count: number]>>;
42
+ series: Array<Array<[low: number, high: number, count: number]>>;
45
43
  time?: "day-hour" | "month-day";
46
44
  type?: "scatter" | "heatmap";
47
45
  /**
@@ -136,9 +134,10 @@ const MONTH_DAY = {
136
134
 
137
135
  const ActivityMapChart = memo(
138
136
  ({
139
- data = [],
137
+ series = [],
140
138
  title,
141
139
  onExport,
140
+ options: optionOverride,
142
141
  theme: chartTheme = "activity",
143
142
  heatmapPalette,
144
143
  highLabels,
@@ -168,9 +167,9 @@ const ActivityMapChart = memo(
168
167
  series: [],
169
168
  };
170
169
 
171
- if (isEmpty(data)) return {};
170
+ if (isEmpty(series)) return {};
172
171
 
173
- options.xAxis = {
172
+ options.xAxis = Object.assign({}, optionOverride?.xAxis, {
174
173
  type: "category",
175
174
  data: lowLabels ?? defaultMap.low,
176
175
  boundaryGap: type === "heatmap",
@@ -180,8 +179,8 @@ const ActivityMapChart = memo(
180
179
  axisLine: {
181
180
  show: false,
182
181
  },
183
- };
184
- options.yAxis = {
182
+ });
183
+ options.yAxis = Object.assign({}, optionOverride?.yAxis, {
185
184
  type: "category",
186
185
  axisLabel: {
187
186
  margin: 16,
@@ -190,8 +189,8 @@ const ActivityMapChart = memo(
190
189
  axisLine: {
191
190
  show: false,
192
191
  },
193
- };
194
- options.series = data.map((points, index) => {
192
+ });
193
+ options.series = series.map((points, index) => {
195
194
  const total = points.reduce((t, p) => t + p[2], 0);
196
195
  return {
197
196
  id: `${index}`,
@@ -208,7 +207,7 @@ const ActivityMapChart = memo(
208
207
  });
209
208
 
210
209
  if (type === "heatmap") {
211
- const dataPoints = data.map((points) =>
210
+ const dataPoints = series.map((points) =>
212
211
  Math.max(...points.map((pt) => pt[2])),
213
212
  );
214
213
  options.grid = {
@@ -242,19 +241,23 @@ const ActivityMapChart = memo(
242
241
  top: 32,
243
242
  bottom: 64,
244
243
  },
245
- tooltip: {
246
- trigger: "item",
247
- confine: true,
248
- position: "top",
249
- appendToBody: true,
250
- valueFormatter: (c: AnyObject) => {
251
- return isArray(c) ? c[2] : c;
252
- },
253
- } as AnyObject,
244
+ tooltip: Object.assign(
245
+ {
246
+ trigger: "item",
247
+ confine: true,
248
+ position: "top",
249
+ appendToBody: true,
250
+ valueFormatter: (c: AnyObject) => {
251
+ return isArray(c) ? c[2] : c;
252
+ },
253
+ } as AnyObject,
254
+ optionOverride?.tooltip,
255
+ ),
256
+ ...optionOverride,
254
257
  ...options,
255
258
  };
256
259
  },
257
- [data, title, type, heatmapPalette],
260
+ [series, title, type, heatmapPalette, optionOverride],
258
261
  "ActivityChart options",
259
262
  );
260
263
 
@@ -265,7 +268,7 @@ const ActivityMapChart = memo(
265
268
  theme={theme}
266
269
  options={options}
267
270
  chartRef={chartRef}
268
- isEmpty={isEmpty(data)}
271
+ isEmpty={isEmpty(series)}
269
272
  emptyIcon={CoreIcons.chartActivityScatter}
270
273
  dataTableRenderer={activityRenderer}
271
274
  onClick={(e) => onClick?.(e.seriesIndex, e.dataIndex)}
@@ -44,11 +44,12 @@ export interface CountSeriesProps extends BaseChart, CountType {
44
44
 
45
45
  const CountSeriesChart: FC<CountSeriesProps> = memo(
46
46
  ({
47
- data,
47
+ series: _series,
48
48
  title,
49
49
  onExport,
50
50
  theme: chartTheme,
51
51
  type: chartType = "pie",
52
+ options: optionOverride,
52
53
  showThemeSelector,
53
54
  showTypeSelector,
54
55
  onClick,
@@ -66,28 +67,32 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
66
67
 
67
68
  const options = useMemoDebugger<EChartOption>(
68
69
  () => {
69
- if (isEmpty(data)) {
70
+ if (isEmpty(_series)) {
70
71
  chartRef.current?.clear();
71
72
  return {};
72
73
  }
73
74
 
74
- const sorted = data?.sort(compareValues("desc", "count"));
75
+ const sorted = _series?.sort(compareValues("desc", "count"));
75
76
 
76
- const categoryAxis: AnyObject = {
77
- type: "category",
78
- name: title ?? "Count Series",
79
- nameLocation: "center",
80
- axisTick: {
81
- show: false,
82
- },
83
- data: [],
84
- } as EChartOption.XAxis;
85
- const valueAxis: AnyObject = {
77
+ const categoryAxis: AnyObject = Object.assign(
78
+ {},
79
+ optionOverride?.xAxis,
80
+ {
81
+ type: "category",
82
+ name: title ?? "Count Series",
83
+ nameLocation: "center",
84
+ axisTick: {
85
+ show: false,
86
+ },
87
+ data: [],
88
+ } as EChartOption.XAxis,
89
+ );
90
+ const valueAxis: AnyObject = Object.assign({}, optionOverride?.yAxis, {
86
91
  type: "value",
87
92
  axisLabel: {
88
93
  formatter: (val: AnyObject) => Format.number(val),
89
94
  },
90
- } as EChartOption.YAxis;
95
+ } as EChartOption.YAxis);
91
96
 
92
97
  const series =
93
98
  type === "pie"
@@ -123,6 +128,7 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
123
128
  universalTransition: true,
124
129
  }));
125
130
  return {
131
+ ...optionOverride,
126
132
  series,
127
133
  countSeries: true,
128
134
  xAxis:
@@ -131,7 +137,7 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
131
137
  type === "pie" ? null : type === "bar" ? categoryAxis : valueAxis,
132
138
  };
133
139
  },
134
- [data, title, type],
140
+ [_series, title, type, optionOverride],
135
141
  "CountChart options",
136
142
  );
137
143
 
@@ -142,7 +148,7 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
142
148
  theme={theme}
143
149
  options={options}
144
150
  chartRef={chartRef}
145
- isEmpty={isEmpty(data)}
151
+ isEmpty={isEmpty(_series)}
146
152
  emptyIcon={CoreIcons.chartPie}
147
153
  dataTableRenderer={countRenderer}
148
154
  onClick={(e) => onClick?.(e.data.id ?? e.seriesId)}
@@ -51,12 +51,13 @@ export interface DataSeriesProps extends BaseChart, SeriesType {
51
51
 
52
52
  const DataSeriesChart: FC<DataSeriesProps> = memo(
53
53
  ({
54
- data,
54
+ series: _series,
55
55
  onExport,
56
56
  categories,
57
57
  categoryAxisName,
58
58
  valueAxisName,
59
59
  title,
60
+ options: optionOverride,
60
61
  showThemeSelector,
61
62
  showTypeSelector,
62
63
  theme: chartTheme,
@@ -76,7 +77,7 @@ const DataSeriesChart: FC<DataSeriesProps> = memo(
76
77
 
77
78
  const options = useMemoDebugger<EChartOption>(
78
79
  () => {
79
- if (isEmpty(data)) {
80
+ if (isEmpty(_series)) {
80
81
  chartRef.current?.clear();
81
82
  return {};
82
83
  }
@@ -84,7 +85,9 @@ const DataSeriesChart: FC<DataSeriesProps> = memo(
84
85
  const stack = type.includes("stacked") ? "stack" : undefined;
85
86
 
86
87
  const [_type, stacked] = type.split("-");
87
- const categoryAxis: AnyObject =
88
+ const categoryAxis: AnyObject = Object.assign(
89
+ {},
90
+ optionOverride?.xAxis,
88
91
  _type === "radar"
89
92
  ? undefined
90
93
  : ({
@@ -96,8 +99,11 @@ const DataSeriesChart: FC<DataSeriesProps> = memo(
96
99
  show: false,
97
100
  },
98
101
  data: categories,
99
- } as EChartOption.XAxis);
100
- const valueAxis: AnyObject =
102
+ } as EChartOption.XAxis),
103
+ );
104
+ const valueAxis: AnyObject = Object.assign(
105
+ {},
106
+ optionOverride?.yAxis,
101
107
  _type === "radar"
102
108
  ? undefined
103
109
  : ({
@@ -105,18 +111,19 @@ const DataSeriesChart: FC<DataSeriesProps> = memo(
105
111
  type: "value",
106
112
  nameGap: 32,
107
113
  nameLocation: "center",
108
- } as EChartOption.YAxis);
114
+ } as EChartOption.YAxis),
115
+ );
109
116
  const radar =
110
117
  _type !== "radar"
111
118
  ? undefined
112
- : ({
119
+ : Object.assign({}, optionOverride?.radar, {
113
120
  shape: "circle",
114
121
  indicator: categories?.map((c) => ({ name: c })),
115
122
  } as AnyObject);
116
123
 
117
- const series = data?.map((item, index) => ({
118
- id: item.id,
119
- stack,
124
+ const series = _series?.map((item, index) => ({
125
+ ...item,
126
+ stack: item.stack ?? stack,
120
127
  areaStyle: stacked ? {} : undefined,
121
128
  type: _type === "column" ? "bar" : _type,
122
129
  name: item.label ?? item.id,
@@ -125,28 +132,39 @@ const DataSeriesChart: FC<DataSeriesProps> = memo(
125
132
  _type === "radar"
126
133
  ? [
127
134
  {
128
- value: item.values,
135
+ value: item.data,
129
136
  id: item.id,
130
- name: item.label ?? item.id,
137
+ name: item.name ?? item.id,
131
138
  },
132
139
  ]
133
- : item.values,
140
+ : item.data,
134
141
  }));
135
142
 
136
143
  return {
144
+ ...optionOverride,
137
145
  xAxis: type.startsWith("bar") ? valueAxis : categoryAxis,
138
146
  yAxis: type.startsWith("bar") ? categoryAxis : valueAxis,
139
147
  radar,
140
148
  series,
141
- tooltip: {
142
- trigger: _type === "radar" ? "item" : "axis",
143
- confine: true,
144
- position: "top",
145
- appendToBody: true,
146
- } as AnyObject,
149
+ tooltip: Object.assign(
150
+ {
151
+ trigger: _type === "radar" ? "item" : "axis",
152
+ confine: true,
153
+ position: "top",
154
+ appendToBody: true,
155
+ } as AnyObject,
156
+ optionOverride?.tooltip,
157
+ ),
147
158
  };
148
159
  },
149
- [data, type, categories, categoryAxisName, valueAxisName],
160
+ [
161
+ _series,
162
+ type,
163
+ categories,
164
+ categoryAxisName,
165
+ valueAxisName,
166
+ optionOverride,
167
+ ],
150
168
  "DataChart options",
151
169
  );
152
170
 
@@ -157,7 +175,7 @@ const DataSeriesChart: FC<DataSeriesProps> = memo(
157
175
  theme={theme}
158
176
  options={options}
159
177
  chartRef={chartRef}
160
- isEmpty={isEmpty(data)}
178
+ isEmpty={isEmpty(_series)}
161
179
  emptyIcon={CoreIcons.chartColumn}
162
180
  dataTableRenderer={seriesRenderer}
163
181
  onClick={(e) => onClick?.({ category: e.name, series: e.seriesId })}