@react-fabric/chart 1.0.0-beta.51 → 1.0.0-beta.52

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 (34) hide show
  1. package/dist/cjs/charts/ActivityMap.js +22 -1
  2. package/dist/cjs/charts/CountSeries.js +27 -1
  3. package/dist/cjs/charts/DataSeries.js +26 -1
  4. package/dist/cjs/charts/Generic.js +14 -0
  5. package/dist/cjs/charts/MapSeries.js +24 -1
  6. package/dist/cjs/charts/TimeSeries.js +24 -1
  7. package/dist/cjs/charts/TimeSlider.js +21 -1
  8. package/dist/cjs/charts/WordBubble.js +25 -1
  9. package/dist/esm/charts/ActivityMap.js +22 -1
  10. package/dist/esm/charts/CountSeries.js +27 -1
  11. package/dist/esm/charts/DataSeries.js +26 -1
  12. package/dist/esm/charts/Generic.js +14 -0
  13. package/dist/esm/charts/MapSeries.js +24 -1
  14. package/dist/esm/charts/TimeSeries.js +24 -1
  15. package/dist/esm/charts/TimeSlider.js +21 -1
  16. package/dist/esm/charts/WordBubble.js +25 -1
  17. package/dist/types/charts/ActivityMap.d.ts +22 -1
  18. package/dist/types/charts/CountSeries.d.ts +27 -1
  19. package/dist/types/charts/DataSeries.d.ts +26 -1
  20. package/dist/types/charts/Generic.d.ts +13 -0
  21. package/dist/types/charts/MapSeries.d.ts +24 -1
  22. package/dist/types/charts/TimeSeries.d.ts +24 -1
  23. package/dist/types/charts/TimeSlider.d.ts +21 -1
  24. package/dist/types/charts/WordBubble.d.ts +25 -1
  25. package/dist/types/types/world.svg.d.ts +1 -1
  26. package/package.json +4 -4
  27. package/src/charts/ActivityMap.tsx +22 -1
  28. package/src/charts/CountSeries.tsx +27 -1
  29. package/src/charts/DataSeries.tsx +26 -1
  30. package/src/charts/Generic.tsx +13 -0
  31. package/src/charts/MapSeries.tsx +24 -1
  32. package/src/charts/TimeSeries.tsx +24 -1
  33. package/src/charts/TimeSlider.tsx +21 -1
  34. package/src/charts/WordBubble.tsx +25 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/chart",
3
- "version": "1.0.0-beta.51",
3
+ "version": "1.0.0-beta.52",
4
4
  "description": "RUF: Charting package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -35,8 +35,8 @@
35
35
  "watch": "npm-run-all -p watch:rollup watch:dts"
36
36
  },
37
37
  "dependencies": {
38
- "@react-fabric/core": "^1.0.0-beta.51",
39
- "@react-fabric/utilities": "^1.0.0-beta.50",
38
+ "@react-fabric/core": "^1.0.0-beta.52",
39
+ "@react-fabric/utilities": "^1.0.0-beta.52",
40
40
  "classnames": "^2.5.1",
41
41
  "color": "^4.2.3",
42
42
  "date-fns": "^4.0.0",
@@ -56,5 +56,5 @@
56
56
  "node": ">=18.12.0",
57
57
  "npm": ">=8.19.0"
58
58
  },
59
- "gitHead": "a1b04de4663045f82992bff2aef8db26608eac74"
59
+ "gitHead": "0eabb9d88d91af93d657bcc209b226fd576e8260"
60
60
  }
