@react-fabric/chart 1.0.0-beta.5 → 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 (46) hide show
  1. package/{src/wrapper/Chart.module.css → css/_chart.css} +5 -5
  2. package/css/styles.css +24 -0
  3. package/dist/cjs/charts/ActivityMap.js +22 -1
  4. package/dist/cjs/charts/CountSeries.js +27 -1
  5. package/dist/cjs/charts/DataSeries.js +26 -1
  6. package/dist/cjs/charts/Generic.js +14 -0
  7. package/dist/cjs/charts/MapSeries.js +24 -1
  8. package/dist/cjs/charts/TimeSeries.js +24 -1
  9. package/dist/cjs/charts/TimeSlider.js +21 -1
  10. package/dist/cjs/charts/WordBubble.js +25 -1
  11. package/dist/cjs/wrapper/ChartContainer.js +1 -2
  12. package/dist/cjs/wrapper/ChartToolbar.js +1 -2
  13. package/dist/esm/charts/ActivityMap.js +22 -1
  14. package/dist/esm/charts/CountSeries.js +27 -1
  15. package/dist/esm/charts/DataSeries.js +26 -1
  16. package/dist/esm/charts/Generic.js +14 -0
  17. package/dist/esm/charts/MapSeries.js +24 -1
  18. package/dist/esm/charts/TimeSeries.js +24 -1
  19. package/dist/esm/charts/TimeSlider.js +21 -1
  20. package/dist/esm/charts/WordBubble.js +25 -1
  21. package/dist/esm/wrapper/ChartContainer.js +1 -2
  22. package/dist/esm/wrapper/ChartToolbar.js +1 -2
  23. package/dist/types/charts/ActivityMap.d.ts +22 -1
  24. package/dist/types/charts/CountSeries.d.ts +27 -1
  25. package/dist/types/charts/DataSeries.d.ts +26 -1
  26. package/dist/types/charts/Generic.d.ts +15 -2
  27. package/dist/types/charts/MapSeries.d.ts +24 -1
  28. package/dist/types/charts/TimeSeries.d.ts +24 -1
  29. package/dist/types/charts/TimeSlider.d.ts +21 -1
  30. package/dist/types/charts/WordBubble.d.ts +25 -1
  31. package/dist/types/types/world.svg.d.ts +1 -1
  32. package/dist/types/wrapper/ChartContainer.d.ts +2 -2
  33. package/dist/types/wrapper/ChartWrapper.d.ts +0 -1
  34. package/package.json +11 -9
  35. package/src/charts/ActivityMap.tsx +22 -1
  36. package/src/charts/CountSeries.tsx +27 -1
  37. package/src/charts/DataSeries.tsx +26 -1
  38. package/src/charts/Generic.tsx +15 -2
  39. package/src/charts/MapSeries.tsx +24 -1
  40. package/src/charts/TimeSeries.tsx +24 -1
  41. package/src/charts/TimeSlider.tsx +21 -1
  42. package/src/charts/WordBubble.tsx +25 -1
  43. package/src/wrapper/ChartContainer.tsx +3 -4
  44. package/src/wrapper/ChartToolbar.tsx +1 -2
  45. package/dist/cjs/wrapper/Chart.module.css +0 -1
  46. package/dist/esm/wrapper/Chart.module.css +0 -1
@@ -16,6 +16,27 @@ export interface ActivityMapProps extends BaseChart {
16
16
  onClick?: (highIndex: number, lowIndex: number) => void;
17
17
  }
18
18
  /**
19
- * Chart showing activity map
19
+ * ActivityMap component renders a chart that visualizes activity data
20
+ * over time, using either a scatter plot or a heatmap.
21
+ * It allows users to switch between different types of visualizations
22
+ * and customize the color palette used in the chart.
23
+ *
24
+ * @param {ActivityMapProps} props - The properties for the ActivityMap component.
25
+ * @returns {JSX.Element} The rendered ActivityMap component.
26
+ *
27
+ * @example
28
+ * ```jsx
29
+ * <ActivityMap
30
+ * data={activityData}
31
+ * time="day-hour"
32
+ * type="heatmap"
33
+ * heatmapPalette={["#f0f8ff", "#faebd7", "#00ffff", "#7fffd4"]}
34
+ * highLabels={["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]}
35
+ * 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"]}
36
+ * onClick={(highIndex, lowIndex) => console.log(`Clicked on: ${highIndex}, ${lowIndex}`)}
37
+ * />
38
+ * ```
39
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-activitymap--docs} for more details on the properties.
40
+ * @see {@link https://echarts.apache.org/en/option.html#series-scatter} for more details on the ECharts scatter series.
20
41
  */
21
42
  export declare const ActivityMap: FC<ActivityMapProps>;
@@ -5,6 +5,32 @@ export interface CountSeriesProps extends BaseChart, CountType {
5
5
  onClick?: (key: string) => void;
6
6
  }
