@react-fabric/chart 1.0.0-beta.6 → 1.0.0-beta.61

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 (73) hide show
  1. package/{src/wrapper/Chart.module.css → css/_chart.css} +7 -7
  2. package/css/styles.css +24 -0
  3. package/dist/cjs/charts/ActivityMap.js +61 -30
  4. package/dist/cjs/charts/CountSeries.js +56 -26
  5. package/dist/cjs/charts/DataSeries.js +64 -36
  6. package/dist/cjs/charts/Generic.js +29 -5
  7. package/dist/cjs/charts/MapSeries.js +35 -11
  8. package/dist/cjs/charts/TimeSeries.js +60 -34
  9. package/dist/cjs/charts/TimeSlider.js +30 -10
  10. package/dist/cjs/charts/WordBubble.js +37 -7
  11. package/dist/cjs/theme/darkBase.js +13 -10
  12. package/dist/cjs/theme/index.js +38 -18
  13. package/dist/cjs/theme/lightBase.js +18 -15
  14. package/dist/cjs/theme/palettes.js +27 -27
  15. package/dist/cjs/types/charts.js +2 -2
  16. package/dist/cjs/types/utils.js +1 -4
  17. package/dist/cjs/wrapper/ChartContainer.js +12 -9
  18. package/dist/cjs/wrapper/ChartToolbar.js +1 -2
  19. package/dist/cjs/wrapper/PaletteSelect.js +1 -1
  20. package/dist/esm/charts/ActivityMap.js +62 -31
  21. package/dist/esm/charts/CountSeries.js +57 -27
  22. package/dist/esm/charts/DataSeries.js +65 -37
  23. package/dist/esm/charts/Generic.js +31 -7
  24. package/dist/esm/charts/MapSeries.js +36 -12
  25. package/dist/esm/charts/TimeSeries.js +61 -35
  26. package/dist/esm/charts/TimeSlider.js +30 -10
  27. package/dist/esm/charts/WordBubble.js +38 -8
  28. package/dist/esm/theme/darkBase.js +13 -10
  29. package/dist/esm/theme/index.js +38 -18
  30. package/dist/esm/theme/lightBase.js +18 -15
  31. package/dist/esm/theme/palettes.js +27 -27
  32. package/dist/esm/types/charts.js +2 -2
  33. package/dist/esm/types/utils.js +1 -4
  34. package/dist/esm/wrapper/ChartContainer.js +13 -10
  35. package/dist/esm/wrapper/ChartToolbar.js +1 -2
  36. package/dist/esm/wrapper/PaletteSelect.js +2 -2
  37. package/dist/types/charts/ActivityMap.d.ts +23 -2
  38. package/dist/types/charts/CountSeries.d.ts +28 -1
  39. package/dist/types/charts/DataSeries.d.ts +26 -1
  40. package/dist/types/charts/Generic.d.ts +29 -41
  41. package/dist/types/charts/MapSeries.d.ts +31 -3
  42. package/dist/types/charts/TimeSeries.d.ts +24 -1
  43. package/dist/types/charts/TimeSlider.d.ts +22 -2
  44. package/dist/types/charts/WordBubble.d.ts +32 -3
  45. package/dist/types/theme/darkBase.d.ts +8 -5
  46. package/dist/types/theme/index.d.ts +1 -1
  47. package/dist/types/theme/lightBase.d.ts +8 -5
  48. package/dist/types/types/charts.d.ts +1 -1
  49. package/dist/types/types/index.d.ts +30 -12
  50. package/dist/types/types/world.svg.d.ts +1 -1
  51. package/dist/types/wrapper/ChartContainer.d.ts +4 -4
  52. package/dist/types/wrapper/ChartWrapper.d.ts +0 -1
  53. package/package.json +15 -16
  54. package/src/charts/ActivityMap.tsx +104 -60
  55. package/src/charts/CountSeries.tsx +89 -50
  56. package/src/charts/DataSeries.tsx +127 -78
  57. package/src/charts/Generic.tsx +43 -51
  58. package/src/charts/MapSeries.tsx +61 -33
  59. package/src/charts/TimeSeries.tsx +116 -79
  60. package/src/charts/TimeSlider.tsx +38 -15
  61. package/src/charts/WordBubble.tsx +43 -12
  62. package/src/theme/darkBase.ts +12 -9
  63. package/src/theme/index.ts +94 -20
  64. package/src/theme/lightBase.ts +17 -14
  65. package/src/theme/palettes.ts +1 -52
  66. package/src/types/charts.ts +6 -2
  67. package/src/types/index.ts +40 -4
  68. package/src/types/utils.ts +0 -1
  69. package/src/wrapper/ChartContainer.tsx +17 -12
  70. package/src/wrapper/ChartToolbar.tsx +1 -2
  71. package/src/wrapper/PaletteSelect.tsx +2 -8
  72. package/dist/cjs/wrapper/Chart.module.css +0 -1
  73. package/dist/esm/wrapper/Chart.module.css +0 -1