@@ -286,7 +286,28 @@ const ActivityMapChart = memo(
286
286
  ActivityMapChart.displayName = "ActivityMapChart";
287
287
 
288
288
  /**
289
- * Chart showing activity map
289
+ * ActivityMap component renders a chart that visualizes activity data
290
+ * over time, using either a scatter plot or a heatmap.
291
+ * It allows users to switch between different types of visualizations
292
+ * and customize the color palette used in the chart.
293
+ *
294
+ * @param {ActivityMapProps} props - The properties for the ActivityMap component.
295
+ * @returns {JSX.Element} The rendered ActivityMap component.
296
+ *
297
+ * @example
298
+ * ```jsx
299
+ * <ActivityMap
300
+ * data={activityData}
301
+ * time="day-hour"
302
+ * type="heatmap"
303
+ * heatmapPalette={["#f0f8ff", "#faebd7", "#00ffff", "#7fffd4"]}
304
+ * highLabels={["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]}
305
+ * lowLabels={["12a", "1a", "2a", "3a", "4a", "5a", "6a", "7a", "8a", "9a", "10a", "11a", "12p", "1p", "2p", "3p", "4p", "5p", "6p", "7p", "8p", "9p", "10p", "11p"]}
306
+ * onClick={(highIndex, lowIndex) => console.log(`Clicked on: ${highIndex}, ${lowIndex}`)}
307
+ * />
308
+ * ```
309
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-activitymap--docs} for more details on the properties.
310
+ * @see {@link https://echarts.apache.org/en/option.html#series-scatter} for more details on the ECharts scatter series.
290
311
  */
291
312
  export const ActivityMap: FC<ActivityMapProps> = (props) => (
292
313
  <ChartWrapper>
@@ -177,7 +177,33 @@ const CountSeriesChart: FC<CountSeriesProps> = memo(
177
177
  CountSeriesChart.displayName = "CountSeriesChart";
178
178
 
179
179
  /**
180
- * Chart to display simple data count series
180
+ * CountSeries component renders a chart that displays counts of items in various formats.
181
+ * It supports pie, bar, and column charts.
182
+ * It can be used to visualize the distribution of counts across different categories.
183
+ * It allows users to switch between different types of visualizations and customize the color palette used in the chart.
184
+ *
185
+ * @param {CountSeriesProps} props - The properties for the CountSeries component.
186
+ * @returns {JSX.Element} The rendered CountSeries component.
187
+ *
188
+ * @example
189
+ * ```jsx
190
+ * <CountSeries
191
+ * data={[
192
+ * { id: "A", label: "Category A", count: 10 },
193
+ * { id: "B", label: "Category B", count: 20 },
194
+ * { id: "C", label: "Category C", count: 30 },
195
+ * ]}
196
+ * title="Count Distribution"
197
+ * onExport={() => console.log("Exporting chart data")}
198
+ * theme="light"
199
+ * type="pie"
200
+ * onClick={(key) => console.log("Clicked on:", key)}
201
+ * />
202
+ * ```
203
+ *
204
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-countseries--docs} for more details on the properties.
205
+ * @see {@link https://echarts.apache.org/en/option.html#series-pie} for more details on the ECharts pie series options.
206
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for more details on the ECharts bar series options.
181
207
  */
182
208
  export const CountSeries: FC<CountSeriesProps> = (props) => (
183
209
  <ChartWrapper>
@@ -219,7 +219,32 @@ const DataSeriesChart: FC<DataSeriesProps> = memo(
219
219
  DataSeriesChart.displayName = "DataSeriesChart";
220
220
 
221
221
  /**
222
- * Chart to display simple data category series
222
+ * DataSeries component renders a chart for visualizing data series.
223
+ * It supports various chart types such as column, line, bar, radar, and stacked variants.
224
+ * It allows users to click on data points to trigger custom actions.
225
+ *
226
+ * @param {DataSeriesProps} props - The properties for the DataSeries component.
227
+ * @returns {JSX.Element} The rendered DataSeries component.
228
+ *
229
+ * @example
230
+ * ```jsx
231
+ * <DataSeries
232
+ * data={[{ id: "1", label: "Series 1", values: [10, 20, 30] }]}
233
+ * categories={["Category 1", "Category 2", "Category 3"]}
234
+ * categoryAxisName="Categories"
235
+ * valueAxisName="Values"
236
+ * title="Data Series Example"
237
+ * type="column"
238
+ * onClick={(data) => console.log("Clicked data:", data)}
239
+ * onExport={() => console.log("Exporting chart data")}
240
+ * theme="light"
241
+ * />
242
+ * ```
243
+ *
244
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-dataseries--docs} for more details on the properties.
245
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for ECharts bar series options.
246
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for ECharts line series options.
247
+ * @see {@link https://echarts.apache.org/en/option.html#series-radar} for ECharts radar series options.
223
248
  */
224
249
  export const DataSeries: FC<DataSeriesProps> = (props) => (
225
250
  <ChartWrapper>
@@ -183,6 +183,19 @@ const GenericChartBase: FC<GenericProps> = memo(
183
183
  );
184
184
  GenericChartBase.displayName = "GenericChart";
185
185
 
186
+ /**
187
+ * GenericChart component renders a generic chart using ECharts.
188
+ * It accepts various chart options and configurations, allowing for flexible chart rendering.
189
+ * It supports click events, brush events, and custom actions.
190
+ * It can be used to create a wide range of chart types by passing the appropriate ECharts options.
191
+ *
192
+ * @param props - The properties for the GenericChart component, including chart options, event handlers, and custom actions.
193
+ * @returns A React functional component that renders the chart within a ChartWrapper.
194
+ *
195
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-genericchart--docs} for more details on the properties.
196
+ * @see {@link https://echarts.apache.org/en/option.html} for ECharts options documentation.
197
+ * @see {@link https://echarts.apache.org/en/api.html#echartsInstance} for ECharts instance methods and properties.
198
+ */
186
199
  export const GenericChart: FC<GenericProps> = (props) => (
187
200
  <ChartWrapper>
188
201
  <GenericChartBase {...props} />
@@ -208,7 +208,30 @@ const MapSeriesChart: FC<MapSeriesProps> = memo(
208
208
  MapSeriesChart.displayName = "MapSeriesChart";
209
209
 
210
210
  /**
211
- * Chart to display simple map data series
211
+ * MapSeries component renders a map chart using ECharts.
212
+ * It displays data on a world map, allowing users to visualize counts or other metrics by country.
213
+ * It supports zooming and switching between map and column views.
214
+ *
215
+ * @param {MapSeriesProps} props - The properties for the MapSeries component.
216
+ * @returns {JSX.Element} The rendered MapSeries component.
217
+ *
218
+ * @example
219
+ * ```jsx
220
+ * <MapSeries
221
+ * data={[
222
+ * { id: "US", label: "United States", count: 100 },
223
+ * { id: "IN", label: "India", count: 200 },
224
+ * { id: "CN", label: "China", count: 300 },
225
+ * ]}
226
+ * onExport={() => console.log("Exporting chart")}
227
+ * title="World Map Series"
228
+ * onClick={(key) => console.log("Clicked country:", key)}
229
+ * theme="light"
230
+ * />
231
+ * ```
232
+ *
233
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-mapseries--docs} for more details on the properties.
234
+ * @see {@link https://echarts.apache.org/en/option.html#series-map} for ECharts map series options documentation.
212
235
  */
213
236
  export const MapSeries: FC<MapSeriesProps> = (props) => (
214
237
  <ChartWrapper>
@@ -227,7 +227,30 @@ const TimeSeriesChart: FC<TimeSeriesProps> = memo(
227
227
  TimeSeriesChart.displayName = "TimeSeriesChart";
228
228
 
229
229
  /**
230
- * Chart to display simple data time series
230
+ * TimeSeries component renders a time series chart using the provided data and options.
231
+ * It supports different chart types such as line, column, and stacked variants.
232
+ * It also allows for interaction through click and brush events.
233
+ *
234
+ * @param {TimeSeriesProps} props - The properties for the TimeSeries component.
235
+ * @returns {JSX.Element} The rendered TimeSeries component.
236
+ *
237
+ * @example
238
+ * ```jsx
239
+ * <TimeSeries
240
+ * data={data}
241
+ * onExport={handleExport}
242
+ * categoryAxisName="Time"
243
+ * valueAxisName="Value"
244
+ * title="Time Series Chart"
245
+ * type="line"
246
+ * onClick={(data) => console.log(data)}
247
+ * onBrush={(range) => console.log(range)}
248
+ * />
249
+ * ```
250
+ *
251
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-timeseries--docs} for more details on the properties.
252
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for more details on the ECharts line series options.
253
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for more details on the ECharts bar series options.
231
254
  */
232
255
  export const TimeSeries: FC<TimeSeriesProps> = (props) => (
233
256
  <ChartWrapper>
@@ -227,7 +227,27 @@ const TimeSliderChart: FC<TimeSliderProps> = memo(
227
227
  TimeSliderChart.displayName = "TimeSliderChart";
228
228
 
229
229
  /**
230
- * Chart to display time scale data with zoom and brush */
230
+ * TimeSlider component renders a time slider chart.
231
+ * It allows users to visualize time-based data and interactively select a range.
232
+ * The chart supports brushing to select a specific time range,
233
+ * and it emits an event when the range is changed.
234
+ *
235
+ * @param {TimeSliderProps} props - The properties for the TimeSlider component.
236
+ * @returns {JSX.Element} The rendered TimeSlider component.
237
+ *
238
+ * @example
239
+ * ```jsx
240
+ * <TimeSlider
241
+ * data={data}
242
+ * range={{ start: new Date("2023-01-01"), end: new Date("2023-12-31") }}
243
+ * onBrush={(range) => console.log("Selected range:", range)}
244
+ * />
245
+ * ```
246
+ *
247
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-timeslider--docs} for more details on the properties.
248
+ * @see {@link https://echarts.apache.org/en/option.html#dataZoom} for more details on the ECharts dataZoom feature.
249
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for more details on the ECharts line series.
250
+ */
231
251
  export const TimeSlider: FC<TimeSliderProps> = (props) => (
232
252
  <ChartWrapper>
233
253
  <TimeSliderChart {...props} />
@@ -96,7 +96,31 @@ const WordBubbleChart: FC<WordBubbleProps> = memo(
96
96
  WordBubbleChart.displayName = "WordBubbleChart";
97
97
 
98
98
  /**
99
- * Chart to display simple word cloud
99
+ * WordBubble component renders a word cloud chart using ECharts.
100
+ * It displays words with sizes proportional to their frequency in the data.
101
+ * Users can click on words to trigger an action, such as filtering or navigating.
102
+ * It also supports exporting the chart and displays an empty state when no data is available.
103
+ *
104
+ * @param {WordBubbleProps} props - The properties for the WordBubble component.
105
+ * @returns {JSX.Element} The rendered WordBubble component.
106
+ *
107
+ * @example
108
+ * ```jsx
109
+ * <WordBubble
110
+ * data={[
111
+ * { id: "1", label: "Word One", count: 10 },
112
+ * { id: "2", label: "Word Two", count: 20 },
113
+ * { id: "3", label: "Word Three", count: 30 },
114
+ * ]}
115
+ * title="Word Frequency"
116
+ * onExport={() => console.log("Exporting chart...")}
117
+ * onClick={(key) => console.log("Clicked word:", key)}
118
+ * theme="light"
119
+ * />
120
+ * ```
121
+ *
122
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-wordbubble--docs} for the properties that can be passed to this component.
123
+ * @see {@link https://github.com/ecomfe/echarts-wordcloud} for the underlying chart implementation.
100
124
  */
101
125
  export const WordBubble: FC<WordBubbleProps> = (props) => (
102
126
  <ChartWrapper>