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

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 (43) hide show
  1. package/dist/cjs/charts/ActivityMap.js +16 -15
  2. package/dist/cjs/charts/CountSeries.js +20 -18
  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/cjs/wrapper/ChartContainer.js +5 -5
  12. package/dist/esm/charts/ActivityMap.js +16 -15
  13. package/dist/esm/charts/CountSeries.js +20 -18
  14. package/dist/esm/charts/DataSeries.js +23 -23
  15. package/dist/esm/charts/MapSeries.js +6 -6
  16. package/dist/esm/charts/TimeSeries.js +24 -24
  17. package/dist/esm/charts/TimeSlider.js +9 -9
  18. package/dist/esm/charts/WordBubble.js +5 -5
  19. package/dist/esm/theme/darkBase.js +13 -5
  20. package/dist/esm/theme/index.js +3 -3
  21. package/dist/esm/theme/lightBase.js +18 -10
  22. package/dist/esm/wrapper/ChartContainer.js +5 -5
  23. package/dist/types/charts/ActivityMap.d.ts +1 -1
  24. package/dist/types/charts/CountSeries.d.ts +1 -0
  25. package/dist/types/charts/MapSeries.d.ts +7 -2
  26. package/dist/types/charts/TimeSlider.d.ts +1 -1
  27. package/dist/types/charts/WordBubble.d.ts +7 -2
  28. package/dist/types/theme/darkBase.d.ts +8 -0
  29. package/dist/types/theme/lightBase.d.ts +8 -0
  30. package/dist/types/types/index.d.ts +27 -11
  31. package/package.json +3 -3
  32. package/src/charts/ActivityMap.tsx +25 -22
  33. package/src/charts/CountSeries.tsx +27 -19
  34. package/src/charts/DataSeries.tsx +39 -21
  35. package/src/charts/MapSeries.tsx +8 -7
  36. package/src/charts/TimeSeries.tsx +49 -41
  37. package/src/charts/TimeSlider.tsx +12 -9
  38. package/src/charts/WordBubble.tsx +8 -7
  39. package/src/theme/darkBase.ts +12 -4
  40. package/src/theme/index.ts +3 -3
  41. package/src/theme/lightBase.ts +17 -9
  42. package/src/types/index.ts +34 -3
  43. package/src/wrapper/ChartContainer.tsx +5 -3
