@wavemaker/react-native-echarts 1.0.0-dev.0

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 (145) hide show
  1. package/.npmignore +4 -0
  2. package/LICENSE +21 -0
  3. package/README.md +39 -0
  4. package/area/area-chart.d.ts +12 -0
  5. package/area/area-chart.d.ts.map +1 -0
  6. package/area/area-chart.js +404 -0
  7. package/area/area-chart.props.d.ts +64 -0
  8. package/area/area-chart.props.d.ts.map +1 -0
  9. package/area/area-chart.props.js +0 -0
  10. package/area/index.d.ts +3 -0
  11. package/area/index.d.ts.map +1 -0
  12. package/area/index.js +1 -0
  13. package/axis.d.ts +3 -0
  14. package/axis.d.ts.map +1 -0
  15. package/axis.js +16 -0
  16. package/bar/bar-chart.d.ts +11 -0
  17. package/bar/bar-chart.d.ts.map +1 -0
  18. package/bar/bar-chart.js +6 -0
  19. package/bar/bar-chart.props.d.ts +7 -0
  20. package/bar/bar-chart.props.d.ts.map +1 -0
  21. package/bar/bar-chart.props.js +0 -0
  22. package/bar/index.d.ts +3 -0
  23. package/bar/index.d.ts.map +1 -0
  24. package/bar/index.js +1 -0
  25. package/bubble/bubble-chart.d.ts +13 -0
  26. package/bubble/bubble-chart.d.ts.map +1 -0
  27. package/bubble/bubble-chart.js +305 -0
  28. package/bubble/bubble-chart.props.d.ts +26 -0
  29. package/bubble/bubble-chart.props.d.ts.map +1 -0
  30. package/bubble/bubble-chart.props.js +0 -0
  31. package/bubble/index.d.ts +3 -0
  32. package/bubble/index.d.ts.map +1 -0
  33. package/bubble/index.js +1 -0
  34. package/candlestick/candlestick-chart.d.ts +12 -0
  35. package/candlestick/candlestick-chart.d.ts.map +1 -0
  36. package/candlestick/candlestick-chart.js +292 -0
  37. package/candlestick/candlestick-chart.props.d.ts +51 -0
  38. package/candlestick/candlestick-chart.props.d.ts.map +1 -0
  39. package/candlestick/candlestick-chart.props.js +0 -0
  40. package/candlestick/index.d.ts +3 -0
  41. package/candlestick/index.d.ts.map +1 -0
  42. package/candlestick/index.js +1 -0
  43. package/chart-container.d.ts +6 -0
  44. package/chart-container.d.ts.map +1 -0
  45. package/chart-container.js +63 -0
  46. package/chart-theme.context.d.ts +191 -0
  47. package/chart-theme.context.d.ts.map +1 -0
  48. package/chart-theme.context.js +276 -0
  49. package/column/column-chart.d.ts +13 -0
  50. package/column/column-chart.d.ts.map +1 -0
  51. package/column/column-chart.js +481 -0
  52. package/column/column-chart.props.d.ts +83 -0
  53. package/column/column-chart.props.d.ts.map +1 -0
  54. package/column/column-chart.props.js +0 -0
  55. package/column/index.d.ts +3 -0
  56. package/column/index.d.ts.map +1 -0
  57. package/column/index.js +1 -0
  58. package/gauge/digital/digital.gauge.d.ts +28 -0
  59. package/gauge/digital/digital.gauge.d.ts.map +1 -0
  60. package/gauge/digital/digital.gauge.js +213 -0
  61. package/gauge/gauge.types.d.ts +51 -0
  62. package/gauge/gauge.types.d.ts.map +1 -0
  63. package/gauge/gauge.types.js +0 -0
  64. package/gauge/index.d.ts +6 -0
  65. package/gauge/index.d.ts.map +1 -0
  66. package/gauge/index.js +4 -0
  67. package/gauge/radial/radial.gauge.d.ts +18 -0
  68. package/gauge/radial/radial.gauge.d.ts.map +1 -0
  69. package/gauge/radial/radial.gauge.js +284 -0
  70. package/gauge/simple/simple.gauge.d.ts +28 -0
  71. package/gauge/simple/simple.gauge.d.ts.map +1 -0
  72. package/gauge/simple/simple.gauge.js +102 -0
  73. package/gauge/speedometer/speedometer.gauge.d.ts +35 -0
  74. package/gauge/speedometer/speedometer.gauge.d.ts.map +1 -0
  75. package/gauge/speedometer/speedometer.gauge.js +241 -0
  76. package/geo/geo-chart.d.ts +15 -0
  77. package/geo/geo-chart.d.ts.map +1 -0
  78. package/geo/geo-chart.js +200 -0
  79. package/geo/geo-chart.props.d.ts +96 -0
  80. package/geo/geo-chart.props.d.ts.map +1 -0
  81. package/geo/geo-chart.props.js +0 -0
  82. package/geo/index.d.ts +7 -0
  83. package/geo/index.d.ts.map +1 -0
  84. package/geo/index.js +3 -0
  85. package/geo/us-chart.d.ts +15 -0
  86. package/geo/us-chart.d.ts.map +1 -0
  87. package/geo/us-chart.js +15 -0
  88. package/geo/world-chart.d.ts +15 -0
  89. package/geo/world-chart.d.ts.map +1 -0
  90. package/geo/world-chart.js +10 -0
  91. package/index.d.ts +17 -0
  92. package/index.d.ts.map +1 -0
  93. package/index.js +15 -0
  94. package/line/index.d.ts +3 -0
  95. package/line/index.d.ts.map +1 -0
  96. package/line/index.js +1 -0
  97. package/line/line-chart.d.ts +9 -0
  98. package/line/line-chart.d.ts.map +1 -0
  99. package/line/line-chart.js +8 -0
  100. package/line/line-chart.props.d.ts +12 -0
  101. package/line/line-chart.props.d.ts.map +1 -0
  102. package/line/line-chart.props.js +0 -0
  103. package/package.json +39 -0
  104. package/pie/index.d.ts +4 -0
  105. package/pie/index.d.ts.map +1 -0
  106. package/pie/index.js +2 -0
  107. package/pie/pie-chart.d.ts +13 -0
  108. package/pie/pie-chart.d.ts.map +1 -0
  109. package/pie/pie-chart.js +222 -0
  110. package/pie/pie-chart.props.d.ts +97 -0
  111. package/pie/pie-chart.props.d.ts.map +1 -0
  112. package/pie/pie-chart.props.js +12 -0
  113. package/props/cartesian.d.ts +120 -0
  114. package/props/cartesian.d.ts.map +1 -0
  115. package/props/cartesian.js +0 -0
  116. package/props/common.d.ts +28 -0
  117. package/props/common.d.ts.map +1 -0
  118. package/props/common.js +0 -0
  119. package/radar/index.d.ts +3 -0
  120. package/radar/index.d.ts.map +1 -0
  121. package/radar/index.js +1 -0
  122. package/radar/radar-chart.d.ts +12 -0
  123. package/radar/radar-chart.d.ts.map +1 -0
  124. package/radar/radar-chart.js +197 -0
  125. package/radar/radar-chart.props.d.ts +80 -0
  126. package/radar/radar-chart.props.d.ts.map +1 -0
  127. package/radar/radar-chart.props.js +0 -0
  128. package/radial/index.d.ts +3 -0
  129. package/radial/index.d.ts.map +1 -0
  130. package/radial/index.js +1 -0
  131. package/radial/radial-chart.d.ts +12 -0
  132. package/radial/radial-chart.d.ts.map +1 -0
  133. package/radial/radial-chart.js +235 -0
  134. package/radial/radial-chart.props.d.ts +74 -0
  135. package/radial/radial-chart.props.d.ts.map +1 -0
  136. package/radial/radial-chart.props.js +0 -0
  137. package/scatter/index.d.ts +3 -0
  138. package/scatter/index.d.ts.map +1 -0
  139. package/scatter/index.js +1 -0
  140. package/scatter/scatter-chart.d.ts +13 -0
  141. package/scatter/scatter-chart.d.ts.map +1 -0
  142. package/scatter/scatter-chart.js +310 -0
  143. package/scatter/scatter-chart.props.d.ts +36 -0
  144. package/scatter/scatter-chart.props.d.ts.map +1 -0
  145. package/scatter/scatter-chart.props.js +0 -0