7
7
  /**
8
- * Chart to display simple data count series
8
+ * CountSeries component renders a chart that displays counts of items in various formats.
9
+ * It supports pie, bar, and column charts.
10
+ * It can be used to visualize the distribution of counts across different categories.
11
+ * It allows users to switch between different types of visualizations and customize the color palette used in the chart.
12
+ *
13
+ * @param {CountSeriesProps} props - The properties for the CountSeries component.
14
+ * @returns {JSX.Element} The rendered CountSeries component.
15
+ *
16
+ * @example
17
+ * ```jsx
18
+ * <CountSeries
19
+ * data={[
20
+ * { id: "A", label: "Category A", count: 10 },
21
+ * { id: "B", label: "Category B", count: 20 },
22
+ * { id: "C", label: "Category C", count: 30 },
23
+ * ]}
24
+ * title="Count Distribution"
25
+ * onExport={() => console.log("Exporting chart data")}
26
+ * theme="light"
27
+ * type="pie"
28
+ * onClick={(key) => console.log("Clicked on:", key)}
29
+ * />
30
+ * ```
31
+ *
32
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-countseries--docs} for more details on the properties.
33
+ * @see {@link https://echarts.apache.org/en/option.html#series-pie} for more details on the ECharts pie series options.
34
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for more details on the ECharts bar series options.
9
35
  */
10
36
  export declare const CountSeries: FC<CountSeriesProps>;
@@ -8,6 +8,31 @@ export interface DataSeriesProps extends BaseChart, SeriesType {
8
8
  }) => void;
9
9
  }
10
10
  /**
11
- * Chart to display simple data category series
11
+ * DataSeries component renders a chart for visualizing data series.
12
+ * It supports various chart types such as column, line, bar, radar, and stacked variants.
13
+ * It allows users to click on data points to trigger custom actions.
14
+ *
15
+ * @param {DataSeriesProps} props - The properties for the DataSeries component.
16
+ * @returns {JSX.Element} The rendered DataSeries component.
17
+ *
18
+ * @example
19
+ * ```jsx
20
+ * <DataSeries
21
+ * data={[{ id: "1", label: "Series 1", values: [10, 20, 30] }]}
22
+ * categories={["Category 1", "Category 2", "Category 3"]}
23
+ * categoryAxisName="Categories"
24
+ * valueAxisName="Values"
25
+ * title="Data Series Example"
26
+ * type="column"
27
+ * onClick={(data) => console.log("Clicked data:", data)}
28
+ * onExport={() => console.log("Exporting chart data")}
29
+ * theme="light"
30
+ * />
31
+ * ```
32
+ *
33
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-dataseries--docs} for more details on the properties.
34
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for ECharts bar series options.
35
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for ECharts line series options.
36
+ * @see {@link https://echarts.apache.org/en/option.html#series-radar} for ECharts radar series options.
12
37
  */
13
38
  export declare const DataSeries: FC<DataSeriesProps>;
@@ -1,8 +1,8 @@
1
1
  import { type EChartOption, type EChartsType } from "echarts";
2
- import { type FC, type RefObject } from "react";
2
+ import { type FC, type Ref } from "react";
3
3
  import { type BaseChart } from "../types";
4
4
  export interface GenericProps extends BaseChart {
5
- chartRef?: RefObject<EChartsType>;
5
+ chartRef?: Ref<EChartsType>;
6
6
  legend?: EChartOption["legend"];
7
7
  toolbox?: EChartOption["toolbox"];
8
8
  tooltip?: EChartOption["tooltip"];
@@ -53,4 +53,17 @@ export interface GenericProps extends BaseChart {
53
53
  */
54
54
  dataTableRenderer?: (chartOption: EChartOption) => string;
55
55
  }
56
+ /**
57
+ * GenericChart component renders a generic chart using ECharts.
58
+ * It accepts various chart options and configurations, allowing for flexible chart rendering.
59
+ * It supports click events, brush events, and custom actions.
60
+ * It can be used to create a wide range of chart types by passing the appropriate ECharts options.
61
+ *
62
+ * @param props - The properties for the GenericChart component, including chart options, event handlers, and custom actions.
63
+ * @returns A React functional component that renders the chart within a ChartWrapper.
64
+ *
65
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-genericchart--docs} for more details on the properties.
66
+ * @see {@link https://echarts.apache.org/en/option.html} for ECharts options documentation.
67
+ * @see {@link https://echarts.apache.org/en/api.html#echartsInstance} for ECharts instance methods and properties.
68
+ */
56
69
  export declare const GenericChart: FC<GenericProps>;
@@ -4,6 +4,29 @@ export interface MapSeriesProps extends BaseChart, CountType {
4
4
  onClick?: (key: string) => void;
5
5
  }
6
6
  /**
7
- * Chart to display simple map data series
7
+ * MapSeries component renders a map chart using ECharts.
8
+ * It displays data on a world map, allowing users to visualize counts or other metrics by country.
9
+ * It supports zooming and switching between map and column views.
10
+ *
11
+ * @param {MapSeriesProps} props - The properties for the MapSeries component.
12
+ * @returns {JSX.Element} The rendered MapSeries component.
13
+ *
14
+ * @example
15
+ * ```jsx
16
+ * <MapSeries
17
+ * data={[
18
+ * { id: "US", label: "United States", count: 100 },
19
+ * { id: "IN", label: "India", count: 200 },
20
+ * { id: "CN", label: "China", count: 300 },
21
+ * ]}
22
+ * onExport={() => console.log("Exporting chart")}
23
+ * title="World Map Series"
24
+ * onClick={(key) => console.log("Clicked country:", key)}
25
+ * theme="light"
26
+ * />
27
+ * ```
28
+ *
29
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-mapseries--docs} for more details on the properties.
30
+ * @see {@link https://echarts.apache.org/en/option.html#series-map} for ECharts map series options documentation.
8
31
  */
9
32
  export declare const MapSeries: FC<MapSeriesProps>;
@@ -12,6 +12,29 @@ export interface TimeSeriesProps extends BaseChart, TimeSeriesType {
12
12
  }) => void;