@@ -14,12 +14,15 @@ var jsxRuntime = require('react/jsx-runtime');
14
14
  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; }
15
15
  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; }
16
16
  var DataSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
17
- var data = _ref.data,
17
+ var _series = _ref.series,
18
18
  onExport = _ref.onExport,
19
19
  categories = _ref.categories,
20
20
  categoryAxisName = _ref.categoryAxisName,
21
21
  valueAxisName = _ref.valueAxisName,
22
22
  title = _ref.title,
23
+ optionOverride = _ref.options,
24
+ showThemeSelector = _ref.showThemeSelector,
25
+ showTypeSelector = _ref.showTypeSelector,
23
26
  chartTheme = _ref.theme,
24
27
  _ref$type = _ref.type,
25
28
  chartType = _ref$type === void 0 ? "column" : _ref$type,
@@ -40,7 +43,7 @@ var DataSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
40
43
  setTheme(chartTheme);
41
44
  }, [chartTheme]);
42
45
  var options = core.useMemoDebugger(function () {
43
- if (utilities.isEmpty(data)) {
46
+ if (utilities.isEmpty(_series)) {
44
47
  var _chartRef$current;
45
48
  (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 || _chartRef$current.clear();
46
49
  return {};
@@ -50,7 +53,7 @@ var DataSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
50
53
  _type$split2 = _slicedToArray(_type$split, 2),
51
54
  _type = _type$split2[0],
52
55
  stacked = _type$split2[1];
53
- var categoryAxis = _type === "radar" ? undefined : {
56
+ var categoryAxis = Object.assign({}, optionOverride === null || optionOverride === void 0 ? void 0 : optionOverride.xAxis, _type === "radar" ? undefined : {
54
57
  name: categoryAxisName,
55
58
  type: "category",
56
59
  nameGap: 32,
@@ -59,57 +62,57 @@ var DataSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
59
62
  show: false
60
63
  },
61
64
  data: categories
62
- };
63
- var valueAxis = _type === "radar" ? undefined : {
65
+ });
66
+ var valueAxis = Object.assign({}, optionOverride === null || optionOverride === void 0 ? void 0 : optionOverride.yAxis, _type === "radar" ? undefined : {
64
67
  name: valueAxisName,
65
68
  type: "value",
66
69
  nameGap: 32,
67
70
  nameLocation: "center"
68
- };
69
- var radar = _type !== "radar" ? undefined : {
71
+ });
72
+ var radar = _type !== "radar" ? undefined : Object.assign({}, optionOverride === null || optionOverride === void 0 ? void 0 : optionOverride.radar, {
70
73
  shape: "circle",
71
74
  indicator: categories === null || categories === void 0 ? void 0 : categories.map(function (c) {
72
75
  return {
73
76
  name: c
74
77
  };
75
78
  })
76
- };
77
- var series = data === null || data === void 0 ? void 0 : data.map(function (item, index) {
78
- var _item$label, _item$label2;
79
- return {
80
- id: item.id,
81
- stack: stack,
79
+ });
80
+ var series = _series === null || _series === void 0 ? void 0 : _series.map(function (item, index) {
81
+ var _item$stack, _item$label, _item$name;
82
+ return _objectSpread(_objectSpread({}, item), {}, {
83
+ stack: (_item$stack = item.stack) !== null && _item$stack !== void 0 ? _item$stack : stack,
82
84
  areaStyle: stacked ? {} : undefined,
83
85
  type: _type === "column" ? "bar" : _type,
84
86
  name: (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : item.id,
85
87
  universalTransition: true,
86
88
  data: _type === "radar" ? [{
87
- value: item.values,
89
+ value: item.data,
88
90
  id: item.id,
89
- name: (_item$label2 = item.label) !== null && _item$label2 !== void 0 ? _item$label2 : item.id
90
- }] : item.values
91
- };
91
+ name: (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id
92
+ }] : item.data
93
+ });
92
94
  });
93
- return {
95
+ return _objectSpread(_objectSpread({}, optionOverride), {}, {
94
96
  xAxis: type.startsWith("bar") ? valueAxis : categoryAxis,
95
97
  yAxis: type.startsWith("bar") ? categoryAxis : valueAxis,
96
98
  radar: radar,
97
99
  series: series,
98
- tooltip: {
100
+ tooltip: Object.assign({
99
101
  trigger: _type === "radar" ? "item" : "axis",
100
102
  confine: true,
101
- position: "top"
102
- }
103
- };
104
- }, [data, type, categories, categoryAxisName, valueAxisName], "DataChart options");
103
+ position: "top",
104
+ appendToBody: true
105
+ }, optionOverride === null || optionOverride === void 0 ? void 0 : optionOverride.tooltip)
106
+ });
107
+ }, [_series, type, categories, categoryAxisName, valueAxisName, optionOverride], "DataChart options");
105
108
  return /*#__PURE__*/jsxRuntime.jsxs(ChartContainer.ChartContainer, {
106
109
  title: title,
107
110
  onExport: onExport,
108
111
  theme: theme,
109
112
  options: options,
110
113
  chartRef: chartRef,
111
- isEmpty: utilities.isEmpty(data),
112
- emptyIcon: core.CoreIcons.chartColumn,
114
+ isEmpty: utilities.isEmpty(_series),
115
+ emptyIcon: "icon-[mdi--chart-bar]",
113
116
  dataTableRenderer: utils.seriesRenderer,
114
117
  onClick: function onClick(e) {
115
118
  return _onClick === null || _onClick === void 0 ? void 0 : _onClick({
@@ -117,55 +120,55 @@ var DataSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
117
120
  series: e.seriesId
118
121
  });
119
122
  },
120
- children: [/*#__PURE__*/jsxRuntime.jsxs(core.ToggleButtonGroup, {
123
+ children: [showTypeSelector && /*#__PURE__*/jsxRuntime.jsxs(core.ToggleButtonGroup, {
121
124
  value: type,
122
125
  onChange: setType,
123
126
  children: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
124
127
  size: "sm",
125
128
  variant: "link",
126
- icon: core.CoreIcons.chartLine,
129
+ icon: "icon-[mdi--chart-line]",
127
130
  "aria-label": "line",
128
131
  value: "line"
129
132
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
130
133
  size: "sm",
131
134
  variant: "link",
132
- icon: core.CoreIcons.chartColumn,
135
+ icon: "icon-[mdi--chart-bar]",
133
136
  "aria-label": "column",
134
137
  value: "column"
135
138
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
136
139
  size: "sm",
137
140
  variant: "link",
138
- icon: core.CoreIcons.chartBar,
141
+ icon: "icon-[mdi--chart-bar] rotate-90 -scale-x-100",
139
142
  "aria-label": "bar",
140
143
  value: "bar"
141
144
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
142
145
  size: "sm",
143
146
  variant: "link",
144
- icon: core.CoreIcons.chartRadar,
147
+ icon: "icon-[mdi--radar]",
145
148
  "aria-label": "radar",
146
149
  value: "radar"
147
150
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
148
151
  size: "sm",
149
152
  variant: "link",
150
- icon: core.CoreIcons.chartLineStacked,
153
+ icon: "icon-[mdi--chart-line-stacked]",
151
154
  "aria-label": "line-stacked",
152
155
  value: "line-stacked"
153
156
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
154
157
  size: "sm",
155
158
  variant: "link",
156
- icon: core.CoreIcons.chartColumnStacked,
159
+ icon: "icon-[mdi--chart-bar-stacked]",
157
160
  "aria-label": "column-stacked",
158
161
  value: "column-stacked"
159
162
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
160
163
  size: "sm",
161
164
  variant: "link",
162
- icon: core.CoreIcons.chartBarStacked,
165
+ icon: "icon-[mdi--chart-bar-stacked] rotate-90 -scale-x-100",
163
166
  "aria-label": "bar-stacked",
164
167
  value: "bar-stacked"
165
168
  })]
166
- }), /*#__PURE__*/jsxRuntime.jsx(core.Divider, {
169
+ }), showTypeSelector && showThemeSelector && /*#__PURE__*/jsxRuntime.jsx(core.Divider, {
167
170
  vertical: true
168
- }), /*#__PURE__*/jsxRuntime.jsx(PaletteSelect.PaletteSelect, {
171
+ }), showThemeSelector && /*#__PURE__*/jsxRuntime.jsx(PaletteSelect.PaletteSelect, {
169
172
  theme: theme,
170
173
  onClick: setTheme
171
174
  })]
@@ -174,7 +177,32 @@ var DataSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
174
177
  DataSeriesChart.displayName = "DataSeriesChart";
175
178
 
176
179
  /**
177
- * Chart to display simple data category series
180
+ * DataSeries component renders a chart for visualizing data series.
181
+ * It supports various chart types such as column, line, bar, radar, and stacked variants.
182
+ * It allows users to click on data points to trigger custom actions.
183
+ *
184
+ * @param {DataSeriesProps} props - The properties for the DataSeries component.
185
+ * @returns {JSX.Element} The rendered DataSeries component.
186
+ *
187
+ * @example
188
+ * ```jsx
189
+ * <DataSeries
190
+ * data={[{ id: "1", label: "Series 1", values: [10, 20, 30] }]}
191
+ * categories={["Category 1", "Category 2", "Category 3"]}
192
+ * categoryAxisName="Categories"
193
+ * valueAxisName="Values"
194
+ * title="Data Series Example"
195
+ * type="column"
196
+ * onClick={(data) => console.log("Clicked data:", data)}
197
+ * onExport={() => console.log("Exporting chart data")}
198
+ * theme="light"
199
+ * />
200
+ * ```
201
+ *
202
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-dataseries--docs} for more details on the properties.
203
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for ECharts bar series options.
204
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for ECharts line series options.
205
+ * @see {@link https://echarts.apache.org/en/option.html#series-radar} for ECharts radar series options.
178
206
  */
179
207
  var DataSeries = function DataSeries(props) {
180
208
  return /*#__PURE__*/jsxRuntime.jsx(ChartWrapper.ChartWrapper, {
@@ -1,13 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
5
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
5
6
  var react = require('react');
6
7
  var ChartContainer = require('../wrapper/ChartContainer.js');
7
8
  var ChartWrapper = require('../wrapper/ChartWrapper.js');
9
+ var PaletteSelect = require('../wrapper/PaletteSelect.js');
8
10
  var jsxRuntime = require('react/jsx-runtime');
9
11
 
10
- var _excluded = ["chartRef", "onBrush", "onBrushEnd", "onBrushSelected", "dataTableRenderer", "onClick", "onRendered", "actions", "title", "theme"];
12
+ var _excluded = ["chartRef", "onBrush", "onBrushEnd", "onBrushSelected", "dataTableRenderer", "onClick", "onRendered", "showThemeSelector", "actions", "title", "theme"];
11
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; }
12
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; }
13
15
  var GenericChartBase = /*#__PURE__*/react.memo(function (_ref2) {
@@ -18,11 +20,16 @@ var GenericChartBase = /*#__PURE__*/react.memo(function (_ref2) {
18
20
  dataTableRenderer = _ref2.dataTableRenderer,
19
21
  onClick = _ref2.onClick,
20
22
  onRendered = _ref2.onRendered,
23
+ showThemeSelector = _ref2.showThemeSelector,
21
24
  actions = _ref2.actions,
22
25
  title = _ref2.title,
23
- theme = _ref2.theme,
26
+ chartTheme = _ref2.theme,
24
27
  options = _objectWithoutProperties(_ref2, _excluded);
25
28
  var chartRef = react.useRef(null);
29
+ var _useState = react.useState(chartTheme),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ theme = _useState2[0],
32
+ setTheme = _useState2[1];
26
33
  react.useImperativeHandle(_ref, function () {
27
34
  return chartRef.current;
28
35
  }, [chartRef.current]);
@@ -71,16 +78,33 @@ var GenericChartBase = /*#__PURE__*/react.memo(function (_ref2) {
71
78
  };
72
79
  }
73
80
  }, [chartRef.current, onBrushSelected]);
74
- return /*#__PURE__*/jsxRuntime.jsx(ChartContainer.ChartContainer, {
75
- theme: theme,
81
+ return /*#__PURE__*/jsxRuntime.jsxs(ChartContainer.ChartContainer, {
76
82
  options: options,
77
83
  chartRef: chartRef,
84
+ theme: theme,
78
85
  title: title,
79
86
  dataTableRenderer: dataTableRenderer,
80
- children: actions
87
+ children: [actions, showThemeSelector && /*#__PURE__*/jsxRuntime.jsx(PaletteSelect.PaletteSelect, {
88
+ theme: theme,
89
+ onClick: setTheme
90
+ })]
81
91
  });
82
92
  });
83
93
  GenericChartBase.displayName = "GenericChart";
94
+
95
+ /**
96
+ * GenericChart component renders a generic chart using ECharts.
97
+ * It accepts various chart options and configurations, allowing for flexible chart rendering.
98
+ * It supports click events, brush events, and custom actions.
99
+ * It can be used to create a wide range of chart types by passing the appropriate ECharts options.
100
+ *
101
+ * @param props - The properties for the GenericChart component, including chart options, event handlers, and custom actions.
102
+ * @returns A React functional component that renders the chart within a ChartWrapper.
103
+ *
104
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-genericchart--docs} for more details on the properties.
105
+ * @see {@link https://echarts.apache.org/en/option.html} for ECharts options documentation.
106
+ * @see {@link https://echarts.apache.org/en/api.html#echartsInstance} for ECharts instance methods and properties.
107
+ */
84
108
  var GenericChart = function GenericChart(props) {
85
109
  return /*#__PURE__*/jsxRuntime.jsx(ChartWrapper.ChartWrapper, {
86
110
  children: /*#__PURE__*/jsxRuntime.jsx(GenericChartBase, _objectSpread({}, props))
@@ -39,10 +39,11 @@ echarts__namespace.registerMap("world", {
39
39
  svg: world_svg
40
40
  });
41
41
  var MapSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
42
- var data = _ref.data,
42
+ var series = _ref.series,
43
43
  onExport = _ref.onExport;
44
44
  _ref.theme;
45
- var title = _ref.title,
45
+ var showTypeSelector = _ref.showTypeSelector,
46
+ title = _ref.title,
46
47
  _onClick = _ref.onClick;
47
48
  var chartRef = react.useRef(null);
48
49
  var _useState = react.useState("map"),
@@ -54,14 +55,14 @@ var MapSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
54
55
  zoom = _useState4[0],
55
56
  setZoom = _useState4[1];
56
57
  var options = core.useMemoDebugger(function () {
57
- if (utilities.isEmpty(data)) return {};
58
- var sorted = data.map(function (d) {
58
+ if (utilities.isEmpty(series)) return {};
59
+ var sorted = series.map(function (d) {
59
60
  var _d$label;
60
61
  return _objectSpread(_objectSpread({}, d), {}, {
61
62
  label: (_d$label = d.label) !== null && _d$label !== void 0 ? _d$label : utilities.Countries.name(d.id)
62
63
  });
63
64
  }).sort(utilities.compareValues("desc", "count"));
64
- var valueMap = data.map(function (d) {
65
+ var valueMap = series.map(function (d) {
65
66
  return d.count;
66
67
  });
67
68
  if (type === "column") {
@@ -151,10 +152,10 @@ var MapSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
151
152
  })
152
153
  }]
153
154
  };
154
- }, [data, title, type], "MapChart options");
155
+ }, [series, title, type], "MapChart options");
155
156
  react.useEffect(function () {
156
157
  setZoom(1.25);
157
- }, [data, type]);
158
+ }, [series, type]);
158
159
  react.useEffect(function () {
159
160
  var _chartRef$current;
160
161
  (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 || _chartRef$current.setOption({
@@ -182,19 +183,19 @@ var MapSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
182
183
  onChange: function onChange(e) {
183
184
  return setZoom(e.target.valueAsNumber);
184
185
  }
185
- }), /*#__PURE__*/jsxRuntime.jsxs(core.ToggleButtonGroup, {
186
+ }), showTypeSelector && /*#__PURE__*/jsxRuntime.jsxs(core.ToggleButtonGroup, {
186
187
  value: type,
187
188
  onChange: setType,
188
189
  children: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
189
190
  size: "sm",
190
191
  variant: "link",
191
- icon: core.CoreIcons.map,
192
+ icon: "icon-[mdi--map]",
192
193
  "aria-label": "map",
193
194
  value: "map"
194
195
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
195
196
  size: "sm",
196
197
  variant: "link",
197
- icon: core.CoreIcons.chartColumn,
198
+ icon: "icon-[mdi--chart-bar] rotate-90 -scale-x-100",
198
199
  "aria-label": "column",
199
200
  value: "column"
200
201
  })]
@@ -204,7 +205,30 @@ var MapSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
204
205
  MapSeriesChart.displayName = "MapSeriesChart";
205
206
 
206
207
  /**
207
- * Chart to display simple map data series
208
+ * MapSeries component renders a map chart using ECharts.
209
+ * It displays data on a world map, allowing users to visualize counts or other metrics by country.
210
+ * It supports zooming and switching between map and column views.
211
+ *
212
+ * @param {MapSeriesProps} props - The properties for the MapSeries component.
213
+ * @returns {JSX.Element} The rendered MapSeries component.
214
+ *
215
+ * @example
216
+ * ```jsx
217
+ * <MapSeries
218
+ * data={[
219
+ * { id: "US", label: "United States", count: 100 },
220
+ * { id: "IN", label: "India", count: 200 },
221
+ * { id: "CN", label: "China", count: 300 },
222
+ * ]}
223
+ * onExport={() => console.log("Exporting chart")}
224
+ * title="World Map Series"
225
+ * onClick={(key) => console.log("Clicked country:", key)}
226
+ * theme="light"
227
+ * />
228
+ * ```
229
+ *
230
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-mapseries--docs} for more details on the properties.
231
+ * @see {@link https://echarts.apache.org/en/option.html#series-map} for ECharts map series options documentation.
208
232
  */
209
233
  var MapSeries = function MapSeries(props) {
210
234
  return /*#__PURE__*/jsxRuntime.jsx(ChartWrapper.ChartWrapper, {
@@ -14,14 +14,17 @@ var jsxRuntime = require('react/jsx-runtime');
14
14
  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; }
15
15
  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; }
16
16
  var TimeSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
17
- var data = _ref.data,
17
+ var _series = _ref.series,
18
18
  onExport = _ref.onExport,
19
19
  categoryAxisName = _ref.categoryAxisName,
20
20
  valueAxisName = _ref.valueAxisName,
21
21
  title = _ref.title,
22
+ showThemeSelector = _ref.showThemeSelector,
23
+ showTypeSelector = _ref.showTypeSelector,
22
24
  chartTheme = _ref.theme,
23
25
  _ref$type = _ref.type,
24
26
  chartType = _ref$type === void 0 ? "column" : _ref$type,
27
+ optionOverride = _ref.options,
25
28
  _onClick = _ref.onClick,
26
29
  onBrush = _ref.onBrush;
27
30
  var chartRef = react.useRef(null);
@@ -82,7 +85,7 @@ var TimeSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
82
85
  }
83
86
  }, [chartRef.current, onBrush]);
84
87
  var options = core.useMemoDebugger(function () {
85
- if (utilities.isEmpty(data)) {
88
+ if (utilities.isEmpty(_series)) {
86
89
  var _chartRef$current3;
87
90
  (_chartRef$current3 = chartRef.current) === null || _chartRef$current3 === void 0 || _chartRef$current3.clear();
88
91
  return {};
@@ -92,7 +95,7 @@ var TimeSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
92
95
  _type$split2 = _slicedToArray(_type$split, 2),
93
96
  _type = _type$split2[0],
94
97
  stacked = _type$split2[1];
95
- var categoryAxis = {
98
+ var categoryAxis = Object.assign({}, optionOverride === null || optionOverride === void 0 ? void 0 : optionOverride.xAxis, {
96
99
  name: categoryAxisName,
97
100
  type: "time",
98
101
  nameGap: 32,
@@ -112,50 +115,50 @@ var TimeSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
112
115
  none: "{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}"
113
116
  }
114
117
  }
115
- };
116
- var valueAxis = {
118
+ });
119
+ var valueAxis = Object.assign({}, optionOverride === null || optionOverride === void 0 ? void 0 : optionOverride.yAxis, {
117
120
  name: valueAxisName,
118
121
  type: "value",
119
122
  nameGap: 32,
120
123
  nameLocation: "center"
121
- };
122
- var series = data === null || data === void 0 ? void 0 : data.map(function (item) {
123
- var _item$label;
124
- return {
125
- id: item.id,
126
- stack: stack,
124
+ });
125
+ var series = _series === null || _series === void 0 ? void 0 : _series.map(function (item) {
126
+ var _item$stack, _item$name;
127
+ return _objectSpread(_objectSpread({}, item), {}, {
128
+ stack: (_item$stack = item.stack) !== null && _item$stack !== void 0 ? _item$stack : stack,
127
129
  areaStyle: stacked ? {} : undefined,
128
130
  symbol: "none",
129
131
  type: _type === "column" ? "bar" : _type,
130
- name: (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : item.id,
131
- data: item.values,
132
+ name: (_item$name = item.name) !== null && _item$name !== void 0 ? _item$name : item.id,
132
133
  universalTransition: true
133
- };
134
+ });
134
135
  });
135
- return {
136
- xAxis: categoryAxis,
137
- yAxis: valueAxis,
138
- series: series,
136
+ return _objectSpread(_objectSpread({
139
137
  brush: {
140
138
  toolbox: ["lineX", "clear"],
141
139
  brushType: "lineX",
142
140
  xAxisIndex: 0
143
- },
144
- tooltip: {
141
+ }
142
+ }, optionOverride), {}, {
143
+ tooltip: Object.assign({
145
144
  trigger: "axis",
146
145
  confine: true,
147
- position: "top"
148
- }
149
- };
150
- }, [data, type, categoryAxisName, valueAxisName], "TimeChart options");
146
+ position: "top",
147
+ appendTo: "body"
148
+ }, optionOverride === null || optionOverride === void 0 ? void 0 : optionOverride.tooltip),
149
+ xAxis: categoryAxis,
150
+ yAxis: valueAxis,
151
+ series: series
152
+ });
153
+ }, [_series, type, categoryAxisName, valueAxisName, optionOverride], "TimeChart options");
151
154
  return /*#__PURE__*/jsxRuntime.jsxs(ChartContainer.ChartContainer, {
152
155
  title: title,
153
156
  onExport: onExport,
154
157
  theme: theme,
155
158
  options: options,
156
159
  chartRef: chartRef,
157
- isEmpty: utilities.isEmpty(data),
158
- emptyIcon: core.CoreIcons.chartColumn,
160
+ isEmpty: utilities.isEmpty(_series),
161
+ emptyIcon: "icon-[mdi--chart-bar] rotate-90 -scale-x-100",
159
162
  dataTableRenderer: utils.timeSeriesRenderer,
160
163
  onClick: function onClick(e) {
161
164
  return _onClick === null || _onClick === void 0 ? void 0 : _onClick({
@@ -163,37 +166,37 @@ var TimeSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
163
166
  series: e.seriesId
164
167
  });
165
168
  },
166
- children: [/*#__PURE__*/jsxRuntime.jsxs(core.ToggleButtonGroup, {
169
+ children: [showTypeSelector && /*#__PURE__*/jsxRuntime.jsxs(core.ToggleButtonGroup, {
167
170
  value: type,
168
171
  onChange: setType,
169
172
  children: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
170
173
  size: "sm",
171
174
  variant: "link",
172
- icon: core.CoreIcons.chartLine,
175
+ icon: "icon-[mdi--chart-line]",
173
176
  value: "line",
174
177
  "aria-label": "line"
175
178
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
176
179
  size: "sm",
177
180
  variant: "link",
178
- icon: core.CoreIcons.chartColumn,
181
+ icon: "icon-[mdi--chart-bar]",
179
182
  value: "column",
180
183
  "aria-label": "column"
181
184
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
182
185
  size: "sm",
183
186
  variant: "link",
184
- icon: core.CoreIcons.chartLineStacked,
187
+ icon: "icon-[mdi--chart-line-stacked]",
185
188
  value: "line-stacked",
186
189
  "aria-label": "line-stacked"
187
190
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
188
191
  size: "sm",
189
192
  variant: "link",
190
- icon: core.CoreIcons.chartColumnStacked,
193
+ icon: "icon-[mdi--chart-bar-stacked]",
191
194
  value: "column-stacked",
192
195
  "aria-label": "column-stacked"
193
196
  })]
194
- }), /*#__PURE__*/jsxRuntime.jsx(core.Divider, {
197
+ }), showTypeSelector && showThemeSelector && /*#__PURE__*/jsxRuntime.jsx(core.Divider, {
195
198
  vertical: true
196
- }), /*#__PURE__*/jsxRuntime.jsx(PaletteSelect.PaletteSelect, {
199
+ }), showThemeSelector && /*#__PURE__*/jsxRuntime.jsx(PaletteSelect.PaletteSelect, {
197
200
  theme: theme,
198
201
  onClick: setTheme
199
202
  })]
@@ -202,7 +205,30 @@ var TimeSeriesChart = /*#__PURE__*/react.memo(function (_ref) {
202
205
  TimeSeriesChart.displayName = "TimeSeriesChart";
203
206
 
204
207
  /**
205
- * Chart to display simple data time series
208
+ * TimeSeries component renders a time series chart using the provided data and options.
209
+ * It supports different chart types such as line, column, and stacked variants.
210
+ * It also allows for interaction through click and brush events.
211
+ *
212
+ * @param {TimeSeriesProps} props - The properties for the TimeSeries component.
213
+ * @returns {JSX.Element} The rendered TimeSeries component.
214
+ *
215
+ * @example
216
+ * ```jsx
217
+ * <TimeSeries
218
+ * data={data}
219
+ * onExport={handleExport}
220
+ * categoryAxisName="Time"
221
+ * valueAxisName="Value"
222
+ * title="Time Series Chart"
223
+ * type="line"
224
+ * onClick={(data) => console.log(data)}
225
+ * onBrush={(range) => console.log(range)}
226
+ * />
227
+ * ```
228
+ *
229
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-timeseries--docs} for more details on the properties.
230
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for more details on the ECharts line series options.
231
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for more details on the ECharts bar series options.
206
232
  */
207
233
  var TimeSeries = function TimeSeries(props) {
208
234
  return /*#__PURE__*/jsxRuntime.jsx(ChartWrapper.ChartWrapper, {