@@ -13,13 +13,13 @@ import { jsx } from 'react/jsx-runtime';
13
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
15
  var WordBubbleChart = /*#__PURE__*/memo(function (_ref) {
16
- var data = _ref.data,
16
+ var series = _ref.series,
17
17
  title = _ref.title,
18
18
  onExport = _ref.onExport,
19
19
  _onClick = _ref.onClick;
20
20
  var isDark = useIsDark();
21
21
  var options = useMemoDebugger(function () {
22
- if (isEmpty(data)) return {};
22
+ if (isEmpty(series)) return {};
23
23
  var palette = isDark ? ChartPalette.CloudDark : ChartPalette.CloudLight;
24
24
  return {
25
25
  legend: undefined,
@@ -47,7 +47,7 @@ var WordBubbleChart = /*#__PURE__*/memo(function (_ref) {
47
47
  return palette[dataIndex % palette.length];
48
48
  }
49
49
  },
50
- data: data.sort(compareValues("desc", "count")).map(function (_ref3, index) {
50
+ data: series.sort(compareValues("desc", "count")).map(function (_ref3, index) {
51
51
  var key = _ref3.id,
52
52
  label = _ref3.label,
53
53
  count = _ref3.count;
@@ -58,12 +58,12 @@ var WordBubbleChart = /*#__PURE__*/memo(function (_ref) {
58
58
  })
59
59
  }]
60
60
  };
61
- }, [data, title, isDark], "WordChart options");
61
+ }, [series, title, isDark], "WordChart options");
62
62
  return /*#__PURE__*/jsx(ChartContainer, {
63
63
  title: title,
64
64
  onExport: onExport,
65
65
  options: options,
66
- isEmpty: isEmpty(data),
66
+ isEmpty: isEmpty(series),
67
67
  emptyIcon: CoreIcons.chartActivityScatter,
68
68
  dataTableRenderer: countRenderer,
69
69
  onClick: function onClick(e) {
@@ -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",
@@ -22,8 +22,6 @@ var defaultOptions = {
22
22
  },
23
23
  tooltip: {
24
24
  trigger: "item",
25
- confine: true,
26
- position: "top",
27
25
  appendToBody: true
28
26
  },
29
27
  legend: {
@@ -109,9 +107,11 @@ var ChartContainer = /*#__PURE__*/memo(function (_ref2) {
109
107
  return toolboxOptions(dataTableRenderer);
110
108
  }, [dataTableRenderer]);
111
109
  useEffect(function () {
112
- chartRef === null || chartRef === void 0 || chartRef.setOption(_objectSpread(_objectSpread({}, defaultOptions), {}, {
110
+ chartRef === null || chartRef === void 0 || chartRef.setOption(_objectSpread(_objectSpread(_objectSpread({}, defaultOptions), {}, {
113
111
  toolbox: toolbox
114
- }, options), true);
112
+ }, options), {}, {
113
+ tooltip: _objectSpread(_objectSpread({}, defaultOptions.tooltip), options.tooltip)
114
+ }), true);
115
115
  }, [options, chartRef]);
116
116
  var handleExport = useCallback(function () {
117
117
  var image = chartRef === null || chartRef === void 0 ? void 0 : chartRef.getDataURL({
@@ -126,7 +126,7 @@ var ChartContainer = /*#__PURE__*/memo(function (_ref2) {
126
126
  return /*#__PURE__*/jsxs(Fragment, {
127
127
  children: [/*#__PURE__*/jsxs(ChartToolbar, {
128
128
  children: [title && /*#__PURE__*/jsx(Title, {
129
- className: "flex-fill px-2 py-1 text-dimmed",
129
+ className: "flex-1 px-2 py-1 text-dimmed",
130
130
  children: title
131
131
  }), children, onExport && /*#__PURE__*/jsx(Button, {
132
132
  size: "sm",
@@ -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,7 @@
1
1
  import { type FC } from "react";
2
2
  import { type BaseChart, type CountType } from "../types";
3
3
  export interface CountSeriesProps extends BaseChart, CountType {
4
+ seriesName?: string;
4
5
  type?: "pie" | "bar" | "column";
5
6
  onClick?: (key: string) => void;
6
7
  }
@@ -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.55",
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.55",
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": "c8454798fb7546174ee8c7ea10e491c5e903e789"
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)}
@@ -38,17 +38,20 @@ import { ChartWrapper } from "../wrapper/ChartWrapper";
38
38
  import { PaletteSelect } from "../wrapper/PaletteSelect";
39
39
 
40
40
  export interface CountSeriesProps extends BaseChart, CountType {
41
+ seriesName?: string;
41
42
  type?: "pie" | "bar" | "column";
42
43
  onClick?: (key: string) => void;
43
44
  }
44
45
 
45
46
  const CountSeriesChart: FC<CountSeriesProps> = memo(
46
47
  ({
47
- data,
48
+ series: _series,
48
49
  title,
50
+ seriesName,
49
51
  onExport,
50
52
  theme: chartTheme,
51
53
  type: chartType = "pie",
54
+ options: optionOverride,
52
55
  showThemeSelector,
53
56
  showTypeSelector,
54
57
  onClick,
@@ -66,39 +69,43 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
66
69
 
67
70
  const options = useMemoDebugger<EChartOption>(
68
71
  () => {
69
- if (isEmpty(data)) {
72
+ if (isEmpty(_series)) {
70
73
  chartRef.current?.clear();
71
74
  return {};
72
75
  }
73
76
 
74
- const sorted = data?.sort(compareValues("desc", "count"));
77
+ const sorted = _series?.sort(compareValues("desc", "count"));
75
78
 
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 = {
79
+ const categoryAxis: AnyObject = Object.assign(
80
+ {},
81
+ optionOverride?.xAxis,
82
+ {
83
+ type: "category",
84
+ name: seriesName ?? "Count Series",
85
+ nameLocation: "center",
86
+ axisTick: {
87
+ show: false,
88
+ },
89
+ data: [],
90
+ } as EChartOption.XAxis,
91
+ );
92
+ const valueAxis: AnyObject = Object.assign({}, optionOverride?.yAxis, {
86
93
  type: "value",
87
94
  axisLabel: {
88
95
  formatter: (val: AnyObject) => Format.number(val),
89
96
  },
90
- } as EChartOption.YAxis;
97
+ } as EChartOption.YAxis);
91
98
 
92
99
  const series =
93
100
  type === "pie"
94
101
  ? [
95
102
  {
96
103
  type: "pie",
97
- name: title ?? "Count Series",
104
+ name: seriesName ?? "Count Series",
98
105
  data: sorted.map((item, index) => ({
99
106
  id: item.id,
100
107
  value: item.count,
101
- name: item.label ?? item.id,
108
+ name: item.name ?? item.id,
102
109
  })),
103
110
  universalTransition: true,
104
111
  },
@@ -115,7 +122,7 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
115
122
  },
116
123
  data: [
117
124
  {
118
- name: title ?? "Count Series",
125
+ name: seriesName ?? "Count Series",
119
126
  value: item.count,
120
127
  },
121
128
  ],
@@ -123,6 +130,7 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
123
130
  universalTransition: true,
124
131
  }));
125
132
  return {
133
+ ...optionOverride,
126
134
  series,
127
135
  countSeries: true,
128
136
  xAxis:
@@ -131,7 +139,7 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
131
139
  type === "pie" ? null : type === "bar" ? categoryAxis : valueAxis,
132
140
  };
133
141
  },
134
- [data, title, type],
142
+ [_series, name, type, optionOverride],
135
143
  "CountChart options",
136
144
  );
137
145
 
@@ -142,7 +150,7 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
142
150
  theme={theme}
143
151
  options={options}
144
152
  chartRef={chartRef}
145
- isEmpty={isEmpty(data)}
153
+ isEmpty={isEmpty(_series)}
146
154
  emptyIcon={CoreIcons.chartPie}
147
155
  dataTableRenderer={countRenderer}
148
156
  onClick={(e) => onClick?.(e.data.id ?? e.seriesId)}