@@ -0,0 +1,97 @@
1
+ import type { CommonChartProps } from '../props/common';
2
+ /** Emitted when the user taps/clicks a pie slice. */
3
+ export interface PieChartSelectEvent {
4
+ seriesIndex: number;
5
+ dataIndex: number;
6
+ name: string;
7
+ value: number;
8
+ /** Series/ring name when applicable (concentric pies). */
9
+ seriesName?: string;
10
+ percent?: number;
11
+ }
12
+ /**
13
+ * Single slice data for pie/donut charts.
14
+ */
15
+ export interface PieDataItem {
16
+ /** Display name for the slice */
17
+ name: string;
18
+ /** Numeric value (determines slice size) */
19
+ value: number;
20
+ /** Optional per-item color override */
21
+ itemStyle?: {
22
+ color?: string;
23
+ };
24
+ }
25
+ /**
26
+ * Data for one ring in a concentric (multi-ring) pie.
27
+ * Each ring has its own radius range and slice data.
28
+ */
29
+ export interface PieRingData {
30
+ /** Optional name for the ring (e.g. for legend). */
31
+ name?: string;
32
+ /** Inner and outer radius as [inner, outer], e.g. ['0%', '35%'] or ['45%', '60%']. */
33
+ radius: (number | string)[];
34
+ /** Slice data for this ring. */
35
+ data: PieDataItem[];
36
+ }
37
+ /**
38
+ * Chart data: single pie (array of slices) or concentric (array of rings).
39
+ */
40
+ export type PieChartData = PieDataItem[] | PieRingData[];
41
+ /**
42
+ * Type guard: true if data is concentric (array of rings).
43
+ */
44
+ export declare function isConcentricPieData(data: PieChartData): data is PieRingData[];
45
+ /**
46
+ * Props for PieChart.
47
+ * Extends common chart props (width, height, theme, colors).
48
+ */
49
+ export interface PieChartProps extends CommonChartProps {
50
+ /**
51
+ * Chart data: single pie (array of { name, value }) or concentric (array of { name?, radius, data }).
52
+ */
53
+ data: PieChartData;
54
+ /**
55
+ * Radius of the pie. Number (e.g. 100), string (e.g. '60%'), or [inner, outer] for donut.
56
+ * @default '75%'
57
+ */
58
+ radius?: number | string | (number | string)[];
59
+ /**
60
+ * Whether to show the legend for slices.
61
+ * @default false
62
+ */
63
+ showLegend?: boolean;
64
+ /**
65
+ * Whether to show slice labels (name/value on the chart).
66
+ * @default true
67
+ */
68
+ showLabel?: boolean;
69
+ /**
70
+ * Label position: 'outside' | 'inside' | 'center'.
71
+ * @default 'outside'
72
+ */
73
+ labelPosition?: 'outside' | 'inside' | 'center';
74
+ /**
75
+ * Whether to show label lines (connectors from slice to label).
76
+ * @default true when labelPosition is 'outside'
77
+ */
78
+ showLabelLine?: boolean;
79
+ /**
80
+ * Whether to emphasize (scale/highlight) the hovered slice.
81
+ * @default true
82
+ */
83
+ showHighlighter?: boolean;
84
+ /**
85
+ * Formatter for tooltip. (params) => string. Params include name, value, percent.
86
+ */
87
+ tooltipFormatter?: (params: {
88
+ name: string;
89
+ value: number;
90
+ percent?: number;
91
+ }) => string;
92
+ /**
93
+ * Called when the user selects (taps/clicks) a slice.
94
+ */
95
+ onSelect?: (event: PieChartSelectEvent) => void;
96
+ }
97
+ //# sourceMappingURL=pie-chart.props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pie-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/pie/pie-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,qDAAqD;AACrD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,SAAS,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC5B,gCAAgC;IAChC,IAAI,EAAE,WAAW,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,EAAE,GAAG,WAAW,EAAE,CAAC;AAEzD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,GACjB,IAAI,IAAI,WAAW,EAAE,CASvB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC/C;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAChD;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IACzF;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACjD"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Type guard: true if data is concentric (array of rings).
3
+ */
4
+ export function isConcentricPieData(data) {
5
+ if (!Array.isArray(data) || data.length === 0)
6
+ return false;
7
+ const first = data[0];
8
+ return ('data' in first &&
9
+ Array.isArray(first.data) &&
10
+ 'radius' in first &&
11
+ Array.isArray(first.radius));
12
+ }
@@ -0,0 +1,120 @@
1
+ import type { CommonChartProps } from './common';
2
+ /**
3
+ * Emitted when the user taps/clicks a series data point on Cartesian-based charts
4
+ * (area, line, column, bar, scatter, bubble, candlestick, etc.).
5
+ */
6
+ export interface CartesianChartSelectEvent {
7
+ seriesIndex: number;
8
+ dataIndex: number;
9
+ seriesName: string;
10
+ x: string | number;
11
+ y: number;
12
+ /** Third numeric dimension when present (e.g. bubble size). */
13
+ z?: number;
14
+ /** Set when the gesture targets a candlestick series. */
15
+ ohlc?: {
16
+ open: number;
17
+ close: number;
18
+ low: number;
19
+ high: number;
20
+ };
21
+ }
22
+ /**
23
+ * Grid positioning configuration.
24
+ * Values can be percentages (strings like '10%') or pixel values (numbers).
25
+ */
26
+ export interface CartesianGrid {
27
+ left?: string | number;
28
+ right?: string | number;
29
+ top?: string | number;
30
+ bottom?: string | number;
31
+ }
32
+ /**
33
+ * Props shared by all Cartesian chart components (axes, grid, legend, highlighter).
34
+ * common -> cartesian -> area | bar | scatter
35
+ */
36
+ export interface CartesianChartProps extends CommonChartProps {
37
+ /**
38
+ * Whether to leave gaps at the start and end of the axis.
39
+ * @default false (area/line/scatter); true (bar)
40
+ */
41
+ boundaryGap?: boolean;
42
+ /**
43
+ * Custom X-axis tick values (numbers only). When provided, used as the x-axis data; labels are
44
+ * generated using xAxisTickLabelFormatter. Otherwise each chart derives x-axis from data.
45
+ * @default undefined
46
+ */
47
+ xAxisTicks?: number[];
48
+ /**
49
+ * Custom Y-axis tick positions (for value axis).
50
+ * @default undefined
51
+ */
52
+ yAxisTicks?: number[];
53
+ /**
54
+ * Whether to show the X-axis line and labels.
55
+ * @default true
56
+ */
57
+ showXAxis?: boolean;
58
+ /**
59
+ * Whether to show X-axis tick marks.
60
+ * @default true
61
+ */
62
+ showXAxisTicks?: boolean;
63
+ /**
64
+ * Whether to show the Y-axis line and labels.
65
+ * @default true
66
+ */
67
+ showYAxis?: boolean;
68
+ /**
69
+ * Whether to show Y-axis tick marks.
70
+ * @default true
71
+ */
72
+ showYAxisTicks?: boolean;
73
+ /**
74
+ * Whether to show vertical grid lines (X-axis split lines).
75
+ * @default true
76
+ */
77
+ showXAxisSplitLines?: boolean;
78
+ /**
79
+ * Whether to show horizontal grid lines (Y-axis split lines).
80
+ * @default true
81
+ */
82
+ showYAxisSplitLines?: boolean;
83
+ /**
84
+ * Label text for the X-axis (displayed along the axis).
85
+ * @default undefined
86
+ */
87
+ xAxisLabel?: string;
88
+ /**
89
+ * Label text for the Y-axis (displayed along the axis).
90
+ * @default undefined
91
+ */
92
+ yAxisLabel?: string;
93
+ /**
94
+ * Grid positioning configuration.
95
+ */
96
+ grid?: CartesianGrid;
97
+ /**
98
+ * Whether to display a legend for named series.
99
+ * @default false
100
+ */
101
+ showLegend?: boolean;
102
+ /**
103
+ * Whether to show the highlighter (emphasis) when interacting with the chart.
104
+ * @default true
105
+ */
106
+ showHighlighter?: boolean;
107
+ /**
108
+ * Formatter for X-axis tick labels. (value, index?) => string
109
+ */
110
+ xAxisTickLabelFormatter?: (value: string | number, index?: number) => string;
111
+ /**
112
+ * Formatter for Y-axis tick labels. (value, index?) => string
113
+ */
114
+ yAxisTickLabelFormatter?: (value: string | number, index?: number) => string;
115
+ /**
116
+ * Called when the user selects (taps/clicks) a data point on a series (when supported).
117
+ */
118
+ onSelect?: (event: CartesianChartSelectEvent) => void;
119
+ }
120
+ //# sourceMappingURL=cartesian.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesian.d.ts","sourceRoot":"","sources":["../../../../components/chart/props/cartesian.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,+DAA+D;IAC/D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7E;;OAEG;IACH,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7E;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACvD"}
File without changes
@@ -0,0 +1,28 @@
1
+ import type { ChartTheme } from '../chart-theme.context';
2
+ /**
3
+ * Props shared by all chart components (common base).
4
+ * common -> cartesian -> area | bar | scatter -> line (extends area) | bubble (extends scatter)
5
+ */
6
+ export interface CommonChartProps {
7
+ /**
8
+ * Width of the chart in pixels.
9
+ * @default 220
10
+ */
11
+ width?: number;
12
+ /**
13
+ * Height of the chart in pixels.
14
+ * @default 350
15
+ */
16
+ height?: number;
17
+ /**
18
+ * Partial theme override for customizing chart appearance.
19
+ * Merged with the default theme from ChartThemeContext.
20
+ */
21
+ theme?: Partial<ChartTheme>;
22
+ /**
23
+ * Colors for the chart series. Overrides theme colors.
24
+ * When provided, these colors will be used for the series in order.
25
+ */
26
+ colors?: string[];
27
+ }
28
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../components/chart/props/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
File without changes
@@ -0,0 +1,3 @@
1
+ export { RadarChart } from './radar-chart';
2
+ export type { RadarChartProps, RadarChartSelectEvent, RadarIndicator, RadarSeriesData, } from './radar-chart.props';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/radar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,eAAe,GAChB,MAAM,qBAAqB,CAAC"}
package/radar/index.js ADDED
@@ -0,0 +1 @@
1
+ export { RadarChart } from './radar-chart';
@@ -0,0 +1,12 @@
1
+ import type { RadarChartProps } from './radar-chart.props';
2
+ import React from 'react';
3
+ export type { RadarChartProps, RadarChartSelectEvent, RadarIndicator, RadarSeriesData, } from './radar-chart.props';
4
+ export declare const RadarChart: ((props: RadarChartProps & {
5
+ theme?: Partial<import("..").ChartTheme>;
6
+ } & {
7
+ width?: number | string;
8
+ height?: number | string;
9
+ }) => React.JSX.Element) & {
10
+ displayName: string;
11
+ };
12
+ //# sourceMappingURL=radar-chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radar-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/radar/radar-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,qBAAqB,CAAC;AAS7B,OAAO,KAAqC,MAAM,OAAO,CAAC;AAE1D,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAkN7B,eAAO,MAAM,UAAU;;;;;;;CAErB,CAAC"}
@@ -0,0 +1,197 @@
1
+ import { withResponsiveContainer } from '../chart-container';
2
+ import { useChartTheme, withChartTheme } from '../chart-theme.context';
3
+ import { SkiaChart, SkiaRenderer } from '@wuba/react-native-echarts';
4
+ import { RadarChart as EChartsRadarChart } from 'echarts/charts';
5
+ import { GridComponent, LegendComponent, TooltipComponent, } from 'echarts/components';
6
+ import * as echarts from 'echarts/core';
7
+ import React, { useEffect, useMemo, useRef } from 'react';
8
+ echarts.use([
9
+ TooltipComponent,
10
+ GridComponent,
11
+ LegendComponent,
12
+ SkiaRenderer,
13
+ EChartsRadarChart,
14
+ ]);
15
+ function normalizeRadarSeries(data, indicatorCount) {
16
+ if (!Array.isArray(data) || data.length === 0)
17
+ return [];
18
+ const first = data[0];
19
+ if (typeof first === 'number') {
20
+ const values = data;
21
+ if (values.length !== indicatorCount)
22
+ return [];
23
+ return [{ name: 'Series 1', value: values }];
24
+ }
25
+ return data.map((item, index) => ({
26
+ name: item.name ?? `Series ${index + 1}`,
27
+ value: item.value,
28
+ }));
29
+ }
30
+ const ChartComponent = ({ indicators, data, width = 220, height = 350, symbol = 'none', symbolSize, showLegend = false, showHighlighter = true, showIndicatorLabels = true, showSplitLine = true, showAxisLine = true, onSelect, ...props }) => {
31
+ const { theme } = useChartTheme(props.theme, props.colors);
32
+ const chartRef = useRef(null);
33
+ const onSelectRef = useRef(onSelect);
34
+ onSelectRef.current = onSelect;
35
+ const selectContextRef = useRef([]);
36
+ const normalizedSeries = useMemo(() => {
37
+ const count = indicators?.length ?? 0;
38
+ return normalizeRadarSeries(data, count);
39
+ }, [data, indicators?.length]);
40
+ selectContextRef.current = normalizedSeries;
41
+ const indicatorMax = useMemo(() => {
42
+ if (!indicators?.length)
43
+ return [];
44
+ return indicators.map((ind, i) => {
45
+ if (ind.max != null)
46
+ return ind.max;
47
+ let max = 0;
48
+ normalizedSeries.forEach(s => {
49
+ const v = s.value[i];
50
+ if (typeof v === 'number' && v > max)
51
+ max = v;
52
+ });
53
+ return max > 0 ? Math.ceil(max * 1.1) : 100;
54
+ });
55
+ }, [indicators, normalizedSeries]);
56
+ const option = useMemo(() => {
57
+ if (!indicators?.length)
58
+ return { series: [] };
59
+ const radarAxis = theme.axis.r;
60
+ const gridStyle = theme.grid.r;
61
+ const radarConfig = {
62
+ indicator: indicators.map((ind, i) => ({
63
+ name: ind.name,
64
+ max: indicatorMax[i] ?? ind.max ?? 100,
65
+ })),
66
+ axisName: {
67
+ show: showIndicatorLabels,
68
+ color: radarAxis.tickLabelColor,
69
+ },
70
+ axisLine: showAxisLine
71
+ ? {
72
+ lineStyle: {
73
+ color: radarAxis.lineColor,
74
+ width: radarAxis.lineWidth,
75
+ },
76
+ }
77
+ : { show: false },
78
+ splitLine: showSplitLine
79
+ ? {
80
+ lineStyle: {
81
+ color: gridStyle.lineColor,
82
+ width: gridStyle.lineWidth,
83
+ },
84
+ }
85
+ : { show: false },
86
+ splitArea: {
87
+ show: false,
88
+ },
89
+ };
90
+ const radarDataItems = normalizedSeries.map(s => ({ value: s.value, name: s.name }));
91
+ const seriesConfig = {
92
+ type: 'radar',
93
+ data: radarDataItems.map((item, index) => {
94
+ const seriesColor = theme.series[index % theme.series.length].color;
95
+ const seriesLineWidth = theme.series[index]?.lineWidth ?? theme.series[0].lineWidth ?? 2;
96
+ const areaOpacityHex = Math.round(0.25 * 255).toString(16).padStart(2, '0');
97
+ const areaColor = seriesColor + areaOpacityHex;
98
+ return {
99
+ value: item.value,
100
+ name: item.name,
101
+ symbol: symbol === 'none' ? 'circle' : symbol,
102
+ symbolSize: symbol === 'none' ? 0 : (symbolSize ?? 6),
103
+ lineStyle: { color: seriesColor, width: seriesLineWidth },
104
+ areaStyle: { color: areaColor },
105
+ emphasis: showHighlighter
106
+ ? { focus: 'self', lineStyle: { width: seriesLineWidth + 1 }, areaStyle: { opacity: 0.8 } }
107
+ : { focus: 'none' },
108
+ };
109
+ }),
110
+ };
111
+ const legendConfig = showLegend && normalizedSeries.some(s => s.name)
112
+ ? {
113
+ data: normalizedSeries.map(s => s.name),
114
+ textStyle: {
115
+ color: theme.legend.textColor,
116
+ fontSize: theme.legend.fontSize,
117
+ },
118
+ backgroundColor: theme.legend.backgroundColor,
119
+ }
120
+ : undefined;
121
+ const config = {
122
+ radar: radarConfig,
123
+ series: [seriesConfig],
124
+ tooltip: {
125
+ trigger: 'item',
126
+ },
127
+ };
128
+ if (legendConfig)
129
+ config.legend = legendConfig;
130
+ return config;
131
+ }, [
132
+ theme,
133
+ indicators,
134
+ indicatorMax,
135
+ normalizedSeries,
136
+ symbol,
137
+ symbolSize,
138
+ showLegend,
139
+ showHighlighter,
140
+ showIndicatorLabels,
141
+ showSplitLine,
142
+ showAxisLine,
143
+ ]);
144
+ useEffect(() => {
145
+ let chart;
146
+ if (chartRef.current) {
147
+ try {
148
+ chart = echarts.init(chartRef.current, 'light', {
149
+ width,
150
+ height,
151
+ });
152
+ chart.setOption(option);
153
+ const handleRadarClick = (params) => {
154
+ const cb = onSelectRef.current;
155
+ if (typeof cb !== 'function')
156
+ return;
157
+ if (params.componentType !== 'series')
158
+ return;
159
+ if (params.seriesType !== 'radar')
160
+ return;
161
+ const dataIndex = params.dataIndex;
162
+ if (typeof dataIndex !== 'number' || dataIndex < 0)
163
+ return;
164
+ const row = selectContextRef.current[dataIndex];
165
+ if (!row)
166
+ return;
167
+ const event = {
168
+ seriesIndex: params.seriesIndex ?? 0,
169
+ dataIndex,
170
+ seriesName: row.name,
171
+ value: [...row.value],
172
+ };
173
+ cb(event);
174
+ };
175
+ chart.on('click', handleRadarClick);
176
+ }
177
+ catch (error) {
178
+ console.warn('Radar chart initialization error:', error);
179
+ }
180
+ }
181
+ return () => {
182
+ if (chart) {
183
+ try {
184
+ chart.dispose();
185
+ }
186
+ catch (error) {
187
+ console.warn('Radar chart disposal error:', error);
188
+ }
189
+ }
190
+ };
191
+ }, [option, width, height]);
192
+ return <SkiaChart ref={chartRef} useRNGH/>;
193
+ };
194
+ const RadarChartComponent = withResponsiveContainer(withChartTheme(ChartComponent));
195
+ export const RadarChart = Object.assign(RadarChartComponent, {
196
+ displayName: 'RadarChart',
197
+ });
@@ -0,0 +1,80 @@
1
+ import type { CommonChartProps } from '../props/common';
2
+ /** Emitted when the user taps/clicks a radar series (polygon). */
3
+ export interface RadarChartSelectEvent {
4
+ seriesIndex: number;
5
+ dataIndex: number;
6
+ seriesName: string;
7
+ value: number[];
8
+ }
9
+ /**
10
+ * One dimension (axis) of the radar chart.
11
+ */
12
+ export interface RadarIndicator {
13
+ /** Display name for the axis. */
14
+ name: string;
15
+ /** Optional maximum value for the axis. When omitted, max is derived from data. */
16
+ max?: number;
17
+ }
18
+ /**
19
+ * Radar series data shape:
20
+ * - Single series: number[] (one value per indicator)
21
+ * - Multiple series: Array<{ name?: string; value: number[] }>
22
+ */
23
+ export type RadarSeriesData = number[] | Array<{
24
+ name?: string;
25
+ value: number[];
26
+ }>;
27
+ /**
28
+ * Props for RadarChart.
29
+ * common -> radar (no cartesian axes)
30
+ */
31
+ export interface RadarChartProps extends CommonChartProps {
32
+ /**
33
+ * Indicator definitions: dimension names and optional max per axis.
34
+ * Length must match the length of each series value array.
35
+ */
36
+ indicators: RadarIndicator[];
37
+ /**
38
+ * Chart data. Single series (number[]) or multiple named series.
39
+ */
40
+ data: RadarSeriesData;
41
+ /**
42
+ * Symbol type for data points. Set to 'none' to hide (default).
43
+ * @default 'none'
44
+ */
45
+ symbol?: 'none' | 'circle' | 'rect' | 'roundRect' | 'triangle' | 'diamond' | 'pin' | 'arrow' | string;
46
+ /**
47
+ * Size of the symbol. Used when symbol is not 'none'.
48
+ */
49
+ symbolSize?: number | number[] | ((value: unknown) => number | number[]);
50
+ /**
51
+ * Whether to display a legend for named series.
52
+ * @default false
53
+ */
54
+ showLegend?: boolean;
55
+ /**
56
+ * Whether to show emphasis (highlight) when interacting with the chart.
57
+ * @default true
58
+ */
59
+ showHighlighter?: boolean;
60
+ /**
61
+ * Whether to show indicator (axis) labels.
62
+ * @default true
63
+ */
64
+ showIndicatorLabels?: boolean;
65
+ /**
66
+ * Whether to show split lines (grid) for the radar.
67
+ * @default true
68
+ */
69
+ showSplitLine?: boolean;
70
+ /**
71
+ * Whether to show axis line for each indicator.
72
+ * @default true
73
+ */
74
+ showAxisLine?: boolean;
75
+ /**
76
+ * Called when the user selects (taps/clicks) a radar series polygon.
77
+ */
78
+ onSelect?: (event: RadarChartSelectEvent) => void;
79
+ }
80
+ //# sourceMappingURL=radar-chart.props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radar-chart.props.d.ts","sourceRoot":"","sources":["../../../../components/chart/radar/radar-chart.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,kEAAkE;AAClE,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,EAAE,GACR,KAAK,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;;OAGG;IACH,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IACtG;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IACzE;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACnD"}
File without changes
@@ -0,0 +1,3 @@
1
+ export { RadialChart } from './radial-chart';
2
+ export type { RadialChartProps, RadialChartSelectEvent, RadialDataItem, } from './radial-chart.props';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/chart/radial/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,GACf,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ export { RadialChart } from './radial-chart';
@@ -0,0 +1,12 @@
1
+ import type { RadialChartProps } from './radial-chart.props';
2
+ import React from 'react';
3
+ export type { RadialChartProps, RadialChartSelectEvent, RadialDataItem } from './radial-chart.props';
4
+ export declare const RadialChart: ((props: RadialChartProps & {
5
+ theme?: Partial<import("..").ChartTheme>;
6
+ } & {
7
+ width?: number | string;
8
+ height?: number | string;
9
+ }) => React.JSX.Element) & {
10
+ displayName: string;
11
+ };
12
+ //# sourceMappingURL=radial-chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radial-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/radial/radial-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAA0C,MAAM,sBAAsB,CAAC;AAKrG,OAAO,KAAqC,MAAM,OAAO,CAAC;AAG1D,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA4QrG,eAAO,MAAM,WAAW;;;;;;;CAEtB,CAAC"}