@react-fabric/chart 1.0.0-beta.53 → 1.0.0-beta.55

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 (43) hide show
  1. package/dist/cjs/charts/ActivityMap.js +16 -15
  2. package/dist/cjs/charts/CountSeries.js +20 -18
  3. package/dist/cjs/charts/DataSeries.js +23 -23
  4. package/dist/cjs/charts/MapSeries.js +6 -6
  5. package/dist/cjs/charts/TimeSeries.js +24 -24
  6. package/dist/cjs/charts/TimeSlider.js +9 -9
  7. package/dist/cjs/charts/WordBubble.js +5 -5
  8. package/dist/cjs/theme/darkBase.js +13 -5
  9. package/dist/cjs/theme/index.js +3 -3
  10. package/dist/cjs/theme/lightBase.js +18 -10
  11. package/dist/cjs/wrapper/ChartContainer.js +5 -5
  12. package/dist/esm/charts/ActivityMap.js +16 -15
  13. package/dist/esm/charts/CountSeries.js +20 -18
  14. package/dist/esm/charts/DataSeries.js +23 -23
  15. package/dist/esm/charts/MapSeries.js +6 -6
  16. package/dist/esm/charts/TimeSeries.js +24 -24
  17. package/dist/esm/charts/TimeSlider.js +9 -9
  18. package/dist/esm/charts/WordBubble.js +5 -5
  19. package/dist/esm/theme/darkBase.js +13 -5
  20. package/dist/esm/theme/index.js +3 -3
  21. package/dist/esm/theme/lightBase.js +18 -10
  22. package/dist/esm/wrapper/ChartContainer.js +5 -5
  23. package/dist/types/charts/ActivityMap.d.ts +1 -1
  24. package/dist/types/charts/CountSeries.d.ts +1 -0
  25. package/dist/types/charts/MapSeries.d.ts +7 -2
  26. package/dist/types/charts/TimeSlider.d.ts +1 -1
  27. package/dist/types/charts/WordBubble.d.ts +7 -2
  28. package/dist/types/theme/darkBase.d.ts +8 -0
  29. package/dist/types/theme/lightBase.d.ts +8 -0
  30. package/dist/types/types/index.d.ts +27 -11
  31. package/package.json +3 -3
  32. package/src/charts/ActivityMap.tsx +25 -22
  33. package/src/charts/CountSeries.tsx +27 -19
  34. package/src/charts/DataSeries.tsx +39 -21
  35. package/src/charts/MapSeries.tsx +8 -7
  36. package/src/charts/TimeSeries.tsx +49 -41
  37. package/src/charts/TimeSlider.tsx +12 -9
  38. package/src/charts/WordBubble.tsx +8 -7
  39. package/src/theme/darkBase.ts +12 -4
  40. package/src/theme/index.ts +3 -3
  41. package/src/theme/lightBase.ts +17 -9
  42. package/src/types/index.ts +34 -3
  43. package/src/wrapper/ChartContainer.tsx +5 -3
@@ -21,6 +21,8 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
+ import { type EChartOption } from "echarts";
25
+
24
26
  export type Theme =
25
27
  | "default"
26
28
  | "activity"
@@ -41,14 +43,35 @@ export type Theme =
41
43
 
42
44
  export interface BaseChart {
43
45
  title?: string;
46
+ /**
47
+ * The theme to be applied to the chart.
48
+ * This can be one of the predefined themes or a custom theme object.
49
+ * Predefined themes include "default", "activity", "cloud", "qualitative", "diverging", "sequential",
50
+ * "spectral", "uber", "fireice", "warming", "sunrise", "ocean", "wine", "red", "green", and "blue".
51
+ */
44
52
  theme?: Theme;
53
+ /**
54
+ * Additional options for the chart.
55
+ * This can include any ECharts options to customize the chart's appearance and behavior.
56
+ */
57
+ options?: EChartOption;
58
+ /**
59
+ * Whether to show the theme selector in the chart.
60
+ * This is useful for allowing users to switch between different themes.
61
+ * If set to true, the chart will render a toggle button group to select the theme.
62
+ */
45
63
  showThemeSelector?: boolean;
64
+ /**
65
+ * Whether to show the type selector in the chart.
66
+ * This is useful for charts that can have multiple types (e.g., line, column, etc.).
67
+ * If set to true, the chart will render a toggle button group to select the type.
68
+ */
46
69
  showTypeSelector?: boolean;
47
70
  onExport?: (chart: { title: string; image: string }) => void;
48
71
  }
49
72
 
50
73
  export interface CountType {
51
- data: Array<{ id: string; label?: string; count: number }>;
74
+ series: Array<EChartOption.SeriesPie & { count: number }>;
52
75
  }
53
76
 
54
77
  export interface SeriesType {
@@ -56,11 +79,19 @@ export interface SeriesType {
56
79
  valueAxisName?: string;
57
80
  valueFormat?: string;
58
81
  categories: string[];
59
- data: Array<{ id: string; label?: string; values: number[] }>;
82
+ series: Array<
83
+ EChartOption.SeriesBar & {
84
+ data: number[];
85
+ }
86
+ >;
60
87
  }
61
88
 
62
89
  export interface TimeSeriesType {
63
90
  categoryAxisName?: string;
64
91
  valueAxisName?: string;
65
- data: Array<{ id: string; label?: string; values: Array<[Date, number]> }>;
92
+ series: Array<
93
+ EChartOption.SeriesBar & {
94
+ data: Array<[Date, number]>;
95
+ }
96
+ >;
66
97
  }
@@ -56,8 +56,6 @@ const defaultOptions = {
56
56
  },
57
57
  tooltip: {
58
58
  trigger: "item",
59
- confine: true,
60
- position: "top",
61
59
  appendToBody: true,
62
60
  } as AnyObject,
63
61
  legend: {
@@ -165,6 +163,10 @@ export const ChartContainer = memo(
165
163
  ...defaultOptions,
166
164
  toolbox,
167
165
  ...options,
166
+ tooltip: {
167
+ ...defaultOptions.tooltip,
168
+ ...options.tooltip,
169
+ },
168
170
  },
169
171
  true,
170
172
  );
@@ -182,7 +184,7 @@ export const ChartContainer = memo(
182
184
  <Fragment>
183
185
  <ChartToolbar>
184
186
  {title && (
185
- <Title className="flex-fill px-2 py-1 text-dimmed">{title}</Title>
187
+ <Title className="flex-1 px-2 py-1 text-dimmed">{title}</Title>
186
188
  )}
187
189
  {children}
188
190
  {onExport && (