@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
@@ -1,13 +1,15 @@
1
1
  'use client';
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
5
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
5
- import { memo, useRef, useImperativeHandle, useEffect } from 'react';
6
+ import { memo, useRef, useState, useImperativeHandle, useEffect } from 'react';
6
7
  import { ChartContainer } from '../wrapper/ChartContainer.js';
7
8
  import { ChartWrapper } from '../wrapper/ChartWrapper.js';
8
- import { jsx } from 'react/jsx-runtime';
9
+ import { PaletteSelect } from '../wrapper/PaletteSelect.js';
10
+ import { jsxs, jsx } from '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__*/memo(function (_ref2) {
@@ -18,11 +20,16 @@ var GenericChartBase = /*#__PURE__*/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 = useRef(null);
29
+ var _useState = useState(chartTheme),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ theme = _useState2[0],
32
+ setTheme = _useState2[1];
26
33
  useImperativeHandle(_ref, function () {
27
34
  return chartRef.current;
28
35
  }, [chartRef.current]);
@@ -71,16 +78,33 @@ var GenericChartBase = /*#__PURE__*/memo(function (_ref2) {
71
78
  };
72
79
  }
73
80
  }, [chartRef.current, onBrushSelected]);
74
- return /*#__PURE__*/jsx(ChartContainer, {
75
- theme: theme,
81
+ return /*#__PURE__*/jsxs(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__*/jsx(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__*/jsx(ChartWrapper, {
86
110
  children: /*#__PURE__*/jsx(GenericChartBase, _objectSpread({}, props))
@@ -10,7 +10,7 @@ import { ChartPalette } from '../theme/palettes.js';
10
10
  import { countRenderer } from '../types/utils.js';
11
11
  import { ChartContainer } from '../wrapper/ChartContainer.js';
12
12
  import { ChartWrapper } from '../wrapper/ChartWrapper.js';
13
- import { useMemoDebugger, ToggleButtonGroup, Button, CoreIcons } from '@react-fabric/core';
13
+ import { useMemoDebugger, ToggleButtonGroup, Button } from '@react-fabric/core';
14
14
  import WorldMap from '../types/world.svg.js';
15
15
  import { jsxs, jsx } from 'react/jsx-runtime';
16
16
 
@@ -20,10 +20,11 @@ echarts.registerMap("world", {
20
20
  svg: WorldMap
21
21
  });
22
22
  var MapSeriesChart = /*#__PURE__*/memo(function (_ref) {
23
- var data = _ref.data,
23
+ var series = _ref.series,
24
24
  onExport = _ref.onExport;
25
25
  _ref.theme;
26
- var title = _ref.title,
26
+ var showTypeSelector = _ref.showTypeSelector,
27
+ title = _ref.title,
27
28
  _onClick = _ref.onClick;
28
29
  var chartRef = useRef(null);
29
30
  var _useState = useState("map"),
@@ -35,14 +36,14 @@ var MapSeriesChart = /*#__PURE__*/memo(function (_ref) {
35
36
  zoom = _useState4[0],
36
37
  setZoom = _useState4[1];
37
38
  var options = useMemoDebugger(function () {
38
- if (isEmpty(data)) return {};
39
- var sorted = data.map(function (d) {
39
+ if (isEmpty(series)) return {};
40
+ var sorted = series.map(function (d) {
40
41
  var _d$label;
41
42
  return _objectSpread(_objectSpread({}, d), {}, {
42
43
  label: (_d$label = d.label) !== null && _d$label !== void 0 ? _d$label : Countries.name(d.id)
43
44
  });
44
45
  }).sort(compareValues("desc", "count"));
45
- var valueMap = data.map(function (d) {
46
+ var valueMap = series.map(function (d) {
46
47
  return d.count;
47
48
  });
48
49
  if (type === "column") {
@@ -132,10 +133,10 @@ var MapSeriesChart = /*#__PURE__*/memo(function (_ref) {
132
133
  })
133
134
  }]
134
135
  };
135
- }, [data, title, type], "MapChart options");
136
+ }, [series, title, type], "MapChart options");
136
137
  useEffect(function () {
137
138
  setZoom(1.25);
138
- }, [data, type]);
139
+ }, [series, type]);
139
140
  useEffect(function () {
140
141
  var _chartRef$current;
141
142
  (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 || _chartRef$current.setOption({
@@ -163,19 +164,19 @@ var MapSeriesChart = /*#__PURE__*/memo(function (_ref) {
163
164
  onChange: function onChange(e) {
164
165
  return setZoom(e.target.valueAsNumber);
165
166
  }
166
- }), /*#__PURE__*/jsxs(ToggleButtonGroup, {
167
+ }), showTypeSelector && /*#__PURE__*/jsxs(ToggleButtonGroup, {
167
168
  value: type,
168
169
  onChange: setType,
169
170
  children: [/*#__PURE__*/jsx(Button, {
170
171
  size: "sm",
171
172
  variant: "link",
172
- icon: CoreIcons.map,
173
+ icon: "icon-[mdi--map]",
173
174
  "aria-label": "map",
174
175
  value: "map"
175
176
  }), /*#__PURE__*/jsx(Button, {
176
177
  size: "sm",
177
178
  variant: "link",
178
- icon: CoreIcons.chartColumn,
179
+ icon: "icon-[mdi--chart-bar] rotate-90 -scale-x-100",
179
180
  "aria-label": "column",
180
181
  value: "column"
181
182
  })]
@@ -185,7 +186,30 @@ var MapSeriesChart = /*#__PURE__*/memo(function (_ref) {
185
186
  MapSeriesChart.displayName = "MapSeriesChart";
186
187
 
187
188
  /**
188
- * Chart to display simple map data series
189
+ * MapSeries component renders a map chart using ECharts.
190
+ * It displays data on a world map, allowing users to visualize counts or other metrics by country.
191
+ * It supports zooming and switching between map and column views.
192
+ *
193
+ * @param {MapSeriesProps} props - The properties for the MapSeries component.
194
+ * @returns {JSX.Element} The rendered MapSeries component.
195
+ *
196
+ * @example
197
+ * ```jsx
198
+ * <MapSeries
199
+ * data={[
200
+ * { id: "US", label: "United States", count: 100 },
201
+ * { id: "IN", label: "India", count: 200 },
202
+ * { id: "CN", label: "China", count: 300 },
203
+ * ]}
204
+ * onExport={() => console.log("Exporting chart")}
205
+ * title="World Map Series"
206
+ * onClick={(key) => console.log("Clicked country:", key)}
207
+ * theme="light"
208
+ * />
209
+ * ```
210
+ *
211
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-mapseries--docs} for more details on the properties.
212
+ * @see {@link https://echarts.apache.org/en/option.html#series-map} for ECharts map series options documentation.
189
213
  */
190
214
  var MapSeries = function MapSeries(props) {
191
215
  return /*#__PURE__*/jsx(ChartWrapper, {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
- import { useMemoDebugger, CoreIcons, ToggleButtonGroup, Button, Divider } from '@react-fabric/core';
5
+ import { useMemoDebugger, ToggleButtonGroup, Button, Divider } from '@react-fabric/core';
6
6
  import { isEmpty } from '@react-fabric/utilities';
7
7
  import { memo, useRef, useState, useEffect, useCallback } from 'react';
8
8
  import { timeSeriesRenderer } from '../types/utils.js';
@@ -14,14 +14,17 @@ import { jsxs, jsx } from '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__*/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 = useRef(null);
@@ -82,7 +85,7 @@ var TimeSeriesChart = /*#__PURE__*/memo(function (_ref) {
82
85
  }
83
86
  }, [chartRef.current, onBrush]);
84
87
  var options = useMemoDebugger(function () {
85
- if (isEmpty(data)) {
88
+ if (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__*/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__*/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__*/jsxs(ChartContainer, {
152
155
  title: title,
153
156
  onExport: onExport,
154
157
  theme: theme,
155
158
  options: options,
156
159
  chartRef: chartRef,
157
- isEmpty: isEmpty(data),
158
- emptyIcon: CoreIcons.chartColumn,
160
+ isEmpty: isEmpty(_series),
161
+ emptyIcon: "icon-[mdi--chart-bar] rotate-90 -scale-x-100",
159
162
  dataTableRenderer: 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__*/memo(function (_ref) {
163
166
  series: e.seriesId
164
167
  });
165
168
  },
166
- children: [/*#__PURE__*/jsxs(ToggleButtonGroup, {
169
+ children: [showTypeSelector && /*#__PURE__*/jsxs(ToggleButtonGroup, {
167
170
  value: type,
168
171
  onChange: setType,
169
172
  children: [/*#__PURE__*/jsx(Button, {
170
173
  size: "sm",
171
174
  variant: "link",
172
- icon: CoreIcons.chartLine,
175
+ icon: "icon-[mdi--chart-line]",
173
176
  value: "line",
174
177
  "aria-label": "line"
175
178
  }), /*#__PURE__*/jsx(Button, {
176
179
  size: "sm",
177
180
  variant: "link",
178
- icon: CoreIcons.chartColumn,
181
+ icon: "icon-[mdi--chart-bar]",
179
182
  value: "column",
180
183
  "aria-label": "column"
181
184
  }), /*#__PURE__*/jsx(Button, {
182
185
  size: "sm",
183
186
  variant: "link",
184
- icon: CoreIcons.chartLineStacked,
187
+ icon: "icon-[mdi--chart-line-stacked]",
185
188
  value: "line-stacked",
186
189
  "aria-label": "line-stacked"
187
190
  }), /*#__PURE__*/jsx(Button, {
188
191
  size: "sm",
189
192
  variant: "link",
190
- icon: CoreIcons.chartColumnStacked,
193
+ icon: "icon-[mdi--chart-bar-stacked]",
191
194
  value: "column-stacked",
192
195
  "aria-label": "column-stacked"
193
196
  })]
194
- }), /*#__PURE__*/jsx(Divider, {
197
+ }), showTypeSelector && showThemeSelector && /*#__PURE__*/jsx(Divider, {
195
198
  vertical: true
196
- }), /*#__PURE__*/jsx(PaletteSelect, {
199
+ }), showThemeSelector && /*#__PURE__*/jsx(PaletteSelect, {
197
200
  theme: theme,
198
201
  onClick: setTheme
199
202
  })]
@@ -202,7 +205,30 @@ var TimeSeriesChart = /*#__PURE__*/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__*/jsx(ChartWrapper, {
@@ -13,7 +13,7 @@ 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 TimeSliderChart = /*#__PURE__*/memo(function (_ref) {
16
- var data = _ref.data,
16
+ var dataSeries = _ref.series,
17
17
  sliderRange = _ref.range,
18
18
  onBrush = _ref.onBrush;
19
19
  var chartRef = useRef(null);
@@ -28,9 +28,9 @@ var TimeSliderChart = /*#__PURE__*/memo(function (_ref) {
28
28
  return onBrush === null || onBrush === void 0 ? void 0 : onBrush(range);
29
29
  }, [onBrush], 100);
30
30
  useEffect(function () {
31
- var _data$, _data;
32
- var defaultStart = data.length > 0 ? data === null || data === void 0 || (_data$ = data[0]) === null || _data$ === void 0 || (_data$ = _data$[0]) === null || _data$ === void 0 ? void 0 : _data$.getTime() : 0;
33
- var defaultEnd = data.length > 0 ? data === null || data === void 0 || (_data = data[data.length - 1]) === null || _data === void 0 || (_data = _data[0]) === null || _data === void 0 ? void 0 : _data.getTime() : 32;
31
+ var _dataSeries$, _dataSeries;
32
+ var defaultStart = dataSeries.length > 0 ? dataSeries === null || dataSeries === void 0 || (_dataSeries$ = dataSeries[0]) === null || _dataSeries$ === void 0 || (_dataSeries$ = _dataSeries$[0]) === null || _dataSeries$ === void 0 ? void 0 : _dataSeries$.getTime() : 0;
33
+ var defaultEnd = dataSeries.length > 0 ? dataSeries === null || dataSeries === void 0 || (_dataSeries = dataSeries[dataSeries.length - 1]) === null || _dataSeries === void 0 || (_dataSeries = _dataSeries[0]) === null || _dataSeries === void 0 ? void 0 : _dataSeries.getTime() : 32;
34
34
  var getRangeValue = function getRangeValue() {
35
35
  var v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
36
36
  var def = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
@@ -40,7 +40,7 @@ var TimeSliderChart = /*#__PURE__*/memo(function (_ref) {
40
40
  startValue: getRangeValue(sliderRange === null || sliderRange === void 0 ? void 0 : sliderRange.start.getTime(), defaultStart),
41
41
  endValue: getRangeValue(sliderRange === null || sliderRange === void 0 ? void 0 : sliderRange.end.getTime(), defaultEnd)
42
42
  });
43
- }, [sliderRange, data]);
43
+ }, [sliderRange, dataSeries]);
44
44
  var enableBrush = useCallback(function () {
45
45
  var _chartRef$current, _chartRef$current2;
46
46
  (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 || _chartRef$current.dispatchAction({
@@ -79,7 +79,7 @@ var TimeSliderChart = /*#__PURE__*/memo(function (_ref) {
79
79
  }
80
80
  }, [chartRef.current, handleBrush], "TimeSldier onBrush");
81
81
  var options = useMemoDebugger(function () {
82
- if (isEmpty(data)) {
82
+ if (isEmpty(dataSeries)) {
83
83
  var _chartRef$current3;
84
84
  (_chartRef$current3 = chartRef.current) === null || _chartRef$current3 === void 0 || _chartRef$current3.clear();
85
85
  return {};
@@ -124,7 +124,7 @@ var TimeSliderChart = /*#__PURE__*/memo(function (_ref) {
124
124
  lineStyle: {
125
125
  width: 2
126
126
  },
127
- data: data
127
+ data: dataSeries
128
128
  }];
129
129
  return {
130
130
  grid: {
@@ -160,7 +160,7 @@ var TimeSliderChart = /*#__PURE__*/memo(function (_ref) {
160
160
  position: "top"
161
161
  }
162
162
  };
163
- }, [data], "TimeSlider options");
163
+ }, [dataSeries], "TimeSlider options");
164
164
  useEffect(function () {
165
165
  setTimeout(function () {
166
166
  var _chartRef$current4;
@@ -178,13 +178,33 @@ var TimeSliderChart = /*#__PURE__*/memo(function (_ref) {
178
178
  return /*#__PURE__*/jsx(ChartContainer, {
179
179
  options: options,
180
180
  chartRef: chartRef,
181
- isEmpty: isEmpty(data)
181
+ isEmpty: isEmpty(dataSeries)
182
182
  });
183
183
  });
184
184
  TimeSliderChart.displayName = "TimeSliderChart";
185
185
 
186
186
  /**
187
- * Chart to display time scale data with zoom and brush */
187
+ * TimeSlider component renders a time slider chart.
188
+ * It allows users to visualize time-based data and interactively select a range.
189
+ * The chart supports brushing to select a specific time range,
190
+ * and it emits an event when the range is changed.
191
+ *
192
+ * @param {TimeSliderProps} props - The properties for the TimeSlider component.
193
+ * @returns {JSX.Element} The rendered TimeSlider component.
194
+ *
195
+ * @example
196
+ * ```jsx
197
+ * <TimeSlider
198
+ * data={data}
199
+ * range={{ start: new Date("2023-01-01"), end: new Date("2023-12-31") }}
200
+ * onBrush={(range) => console.log("Selected range:", range)}
201
+ * />
202
+ * ```
203
+ *
204
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-timeslider--docs} for more details on the properties.
205
+ * @see {@link https://echarts.apache.org/en/option.html#dataZoom} for more details on the ECharts dataZoom feature.
206
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for more details on the ECharts line series.
207
+ */
188
208
  var TimeSlider = function TimeSlider(props) {
189
209
  return /*#__PURE__*/jsx(ChartWrapper, {
190
210
  children: /*#__PURE__*/jsx(TimeSliderChart, _objectSpread({}, props))
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
- import { useIsDark, useMemoDebugger, CoreIcons } from '@react-fabric/core';
4
+ import { useIsDark, useMemoDebugger } from '@react-fabric/core';
5
5
  import { isEmpty, compareValues } from '@react-fabric/utilities';
6
6
  import { memo } from 'react';
7
7
  import { ChartPalette } from '../theme/palettes.js';
@@ -13,16 +13,22 @@ 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,
26
+ tooltip: {
27
+ trigger: "axis",
28
+ confine: true,
29
+ position: "top",
30
+ appendToBody: true
31
+ },
26
32
  series: [{
27
33
  name: title,
28
34
  type: "wordCloud",
@@ -41,7 +47,7 @@ var WordBubbleChart = /*#__PURE__*/memo(function (_ref) {
41
47
  return palette[dataIndex % palette.length];
42
48
  }
43
49
  },
44
- data: data.sort(compareValues("desc", "count")).map(function (_ref3, index) {
50
+ data: series.sort(compareValues("desc", "count")).map(function (_ref3, index) {
45
51
  var key = _ref3.id,
46
52
  label = _ref3.label,
47
53
  count = _ref3.count;
@@ -52,13 +58,13 @@ var WordBubbleChart = /*#__PURE__*/memo(function (_ref) {
52
58
  })
53
59
  }]
54
60
  };
55
- }, [data, title, isDark], "WordChart options");
61
+ }, [series, title, isDark], "WordChart options");
56
62
  return /*#__PURE__*/jsx(ChartContainer, {
57
63
  title: title,
58
64
  onExport: onExport,
59
65
  options: options,
60
- isEmpty: isEmpty(data),
61
- emptyIcon: CoreIcons.chartActivityScatter,
66
+ isEmpty: isEmpty(series),
67
+ emptyIcon: "icon-[mdi--chart-bubble]",
62
68
  dataTableRenderer: countRenderer,
63
69
  onClick: function onClick(e) {
64
70
  var _e$name;
@@ -69,7 +75,31 @@ var WordBubbleChart = /*#__PURE__*/memo(function (_ref) {
69
75
  WordBubbleChart.displayName = "WordBubbleChart";
70
76
 
71
77
  /**
72
- * Chart to display simple word cloud
78
+ * WordBubble component renders a word cloud chart using ECharts.
79
+ * It displays words with sizes proportional to their frequency in the data.
80
+ * Users can click on words to trigger an action, such as filtering or navigating.
81
+ * It also supports exporting the chart and displays an empty state when no data is available.
82
+ *
83
+ * @param {WordBubbleProps} props - The properties for the WordBubble component.
84
+ * @returns {JSX.Element} The rendered WordBubble component.
85
+ *
86
+ * @example
87
+ * ```jsx
88
+ * <WordBubble
89
+ * data={[
90
+ * { id: "1", label: "Word One", count: 10 },
91
+ * { id: "2", label: "Word Two", count: 20 },
92
+ * { id: "3", label: "Word Three", count: 30 },
93
+ * ]}
94
+ * title="Word Frequency"
95
+ * onExport={() => console.log("Exporting chart...")}
96
+ * onClick={(key) => console.log("Clicked word:", key)}
97
+ * theme="light"
98
+ * />
99
+ * ```
100
+ *
101
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-wordbubble--docs} for the properties that can be passed to this component.
102
+ * @see {@link https://github.com/ecomfe/echarts-wordcloud} for the underlying chart implementation.
73
103
  */
74
104
  var WordBubble = function WordBubble(props) {
75
105
  return /*#__PURE__*/jsx(ChartWrapper, {
@@ -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: {
@@ -309,11 +309,6 @@ var DarkThemeBase = {
309
309
  }
310
310
  }
311
311
  },
312
- visualMap: {
313
- textStyle: {
314
- color: "#eee"
315
- }
316
- },
317
312
  toolbox: {
318
313
  iconStyle: {
319
314
  borderColor: "#999999"
@@ -326,9 +321,17 @@ var DarkThemeBase = {
326
321
  },
327
322
  legend: {
328
323
  inactiveColor: "rgb(192 192 192 / .75)",
324
+ itemHeight: 8,
329
325
  textStyle: {
326
+ fontSize: 10,
330
327
  color: "#5d6d7d6"
331
- }
328
+ },
329
+ pageTextStyle: {
330
+ fontSize: 8
331
+ },
332
+ pageIconSize: 8,
333
+ pageIconColor: "#6997A3",
334
+ pageIconInactiveColor: "#474B4A"
332
335
  },
333
336
  tooltip: {
334
337
  backgroundColor: "#0C141D",