13
13
  }
14
14
  /**
15
- * Chart to display simple data time series
15
+ * TimeSeries component renders a time series chart using the provided data and options.
16
+ * It supports different chart types such as line, column, and stacked variants.
17
+ * It also allows for interaction through click and brush events.
18
+ *
19
+ * @param {TimeSeriesProps} props - The properties for the TimeSeries component.
20
+ * @returns {JSX.Element} The rendered TimeSeries component.
21
+ *
22
+ * @example
23
+ * ```jsx
24
+ * <TimeSeries
25
+ * data={data}
26
+ * onExport={handleExport}
27
+ * categoryAxisName="Time"
28
+ * valueAxisName="Value"
29
+ * title="Time Series Chart"
30
+ * type="line"
31
+ * onClick={(data) => console.log(data)}
32
+ * onBrush={(range) => console.log(range)}
33
+ * />
34
+ * ```
35
+ *
36
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-timeseries--docs} for more details on the properties.
37
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for more details on the ECharts line series options.
38
+ * @see {@link https://echarts.apache.org/en/option.html#series-bar} for more details on the ECharts bar series options.
16
39
  */
17
40
  export declare const TimeSeries: FC<TimeSeriesProps>;
@@ -12,5 +12,25 @@ export interface TimeSliderProps extends BaseChart {
12
12
  }) => void;
13
13
  }
14
14
  /**
15
- * Chart to display time scale data with zoom and brush */
15
+ * TimeSlider component renders a time slider chart.
16
+ * It allows users to visualize time-based data and interactively select a range.
17
+ * The chart supports brushing to select a specific time range,
18
+ * and it emits an event when the range is changed.
19
+ *
20
+ * @param {TimeSliderProps} props - The properties for the TimeSlider component.
21
+ * @returns {JSX.Element} The rendered TimeSlider component.
22
+ *
23
+ * @example
24
+ * ```jsx
25
+ * <TimeSlider
26
+ * data={data}
27
+ * range={{ start: new Date("2023-01-01"), end: new Date("2023-12-31") }}
28
+ * onBrush={(range) => console.log("Selected range:", range)}
29
+ * />
30
+ * ```
31
+ *
32
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-timeslider--docs} for more details on the properties.
33
+ * @see {@link https://echarts.apache.org/en/option.html#dataZoom} for more details on the ECharts dataZoom feature.
34
+ * @see {@link https://echarts.apache.org/en/option.html#series-line} for more details on the ECharts line series.
35
+ */
16
36
  export declare const TimeSlider: FC<TimeSliderProps>;
@@ -4,6 +4,30 @@ export interface WordBubbleProps extends Omit<BaseChart, "theme">, CountType {
4
4
  onClick?: (key: string) => void;
5
5
  }
6
6
  /**
7
- * Chart to display simple word cloud
7
+ * WordBubble component renders a word cloud chart using ECharts.
8
+ * It displays words with sizes proportional to their frequency in the data.
9
+ * Users can click on words to trigger an action, such as filtering or navigating.
10
+ * It also supports exporting the chart and displays an empty state when no data is available.
11
+ *
12
+ * @param {WordBubbleProps} props - The properties for the WordBubble component.
13
+ * @returns {JSX.Element} The rendered WordBubble component.
14
+ *
15
+ * @example
16
+ * ```jsx
17
+ * <WordBubble
18
+ * data={[
19
+ * { id: "1", label: "Word One", count: 10 },
20
+ * { id: "2", label: "Word Two", count: 20 },
21
+ * { id: "3", label: "Word Three", count: 30 },
22
+ * ]}
23
+ * title="Word Frequency"
24
+ * onExport={() => console.log("Exporting chart...")}
25
+ * onClick={(key) => console.log("Clicked word:", key)}
26
+ * theme="light"
27
+ * />
28
+ * ```
29
+ *
30
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-wordbubble--docs} for the properties that can be passed to this component.
31
+ * @see {@link https://github.com/ecomfe/echarts-wordcloud} for the underlying chart implementation.
8
32
  */
9
33
  export declare const WordBubble: FC<WordBubbleProps>;