@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.
- package/{src/wrapper/Chart.module.css → css/_chart.css} +7 -7
- package/css/styles.css +24 -0
- package/dist/cjs/charts/ActivityMap.js +61 -30
- package/dist/cjs/charts/CountSeries.js +56 -26
- package/dist/cjs/charts/DataSeries.js +64 -36
- package/dist/cjs/charts/Generic.js +29 -5
- package/dist/cjs/charts/MapSeries.js +35 -11
- package/dist/cjs/charts/TimeSeries.js +60 -34
- package/dist/cjs/charts/TimeSlider.js +30 -10
- package/dist/cjs/charts/WordBubble.js +37 -7
- package/dist/cjs/theme/darkBase.js +13 -10
- package/dist/cjs/theme/index.js +38 -18
- package/dist/cjs/theme/lightBase.js +18 -15
- package/dist/cjs/theme/palettes.js +27 -27
- package/dist/cjs/types/charts.js +2 -2
- package/dist/cjs/types/utils.js +1 -4
- package/dist/cjs/wrapper/ChartContainer.js +12 -9
- package/dist/cjs/wrapper/ChartToolbar.js +1 -2
- package/dist/cjs/wrapper/PaletteSelect.js +1 -1
- package/dist/esm/charts/ActivityMap.js +62 -31
- package/dist/esm/charts/CountSeries.js +57 -27
- package/dist/esm/charts/DataSeries.js +65 -37
- package/dist/esm/charts/Generic.js +31 -7
- package/dist/esm/charts/MapSeries.js +36 -12
- package/dist/esm/charts/TimeSeries.js +61 -35
- package/dist/esm/charts/TimeSlider.js +30 -10
- package/dist/esm/charts/WordBubble.js +38 -8
- package/dist/esm/theme/darkBase.js +13 -10
- package/dist/esm/theme/index.js +38 -18
- package/dist/esm/theme/lightBase.js +18 -15
- package/dist/esm/theme/palettes.js +27 -27
- package/dist/esm/types/charts.js +2 -2
- package/dist/esm/types/utils.js +1 -4
- package/dist/esm/wrapper/ChartContainer.js +13 -10
- package/dist/esm/wrapper/ChartToolbar.js +1 -2
- package/dist/esm/wrapper/PaletteSelect.js +2 -2
- package/dist/types/charts/ActivityMap.d.ts +23 -2
- package/dist/types/charts/CountSeries.d.ts +28 -1
- package/dist/types/charts/DataSeries.d.ts +26 -1
- package/dist/types/charts/Generic.d.ts +29 -41
- package/dist/types/charts/MapSeries.d.ts +31 -3
- package/dist/types/charts/TimeSeries.d.ts +24 -1
- package/dist/types/charts/TimeSlider.d.ts +22 -2
- package/dist/types/charts/WordBubble.d.ts +32 -3
- package/dist/types/theme/darkBase.d.ts +8 -5
- package/dist/types/theme/index.d.ts +1 -1
- package/dist/types/theme/lightBase.d.ts +8 -5
- package/dist/types/types/charts.d.ts +1 -1
- package/dist/types/types/index.d.ts +30 -12
- package/dist/types/types/world.svg.d.ts +1 -1
- package/dist/types/wrapper/ChartContainer.d.ts +4 -4
- package/dist/types/wrapper/ChartWrapper.d.ts +0 -1
- package/package.json +15 -16
- package/src/charts/ActivityMap.tsx +104 -60
- package/src/charts/CountSeries.tsx +89 -50
- package/src/charts/DataSeries.tsx +127 -78
- package/src/charts/Generic.tsx +43 -51
- package/src/charts/MapSeries.tsx +61 -33
- package/src/charts/TimeSeries.tsx +116 -79
- package/src/charts/TimeSlider.tsx +38 -15
- package/src/charts/WordBubble.tsx +43 -12
- package/src/theme/darkBase.ts +12 -9
- package/src/theme/index.ts +94 -20
- package/src/theme/lightBase.ts +17 -14
- package/src/theme/palettes.ts +1 -52
- package/src/types/charts.ts +6 -2
- package/src/types/index.ts +40 -4
- package/src/types/utils.ts +0 -1
- package/src/wrapper/ChartContainer.tsx +17 -12
- package/src/wrapper/ChartToolbar.tsx +1 -2
- package/src/wrapper/PaletteSelect.tsx +2 -8
- package/dist/cjs/wrapper/Chart.module.css +0 -1
- package/dist/esm/wrapper/Chart.module.css +0 -1
|
@@ -12,6 +12,29 @@ export interface TimeSeriesProps extends BaseChart, TimeSeriesType {
|
|
|
12
12
|
}) => void;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
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>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type FC } from "react";
|
|
2
2
|
import { type BaseChart } from "../types";
|
|
3
3
|
export interface TimeSliderProps extends BaseChart {
|
|
4
|
-
|
|
4
|
+
series: Array<[Date, number]>;
|
|
5
5
|
range?: {
|
|
6
6
|
start: Date;
|
|
7
7
|
end: Date;
|
|
@@ -12,5 +12,25 @@ export interface TimeSliderProps extends BaseChart {
|
|
|
12
12
|
}) => void;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
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>;
|
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
import { type FC } from "react";
|
|
2
|
-
import { type BaseChart
|
|
3
|
-
export interface WordBubbleProps extends Omit<BaseChart, "theme"
|
|
2
|
+
import { type BaseChart } from "../types";
|
|
3
|
+
export interface WordBubbleProps extends Omit<BaseChart, "theme"> {
|
|
4
|
+
series: Array<{
|
|
5
|
+
id: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
count: number;
|
|
8
|
+
}>;
|
|
4
9
|
onClick?: (key: string) => void;
|
|
5
10
|
}
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
12
|
+
* WordBubble component renders a word cloud chart using ECharts.
|
|
13
|
+
* It displays words with sizes proportional to their frequency in the data.
|
|
14
|
+
* Users can click on words to trigger an action, such as filtering or navigating.
|
|
15
|
+
* It also supports exporting the chart and displays an empty state when no data is available.
|
|
16
|
+
*
|
|
17
|
+
* @param {WordBubbleProps} props - The properties for the WordBubble component.
|
|
18
|
+
* @returns {JSX.Element} The rendered WordBubble component.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```jsx
|
|
22
|
+
* <WordBubble
|
|
23
|
+
* data={[
|
|
24
|
+
* { id: "1", label: "Word One", count: 10 },
|
|
25
|
+
* { id: "2", label: "Word Two", count: 20 },
|
|
26
|
+
* { id: "3", label: "Word Three", count: 30 },
|
|
27
|
+
* ]}
|
|
28
|
+
* title="Word Frequency"
|
|
29
|
+
* onExport={() => console.log("Exporting chart...")}
|
|
30
|
+
* onClick={(key) => console.log("Clicked word:", key)}
|
|
31
|
+
* theme="light"
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/charts-wordbubble--docs} for the properties that can be passed to this component.
|
|
36
|
+
* @see {@link https://github.com/ecomfe/echarts-wordcloud} for the underlying chart implementation.
|
|
8
37
|
*/
|
|
9
38
|
export declare const WordBubble: FC<WordBubbleProps>;
|
|
@@ -284,11 +284,6 @@ export declare const DarkThemeBase: {
|
|
|
284
284
|
};
|
|
285
285
|
};
|
|
286
286
|
};
|
|
287
|
-
visualMap: {
|
|
288
|
-
textStyle: {
|
|
289
|
-
color: string;
|
|
290
|
-
};
|
|
291
|
-
};
|
|
292
287
|
toolbox: {
|
|
293
288
|
iconStyle: {
|
|
294
289
|
borderColor: string;
|
|
@@ -301,9 +296,17 @@ export declare const DarkThemeBase: {
|
|
|
301
296
|
};
|
|
302
297
|
legend: {
|
|
303
298
|
inactiveColor: string;
|
|
299
|
+
itemHeight: number;
|
|
304
300
|
textStyle: {
|
|
301
|
+
fontSize: number;
|
|
305
302
|
color: string;
|
|
306
303
|
};
|
|
304
|
+
pageTextStyle: {
|
|
305
|
+
fontSize: number;
|
|
306
|
+
};
|
|
307
|
+
pageIconSize: number;
|
|
308
|
+
pageIconColor: string;
|
|
309
|
+
pageIconInactiveColor: string;
|
|
307
310
|
};
|
|
308
311
|
tooltip: {
|
|
309
312
|
backgroundColor: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const registerTheme: (echarts: AnyObject, key: string, colors: string[]) => void;
|
|
1
|
+
export declare const registerTheme: (echarts: AnyObject, key: string, colors: string[], heatmap: string[]) => void;
|
|
2
2
|
export declare const registerThemes: (echarts: AnyObject) => void;
|
|
@@ -282,11 +282,6 @@ export declare const LightThemeBase: {
|
|
|
282
282
|
};
|
|
283
283
|
};
|
|
284
284
|
};
|
|
285
|
-
visualMap: {
|
|
286
|
-
textStyle: {
|
|
287
|
-
color: string;
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
285
|
toolbox: {
|
|
291
286
|
iconStyle: {
|
|
292
287
|
borderColor: string;
|
|
@@ -299,9 +294,17 @@ export declare const LightThemeBase: {
|
|
|
299
294
|
};
|
|
300
295
|
legend: {
|
|
301
296
|
inactiveColor: string;
|
|
297
|
+
itemHeight: number;
|
|
302
298
|
textStyle: {
|
|
299
|
+
fontSize: number;
|
|
303
300
|
color: string;
|
|
304
301
|
};
|
|
302
|
+
pageTextStyle: {
|
|
303
|
+
fontSize: number;
|
|
304
|
+
};
|
|
305
|
+
pageIconSize: number;
|
|
306
|
+
pageIconColor: string;
|
|
307
|
+
pageIconInactiveColor: string;
|
|
305
308
|
};
|
|
306
309
|
tooltip: {
|
|
307
310
|
backgroundColor: string;
|
|
@@ -1,16 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
import { type BarSeriesOption, type PieSeriesOption, type EChartsOption } from "echarts";
|
|
2
|
+
export type Theme = "default" | "activity" | "cloud" | "qualitative" | "diverging" | "sequential" | "spectral" | "uber" | "fireice" | "warming" | "sunrise" | "ocean" | "wine" | "red" | "green" | "blue";
|
|
2
3
|
export interface BaseChart {
|
|
3
4
|
title?: string;
|
|
5
|
+
/**
|
|
6
|
+
* The theme to be applied to the chart.
|
|
7
|
+
* This can be one of the predefined themes or a custom theme object.
|
|
8
|
+
* Predefined themes include "default", "activity", "cloud", "qualitative", "diverging", "sequential",
|
|
9
|
+
* "spectral", "uber", "fireice", "warming", "sunrise", "ocean", "wine", "red", "green", and "blue".
|
|
10
|
+
*/
|
|
4
11
|
theme?: Theme;
|
|
12
|
+
/**
|
|
13
|
+
* Additional options for the chart.
|
|
14
|
+
* This can include any ECharts options to customize the chart's appearance and behavior.
|
|
15
|
+
*/
|
|
16
|
+
options?: EChartsOption;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to show the theme selector in the chart.
|
|
19
|
+
* This is useful for allowing users to switch between different themes.
|
|
20
|
+
* If set to true, the chart will render a toggle button group to select the theme.
|
|
21
|
+
*/
|
|
22
|
+
showThemeSelector?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to show the type selector in the chart.
|
|
25
|
+
* This is useful for charts that can have multiple types (e.g., line, column, etc.).
|
|
26
|
+
* If set to true, the chart will render a toggle button group to select the type.
|
|
27
|
+
*/
|
|
28
|
+
showTypeSelector?: boolean;
|
|
5
29
|
onExport?: (chart: {
|
|
6
30
|
title: string;
|
|
7
31
|
image: string;
|
|
8
32
|
}) => void;
|
|
9
33
|
}
|
|
10
34
|
export interface CountType {
|
|
11
|
-
|
|
12
|
-
id: string;
|
|
13
|
-
label?: string;
|
|
35
|
+
series: Array<PieSeriesOption & {
|
|
14
36
|
count: number;
|
|
15
37
|
}>;
|
|
16
38
|
}
|
|
@@ -19,18 +41,14 @@ export interface SeriesType {
|
|
|
19
41
|
valueAxisName?: string;
|
|
20
42
|
valueFormat?: string;
|
|
21
43
|
categories: string[];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
label?: string;
|
|
25
|
-
values: number[];
|
|
44
|
+
series: Array<BarSeriesOption & {
|
|
45
|
+
data: number[];
|
|
26
46
|
}>;
|
|
27
47
|
}
|
|
28
48
|
export interface TimeSeriesType {
|
|
29
49
|
categoryAxisName?: string;
|
|
30
50
|
valueAxisName?: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
label?: string;
|
|
34
|
-
values: Array<[Date, number]>;
|
|
51
|
+
series: Array<BarSeriesOption & {
|
|
52
|
+
data: Array<[Date, number]>;
|
|
35
53
|
}>;
|
|
36
54
|
}
|