@wavemaker/react-native-echarts 1.0.0-dev.0 → 1.0.0-dev.10
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/README.md +360 -3
- package/area/area-chart.d.ts +1 -1
- package/area/area-chart.d.ts.map +1 -1
- package/area/area-chart.js +81 -50
- package/area/area-chart.props.d.ts +4 -0
- package/area/area-chart.props.d.ts.map +1 -1
- package/area/index.d.ts +1 -1
- package/area/index.d.ts.map +1 -1
- package/axis.d.ts +26 -0
- package/axis.d.ts.map +1 -1
- package/axis.js +35 -0
- package/bubble/bubble-chart.d.ts.map +1 -1
- package/bubble/bubble-chart.js +66 -35
- package/candlestick/candlestick-chart.d.ts.map +1 -1
- package/candlestick/candlestick-chart.js +37 -8
- package/cartesian/tooltip/axis-tooltip-presets.d.ts +5 -0
- package/cartesian/tooltip/axis-tooltip-presets.d.ts.map +1 -0
- package/cartesian/tooltip/axis-tooltip-presets.js +46 -0
- package/cartesian/tooltip/axis-tooltip.types.d.ts +38 -0
- package/cartesian/tooltip/axis-tooltip.types.d.ts.map +1 -0
- package/cartesian/tooltip/axis-tooltip.types.js +4 -0
- package/cartesian/tooltip/axis-tooltip.utils.d.ts +10 -0
- package/cartesian/tooltip/axis-tooltip.utils.d.ts.map +1 -0
- package/cartesian/tooltip/axis-tooltip.utils.js +121 -0
- package/cartesian/tooltip/default-axis-tooltip.d.ts +9 -0
- package/cartesian/tooltip/default-axis-tooltip.d.ts.map +1 -0
- package/cartesian/tooltip/default-axis-tooltip.js +53 -0
- package/cartesian/tooltip/index.d.ts +7 -0
- package/cartesian/tooltip/index.d.ts.map +1 -0
- package/cartesian/tooltip/index.js +4 -0
- package/cartesian/tooltip/use-axis-tooltip.d.ts +38 -0
- package/cartesian/tooltip/use-axis-tooltip.d.ts.map +1 -0
- package/cartesian/tooltip/use-axis-tooltip.js +54 -0
- package/column/column-chart.d.ts.map +1 -1
- package/column/column-chart.js +93 -33
- package/geo/geo-chart.d.ts.map +1 -1
- package/geo/geo-chart.js +56 -24
- package/geo/geo-chart.props.d.ts +11 -5
- package/geo/geo-chart.props.d.ts.map +1 -1
- package/geo/index.d.ts +1 -0
- package/geo/index.d.ts.map +1 -1
- package/geo/index.js +1 -0
- package/geo/tooltip/default-geo-tooltip.d.ts +6 -0
- package/geo/tooltip/default-geo-tooltip.d.ts.map +1 -0
- package/geo/tooltip/default-geo-tooltip.js +47 -0
- package/geo/tooltip/geo-item-tooltip-presets.d.ts +5 -0
- package/geo/tooltip/geo-item-tooltip-presets.d.ts.map +1 -0
- package/geo/tooltip/geo-item-tooltip-presets.js +35 -0
- package/geo/tooltip/geo-item-tooltip.types.d.ts +19 -0
- package/geo/tooltip/geo-item-tooltip.types.d.ts.map +1 -0
- package/geo/tooltip/geo-item-tooltip.types.js +3 -0
- package/geo/tooltip/geo-item-tooltip.utils.d.ts +14 -0
- package/geo/tooltip/geo-item-tooltip.utils.d.ts.map +1 -0
- package/geo/tooltip/geo-item-tooltip.utils.js +220 -0
- package/geo/tooltip/index.d.ts +7 -0
- package/geo/tooltip/index.d.ts.map +1 -0
- package/geo/tooltip/index.js +4 -0
- package/geo/tooltip/use-geo-item-tooltip.d.ts +26 -0
- package/geo/tooltip/use-geo-item-tooltip.d.ts.map +1 -0
- package/geo/tooltip/use-geo-item-tooltip.js +59 -0
- package/geo/us-chart.js +1 -1
- package/geo/us-states.json +54 -0
- package/geo/world.json +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/legend/echarts-legend-layout.d.ts +20 -0
- package/legend/echarts-legend-layout.d.ts.map +1 -0
- package/legend/echarts-legend-layout.js +103 -0
- package/line/index.d.ts +1 -1
- package/line/index.d.ts.map +1 -1
- package/line/line-chart.d.ts +1 -1
- package/line/line-chart.d.ts.map +1 -1
- package/line/line-chart.props.d.ts +5 -0
- package/line/line-chart.props.d.ts.map +1 -1
- package/package.json +12 -5
- package/pie/index.d.ts +1 -0
- package/pie/index.d.ts.map +1 -1
- package/pie/index.js +1 -0
- package/pie/pie-chart.d.ts.map +1 -1
- package/pie/pie-chart.js +69 -45
- package/pie/pie-chart.props.d.ts +19 -8
- package/pie/pie-chart.props.d.ts.map +1 -1
- package/pie/tooltip/default-pie-tooltip.d.ts +5 -0
- package/pie/tooltip/default-pie-tooltip.d.ts.map +1 -0
- package/pie/tooltip/default-pie-tooltip.js +57 -0
- package/pie/tooltip/index.d.ts +7 -0
- package/pie/tooltip/index.d.ts.map +1 -0
- package/pie/tooltip/index.js +4 -0
- package/pie/tooltip/pie-item-tooltip-presets.d.ts +5 -0
- package/pie/tooltip/pie-item-tooltip-presets.d.ts.map +1 -0
- package/pie/tooltip/pie-item-tooltip-presets.js +39 -0
- package/pie/tooltip/pie-item-tooltip.types.d.ts +28 -0
- package/pie/tooltip/pie-item-tooltip.types.d.ts.map +1 -0
- package/pie/tooltip/pie-item-tooltip.types.js +3 -0
- package/pie/tooltip/pie-item-tooltip.utils.d.ts +9 -0
- package/pie/tooltip/pie-item-tooltip.utils.d.ts.map +1 -0
- package/pie/tooltip/pie-item-tooltip.utils.js +139 -0
- package/pie/tooltip/use-pie-item-tooltip.d.ts +24 -0
- package/pie/tooltip/use-pie-item-tooltip.d.ts.map +1 -0
- package/pie/tooltip/use-pie-item-tooltip.js +45 -0
- package/props/cartesian.d.ts +50 -13
- package/props/cartesian.d.ts.map +1 -1
- package/props/common.d.ts +2 -0
- package/props/common.d.ts.map +1 -1
- package/radar/index.d.ts +1 -0
- package/radar/index.d.ts.map +1 -1
- package/radar/index.js +1 -0
- package/radar/radar-chart.d.ts.map +1 -1
- package/radar/radar-chart.js +59 -12
- package/radar/radar-chart.props.d.ts +20 -2
- package/radar/radar-chart.props.d.ts.map +1 -1
- package/radar/tooltip/default-radar-tooltip.d.ts +6 -0
- package/radar/tooltip/default-radar-tooltip.d.ts.map +1 -0
- package/radar/tooltip/default-radar-tooltip.js +47 -0
- package/radar/tooltip/index.d.ts +7 -0
- package/radar/tooltip/index.d.ts.map +1 -0
- package/radar/tooltip/index.js +4 -0
- package/radar/tooltip/radar-item-tooltip-presets.d.ts +5 -0
- package/radar/tooltip/radar-item-tooltip-presets.d.ts.map +1 -0
- package/radar/tooltip/radar-item-tooltip-presets.js +50 -0
- package/radar/tooltip/radar-item-tooltip.types.d.ts +28 -0
- package/radar/tooltip/radar-item-tooltip.types.d.ts.map +1 -0
- package/radar/tooltip/radar-item-tooltip.types.js +3 -0
- package/radar/tooltip/radar-item-tooltip.utils.d.ts +9 -0
- package/radar/tooltip/radar-item-tooltip.utils.d.ts.map +1 -0
- package/radar/tooltip/radar-item-tooltip.utils.js +77 -0
- package/radar/tooltip/use-radar-item-tooltip.d.ts +22 -0
- package/radar/tooltip/use-radar-item-tooltip.d.ts.map +1 -0
- package/radar/tooltip/use-radar-item-tooltip.js +43 -0
- package/radial/index.d.ts +1 -0
- package/radial/index.d.ts.map +1 -1
- package/radial/index.js +1 -0
- package/radial/radial-chart.d.ts.map +1 -1
- package/radial/radial-chart.js +44 -16
- package/radial/radial-chart.props.d.ts +16 -3
- package/radial/radial-chart.props.d.ts.map +1 -1
- package/radial/tooltip/default-radial-tooltip.d.ts +6 -0
- package/radial/tooltip/default-radial-tooltip.d.ts.map +1 -0
- package/radial/tooltip/default-radial-tooltip.js +52 -0
- package/radial/tooltip/index.d.ts +7 -0
- package/radial/tooltip/index.d.ts.map +1 -0
- package/radial/tooltip/index.js +4 -0
- package/radial/tooltip/radial-item-tooltip-presets.d.ts +5 -0
- package/radial/tooltip/radial-item-tooltip-presets.d.ts.map +1 -0
- package/radial/tooltip/radial-item-tooltip-presets.js +43 -0
- package/radial/tooltip/radial-item-tooltip.types.d.ts +23 -0
- package/radial/tooltip/radial-item-tooltip.types.d.ts.map +1 -0
- package/radial/tooltip/radial-item-tooltip.types.js +3 -0
- package/radial/tooltip/radial-item-tooltip.utils.d.ts +9 -0
- package/radial/tooltip/radial-item-tooltip.utils.d.ts.map +1 -0
- package/radial/tooltip/radial-item-tooltip.utils.js +122 -0
- package/radial/tooltip/use-radial-item-tooltip.d.ts +22 -0
- package/radial/tooltip/use-radial-item-tooltip.d.ts.map +1 -0
- package/radial/tooltip/use-radial-item-tooltip.js +43 -0
- package/scatter/index.d.ts +1 -0
- package/scatter/index.d.ts.map +1 -1
- package/scatter/index.js +1 -0
- package/scatter/scatter-chart.d.ts.map +1 -1
- package/scatter/scatter-chart.js +64 -22
- package/scatter/scatter-chart.props.d.ts +7 -1
- package/scatter/scatter-chart.props.d.ts.map +1 -1
- package/scatter/tooltip/default-scatter-tooltip.d.ts +8 -0
- package/scatter/tooltip/default-scatter-tooltip.d.ts.map +1 -0
- package/scatter/tooltip/default-scatter-tooltip.js +57 -0
- package/scatter/tooltip/index.d.ts +7 -0
- package/scatter/tooltip/index.d.ts.map +1 -0
- package/scatter/tooltip/index.js +4 -0
- package/scatter/tooltip/scatter-item-tooltip-presets.d.ts +5 -0
- package/scatter/tooltip/scatter-item-tooltip-presets.d.ts.map +1 -0
- package/scatter/tooltip/scatter-item-tooltip-presets.js +49 -0
- package/scatter/tooltip/scatter-item-tooltip.types.d.ts +22 -0
- package/scatter/tooltip/scatter-item-tooltip.types.d.ts.map +1 -0
- package/scatter/tooltip/scatter-item-tooltip.types.js +3 -0
- package/scatter/tooltip/scatter-item-tooltip.utils.d.ts +9 -0
- package/scatter/tooltip/scatter-item-tooltip.utils.d.ts.map +1 -0
- package/scatter/tooltip/scatter-item-tooltip.utils.js +83 -0
- package/scatter/tooltip/use-scatter-item-tooltip.d.ts +25 -0
- package/scatter/tooltip/use-scatter-item-tooltip.d.ts.map +1 -0
- package/scatter/tooltip/use-scatter-item-tooltip.js +46 -0
- package/tooltip/chart-pointer-tooltip-overlay.d.ts +11 -0
- package/tooltip/chart-pointer-tooltip-overlay.d.ts.map +1 -0
- package/tooltip/chart-pointer-tooltip-overlay.js +88 -0
- package/tooltip/chart-tooltip-preset-shells.d.ts +66 -0
- package/tooltip/chart-tooltip-preset-shells.d.ts.map +1 -0
- package/tooltip/chart-tooltip-preset-shells.js +409 -0
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.d.ts.map +1 -0
- package/tooltip/index.js +1 -0
package/README.md
CHANGED
|
@@ -1,7 +1,331 @@
|
|
|
1
1
|
# @wavemaker/react-native-echarts
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@wavemaker/react-native-echarts)
|
|
4
|
+
[](https://github.com/wavemaker/wm-react-native-echarts/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@wavemaker/react-native-echarts)
|
|
7
|
+
[](https://github.com/wavemaker/wm-react-native-echarts)
|
|
8
|
+
[](https://wavemaker.github.io/wm-react-native-echarts)
|
|
9
|
+
|
|
3
10
|
React Native chart components built with ECharts (via `@wuba/react-native-echarts`) and Skia. Works with Expo and bare React Native. Visit storybook at https://wavemaker.github.io/wm-react-native-echarts for more details on how to use and examples.
|
|
4
11
|
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Install the package from npm:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @wavemaker/react-native-echarts
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The library declares peer dependencies. Add any your app does not already include (align versions with your React Native or Expo SDK):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @shopify/react-native-skia @wuba/react-native-echarts echarts zrender react-native-svg
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`react` and `react-native` are also peers; they should already be present in your app.
|
|
27
|
+
|
|
28
|
+
**Note**:
|
|
29
|
+
There is an issue with echarts library. Due to which compilation fails with an error. Here is the link to the issue.
|
|
30
|
+
https://github.com/apache/echarts/pull/20485
|
|
31
|
+
|
|
32
|
+
Till the issue is fixed, follow the workaround mentioned in the below link.
|
|
33
|
+
https://github.com/wuba/react-native-echarts/issues/239#issuecomment-2899678660
|
|
34
|
+
|
|
35
|
+
## Chart gallery
|
|
36
|
+
|
|
37
|
+
Preview thumbnails for the chart examples in `assets/images/charts`. Each image uses the same width and height (200×200) so the layout stays even; `object-fit: contain` keeps aspect ratios readable.
|
|
38
|
+
|
|
39
|
+
### Area
|
|
40
|
+
|
|
41
|
+
<table>
|
|
42
|
+
<tbody>
|
|
43
|
+
<tr>
|
|
44
|
+
<td align="center">
|
|
45
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-area--axes-area" target="_blank">
|
|
46
|
+
<img src="assets/images/charts/area/default.png" width="200" height="200" alt="Default" style="object-fit: contain;" />
|
|
47
|
+
<br />
|
|
48
|
+
<sub>Default</sub>
|
|
49
|
+
</a>
|
|
50
|
+
</td>
|
|
51
|
+
<td align="center">
|
|
52
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-area--area-without-axes" target="_blank">
|
|
53
|
+
<img src="assets/images/charts/area/without-axes.png" width="200" height="200" alt="Witout axes" style="object-fit: contain;" /><br /><sub>Witout axes</sub>
|
|
54
|
+
</a>
|
|
55
|
+
</td>
|
|
56
|
+
<td align="center">
|
|
57
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-area--gradient-area" target="_blank">
|
|
58
|
+
<img src="assets/images/charts/area/with-gradient-bg.png" width="200" height="200" alt="With Gradient Bg" style="object-fit: contain;" /><br /><sub>With Gradient Bg</sub>
|
|
59
|
+
</a>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
</tbody>
|
|
63
|
+
</table>
|
|
64
|
+
|
|
65
|
+
### Bar
|
|
66
|
+
|
|
67
|
+
<table>
|
|
68
|
+
<tbody>
|
|
69
|
+
<tr>
|
|
70
|
+
<td align="center">
|
|
71
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-bar--horizontal-bar" target="_blank">
|
|
72
|
+
<img src="assets/images/charts/bar/horizontal-bar.png" width="200" height="200" alt="Horizontal bar chart" style="object-fit: contain;" /><br /><sub>horizontal-bar</sub>
|
|
73
|
+
</a>
|
|
74
|
+
</td>
|
|
75
|
+
<td align="center">
|
|
76
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-bar--custom-label-bar">
|
|
77
|
+
<img src="assets/images/charts/bar/labeled-bar.png" width="200" height="200" alt="Labeled bar chart" style="object-fit: contain;" /><br /><sub>labeled-bar</sub>
|
|
78
|
+
</a>
|
|
79
|
+
</td>
|
|
80
|
+
<td align="center">
|
|
81
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-bar--mixed-bar" target="_blank">
|
|
82
|
+
<img src="assets/images/charts/bar/mixed-bar.png" width="200" height="200" alt="Mixed bar chart" style="object-fit: contain;" /><br /><sub>mixed-bar</sub>
|
|
83
|
+
</a>
|
|
84
|
+
</td>
|
|
85
|
+
</tr>
|
|
86
|
+
</tbody>
|
|
87
|
+
</table>
|
|
88
|
+
|
|
89
|
+
### Bubble
|
|
90
|
+
|
|
91
|
+
<table>
|
|
92
|
+
<tbody>
|
|
93
|
+
<tr>
|
|
94
|
+
<td align="center">
|
|
95
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-bubble--default" target="_blank">
|
|
96
|
+
<img src="assets/images/charts/bubble/default.png" width="200" height="200" alt="Bubble chart default" style="object-fit: contain;" /><br /><sub>default</sub>
|
|
97
|
+
</a>
|
|
98
|
+
</td>
|
|
99
|
+
<td align="center">
|
|
100
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-bubble--show-legend">
|
|
101
|
+
<img src="assets/images/charts/bubble/multi-bubble.png" width="200" height="200" alt="Multi bubble chart" style="object-fit: contain;" /><br /><sub>multi-bubble</sub>
|
|
102
|
+
</a>
|
|
103
|
+
</td>
|
|
104
|
+
<td align="center">
|
|
105
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-bubble-symbol--pin" target="_blank">
|
|
106
|
+
<img src="assets/images/charts/bubble/pin-bublbe.png" width="200" height="200" alt="Bubble chart with pin" style="object-fit: contain;" /><br /><sub>pin-bublbe</sub>
|
|
107
|
+
</a>
|
|
108
|
+
</td>
|
|
109
|
+
</tr>
|
|
110
|
+
</tbody>
|
|
111
|
+
</table>
|
|
112
|
+
|
|
113
|
+
### Candlestick
|
|
114
|
+
|
|
115
|
+
<table>
|
|
116
|
+
<tbody>
|
|
117
|
+
<tr>
|
|
118
|
+
<td align="center">
|
|
119
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-candlestick--default" target="_blank">
|
|
120
|
+
<img src="assets/images/charts/candle-stick/default.png" width="200" height="200" alt="Candlestick default" style="object-fit: contain;" /><br /><sub>default</sub>
|
|
121
|
+
</a>
|
|
122
|
+
</td>
|
|
123
|
+
<td align="center">
|
|
124
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-candlestick--with-moving-average" target="_blank">
|
|
125
|
+
<img src="assets/images/charts/candle-stick/with-ma.png" width="200" height="200" alt="Candlestick with moving average" style="object-fit: contain;" /><br /><sub>with-ma</sub>
|
|
126
|
+
</a>
|
|
127
|
+
</td>
|
|
128
|
+
<td align="center">
|
|
129
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-candlestick--with-volume">
|
|
130
|
+
<img src="assets/images/charts/candle-stick/with-volume.png" width="200" height="200" alt="Candlestick with volume" style="object-fit: contain;" /><br /><sub>with-volume</sub>
|
|
131
|
+
</a>
|
|
132
|
+
</td>
|
|
133
|
+
</tr>
|
|
134
|
+
</tbody>
|
|
135
|
+
</table>
|
|
136
|
+
|
|
137
|
+
### Column
|
|
138
|
+
|
|
139
|
+
<table>
|
|
140
|
+
<tbody>
|
|
141
|
+
<tr>
|
|
142
|
+
<td align="center">
|
|
143
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-column--active-column">
|
|
144
|
+
<img src="assets/images/charts/column/active-column.png" width="200" height="200" alt="Active column chart" style="object-fit: contain;" /><br /><sub>active-column</sub>
|
|
145
|
+
</a>
|
|
146
|
+
</td>
|
|
147
|
+
<td align="center">
|
|
148
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-column--multiple-series">
|
|
149
|
+
<img src="assets/images/charts/column/multi-series.png" width="200" height="200" alt="Multi-series column chart" style="object-fit: contain;" /><br /><sub>multi-series</sub>
|
|
150
|
+
</a>
|
|
151
|
+
</td>
|
|
152
|
+
<td align="center">
|
|
153
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-column--standard-column">
|
|
154
|
+
<img src="assets/images/charts/column/standard.png" width="200" height="200" alt="Standard column chart" style="object-fit: contain;" /><br /><sub>standard</sub>
|
|
155
|
+
</a>
|
|
156
|
+
</td>
|
|
157
|
+
</tr>
|
|
158
|
+
</tbody>
|
|
159
|
+
</table>
|
|
160
|
+
|
|
161
|
+
### Geo
|
|
162
|
+
|
|
163
|
+
<table>
|
|
164
|
+
<tbody>
|
|
165
|
+
<tr>
|
|
166
|
+
<td align="center">
|
|
167
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-geo-colors--custom-colors" target="_blank">
|
|
168
|
+
<img src="assets/images/charts/geo/colors.png" width="200" height="200" alt="Geo chart colors" style="object-fit: contain;" /><br /><sub>colors</sub>
|
|
169
|
+
</a>
|
|
170
|
+
</td>
|
|
171
|
+
<td align="center">
|
|
172
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-geo--default" target="_blank">
|
|
173
|
+
<img src="assets/images/charts/geo/default.png" width="200" height="200" alt="Geo chart default" style="object-fit: contain;" /><br /><sub>default</sub>
|
|
174
|
+
</a>
|
|
175
|
+
</td>
|
|
176
|
+
<td align="center">
|
|
177
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-geo-map--presidential-results" target="_blank">
|
|
178
|
+
<img src="assets/images/charts/geo/us-map.png" width="200" height="200" alt="US map geo chart" style="object-fit: contain;" /><br /><sub>us-map</sub>
|
|
179
|
+
</a>
|
|
180
|
+
</td>
|
|
181
|
+
</tr>
|
|
182
|
+
</tbody>
|
|
183
|
+
</table>
|
|
184
|
+
|
|
185
|
+
### Gauge
|
|
186
|
+
|
|
187
|
+
<table>
|
|
188
|
+
<tbody>
|
|
189
|
+
<tr>
|
|
190
|
+
<td align="center">
|
|
191
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-gauge-digital--default" target="_blank">
|
|
192
|
+
<img src="assets/images/charts/guage/digital.png" width="200" height="200" alt="Digital gauge" style="object-fit: contain;" /><br /><sub>digital</sub>
|
|
193
|
+
</a>
|
|
194
|
+
</td>
|
|
195
|
+
<td align="center">
|
|
196
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-gauge-radial--custom-scale" target="_blank">
|
|
197
|
+
<img src="assets/images/charts/guage/radial.png" width="200" height="200" alt="Radial gauge" style="object-fit: contain;" /><br /><sub>radial</sub>
|
|
198
|
+
</a>
|
|
199
|
+
</td>
|
|
200
|
+
<td align="center">
|
|
201
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-gauge-simple--default" target="_blank">
|
|
202
|
+
<img src="assets/images/charts/guage/simple.png" width="200" height="200" alt="Simple gauge" style="object-fit: contain;" /><br /><sub>simple</sub>
|
|
203
|
+
</a>
|
|
204
|
+
</td>
|
|
205
|
+
</tr>
|
|
206
|
+
</tbody>
|
|
207
|
+
</table>
|
|
208
|
+
|
|
209
|
+
### Line
|
|
210
|
+
|
|
211
|
+
<table>
|
|
212
|
+
<tbody>
|
|
213
|
+
<tr>
|
|
214
|
+
<td align="center">
|
|
215
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-line--multiple-series" target="_blank">
|
|
216
|
+
<img src="assets/images/charts/line/multi-line.png" width="200" height="200" alt="Multi-line chart" style="object-fit: contain;" /><br /><sub>multi-line</sub>
|
|
217
|
+
</a>
|
|
218
|
+
</td>
|
|
219
|
+
<td align="center">
|
|
220
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-line--axes-line" target="_blank">
|
|
221
|
+
<img src="assets/images/charts/line/standard-line.png" width="200" height="200" alt="Standard line chart" style="object-fit: contain;" /><br /><sub>standard-line</sub>
|
|
222
|
+
</a>
|
|
223
|
+
</td>
|
|
224
|
+
<td align="center">
|
|
225
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/examples-line--default-line" target="_blank">
|
|
226
|
+
<img src="assets/images/charts/line/trend-line.png" width="200" height="200" alt="Trend line chart" style="object-fit: contain;" /><br /><sub>trend-line</sub>
|
|
227
|
+
</a>
|
|
228
|
+
</td>
|
|
229
|
+
</tr>
|
|
230
|
+
</tbody>
|
|
231
|
+
</table>
|
|
232
|
+
|
|
233
|
+
### Pie
|
|
234
|
+
|
|
235
|
+
<table>
|
|
236
|
+
<tbody>
|
|
237
|
+
<tr>
|
|
238
|
+
<td align="center">
|
|
239
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-pie-concentric--two-rings" target="_blank">
|
|
240
|
+
<img src="assets/images/charts/pie/concentric.png" width="200" height="200" alt="Concentric pie chart" style="object-fit: contain;" /><br /><sub>concentric</sub>
|
|
241
|
+
</a>
|
|
242
|
+
</td>
|
|
243
|
+
<td align="center">
|
|
244
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-pie-donut--donut" target="_blank">
|
|
245
|
+
<img src="assets/images/charts/pie/donut.png" width="200" height="200" alt="Donut chart" style="object-fit: contain;" /><br /><sub>donut</sub>
|
|
246
|
+
</a>
|
|
247
|
+
</td>
|
|
248
|
+
<td align="center">
|
|
249
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-pie--default" target="_blank">
|
|
250
|
+
<img src="assets/images/charts/pie/pie.png" width="200" height="200" alt="Pie chart" style="object-fit: contain;" /><br /><sub>pie</sub>
|
|
251
|
+
</a>
|
|
252
|
+
</td>
|
|
253
|
+
</tr>
|
|
254
|
+
</tbody>
|
|
255
|
+
</table>
|
|
256
|
+
|
|
257
|
+
### Radar
|
|
258
|
+
|
|
259
|
+
<table>
|
|
260
|
+
<tbody>
|
|
261
|
+
<tr>
|
|
262
|
+
<td align="center">
|
|
263
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-radar--default" target="_blank">
|
|
264
|
+
<img src="assets/images/charts/radar/default.png" width="200" height="200" alt="Radar chart default" style="object-fit: contain;" /><br /><sub>default</sub>
|
|
265
|
+
</a>
|
|
266
|
+
</td>
|
|
267
|
+
<td align="center">
|
|
268
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-radar-multiple--default" target="_blank">
|
|
269
|
+
<img src="assets/images/charts/radar/multiple.png" width="200" height="200" alt="Multiple radar chart" style="object-fit: contain;" /><br /><sub>multiple</sub>
|
|
270
|
+
</a>
|
|
271
|
+
</td>
|
|
272
|
+
<td align="center">
|
|
273
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-radar-symbol--circle" target="_blank">
|
|
274
|
+
<img src="assets/images/charts/radar/with-symbol.png" width="200" height="200" alt="Radar chart with symbol" style="object-fit: contain;" /><br /><sub>with-symbol</sub>
|
|
275
|
+
</a>
|
|
276
|
+
</td>
|
|
277
|
+
</tr>
|
|
278
|
+
</tbody>
|
|
279
|
+
</table>
|
|
280
|
+
|
|
281
|
+
### Radial
|
|
282
|
+
|
|
283
|
+
<table>
|
|
284
|
+
<tbody>
|
|
285
|
+
<tr>
|
|
286
|
+
<td align="center">
|
|
287
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-radial-colors--custom-colors" target="_blank">
|
|
288
|
+
<img src="assets/images/charts/radial/custom-colors.png" width="200" height="200" alt="Radial chart custom colors" style="object-fit: contain;" /><br /><sub>custom-colors</sub>
|
|
289
|
+
</a>
|
|
290
|
+
</td>
|
|
291
|
+
<td align="center">
|
|
292
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-radial--default" target="_blank">
|
|
293
|
+
<img src="assets/images/charts/radial/default.png" width="200" height="200" alt="Radial chart default" style="object-fit: contain;" /><br /><sub>default</sub>
|
|
294
|
+
</a>
|
|
295
|
+
</td>
|
|
296
|
+
<td align="center">
|
|
297
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-radial-colors--background" target="_blank">
|
|
298
|
+
<img src="assets/images/charts/radial/with-bg.png" width="200" height="200" alt="Radial chart with background" style="object-fit: contain;" /><br /><sub>with-bg</sub>
|
|
299
|
+
</a>
|
|
300
|
+
</td>
|
|
301
|
+
</tr>
|
|
302
|
+
</tbody>
|
|
303
|
+
</table>
|
|
304
|
+
|
|
305
|
+
### Scatter
|
|
306
|
+
|
|
307
|
+
<table>
|
|
308
|
+
<tbody>
|
|
309
|
+
<tr>
|
|
310
|
+
<td align="center">
|
|
311
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-scatter--default" target="_blank">
|
|
312
|
+
<img src="assets/images/charts/scatter/default.png" width="200" height="200" alt="Scatter chart default" style="object-fit: contain;" /><br /><sub>default</sub>
|
|
313
|
+
</a>
|
|
314
|
+
</td>
|
|
315
|
+
<td align="center">
|
|
316
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-scatter-colors--multiple-series-colors" target="_blank">
|
|
317
|
+
<img src="assets/images/charts/scatter/multi.png" width="200" height="200" alt="Multi scatter chart" style="object-fit: contain;" /><br /><sub>multi</sub>
|
|
318
|
+
</a>
|
|
319
|
+
</td>
|
|
320
|
+
<td align="center">
|
|
321
|
+
<a href="https://wavemaker.github.io/wm-react-native-echarts/?path=/story/charts-scatter-symbol--triangle" target="_blank">
|
|
322
|
+
<img src="assets/images/charts/scatter/with-symbol.png" width="200" height="200" alt="Scatter chart with symbol" style="object-fit: contain;" /><br /><sub>with-symbol</sub>
|
|
323
|
+
</a>
|
|
324
|
+
</td>
|
|
325
|
+
</tr>
|
|
326
|
+
</tbody>
|
|
327
|
+
</table>
|
|
328
|
+
|
|
5
329
|
---
|
|
6
330
|
|
|
7
331
|
## Building the library (maintainers)
|
|
@@ -18,20 +342,53 @@ cd dist/npm-packages/charts && npm publish
|
|
|
18
342
|
|
|
19
343
|
## Development
|
|
20
344
|
|
|
21
|
-
|
|
345
|
+
Work from the **repository root** (the directory that contains `package.json`, `components/`, and `stories/`).
|
|
346
|
+
|
|
347
|
+
### Browser (Storybook)
|
|
348
|
+
|
|
349
|
+
Storybook runs the chart stories in the browser with Vite. After install, it serves at **http://localhost:6006**.
|
|
22
350
|
|
|
23
351
|
```bash
|
|
24
352
|
npm install
|
|
25
|
-
|
|
26
|
-
npm run storybook # to checout the component stories
|
|
353
|
+
npm run storybook
|
|
27
354
|
```
|
|
28
355
|
|
|
356
|
+
### Mobile (Expo sample app)
|
|
357
|
+
|
|
358
|
+
The **`expo-app/`** project is a small Expo Router app that consumes the library via **[yalc](https://github.com/wclr/yalc)**. Install **`yalc` globally** first so those commands are on your `PATH`.
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
npm install -g yalc
|
|
362
|
+
cd /path/to/repo # repository root directory
|
|
363
|
+
npm install
|
|
364
|
+
npm run generate:package
|
|
365
|
+
cd expo-app
|
|
366
|
+
npm install
|
|
367
|
+
npx expo start
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Whenever you change library source under `components/` or related entry points, run **`npm run generate:package`** again from the repo root so the yalc-linked package is rebuilt and republished. When changes are not reflecting in the app even after reload, use **`npx expo start -c`**.
|
|
371
|
+
|
|
29
372
|
---
|
|
30
373
|
|
|
31
374
|
## Maintainers
|
|
32
375
|
|
|
33
376
|
This package is maintained by [WaveMaker](https://www.wavemaker.com/). The source repository is [wavemaker/wm-react-native-echarts](https://github.com/wavemaker/wm-react-native-echarts). Use [GitHub Issues](https://github.com/wavemaker/wm-react-native-echarts/issues) for bug reports and feature requests.
|
|
34
377
|
|
|
378
|
+
### Contributors
|
|
379
|
+
|
|
380
|
+
<table>
|
|
381
|
+
<tbody>
|
|
382
|
+
<tr>
|
|
383
|
+
<td align="center" width="96">
|
|
384
|
+
<a href="https://github.com/sboyina"><img src="https://avatars.githubusercontent.com/u/2254369?s=96&v=4" width="72" height="72" alt="sboyina" style="border-radius: 50%;" /><br /><sub><b>sboyina</b></sub></a>
|
|
385
|
+
</td>
|
|
386
|
+
</tr>
|
|
387
|
+
</tbody>
|
|
388
|
+
</table>
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
35
392
|
---
|
|
36
393
|
|
|
37
394
|
## License
|
package/area/area-chart.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AreaChartProps } from './area-chart.props';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export type { AreaChartProps, AreaChartSelectEvent, SeriesData, } from './area-chart.props';
|
|
3
|
+
export type { AreaChartProps, AreaChartSelectEvent, AreaChartAxisTooltipParams, AreaChartTooltipSeriesItem, SeriesData, } from './area-chart.props';
|
|
4
4
|
export declare const AreaChart: ((props: AreaChartProps & {
|
|
5
5
|
theme?: Partial<import("..").ChartTheme>;
|
|
6
6
|
} & {
|
package/area/area-chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"area-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/area-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"area-chart.d.ts","sourceRoot":"","sources":["../../../../components/chart/area/area-chart.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAWzD,OAAO,KAAqC,MAAM,OAAO,CAAC;AAS1D,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,UAAU,GACX,MAAM,oBAAoB,CAAC;AAuf5B,eAAO,MAAM,SAAS;;;;;;;CAEpB,CAAC"}
|
package/area/area-chart.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { withResponsiveContainer } from '../chart-container';
|
|
2
2
|
import { useChartTheme, withChartTheme } from '../chart-theme.context';
|
|
3
|
+
import { createAxisTooltipPreset, useAxisTooltip } from '../cartesian/tooltip';
|
|
3
4
|
import { SkiaChart, SkiaRenderer } from '@wuba/react-native-echarts';
|
|
4
5
|
import { LineChart } from 'echarts/charts';
|
|
5
6
|
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components';
|
|
6
7
|
import * as echarts from 'echarts/core';
|
|
7
8
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
8
|
-
import {
|
|
9
|
+
import { View } from 'react-native';
|
|
10
|
+
import { getAxis, valueAxisBoundsFromProps, xAxisBoundsFromProps } from '../axis';
|
|
11
|
+
import { echartsLegendLayoutFragment, mergeCartesianGridForLegend, } from '../legend/echarts-legend-layout';
|
|
9
12
|
// Register necessary components for this chart
|
|
10
13
|
echarts.use([
|
|
11
14
|
TooltipComponent,
|
|
@@ -14,14 +17,32 @@ echarts.use([
|
|
|
14
17
|
SkiaRenderer,
|
|
15
18
|
LineChart,
|
|
16
19
|
]);
|
|
17
|
-
const ChartComponent = ({ data, width = 220, height = 350, type = 'default', step, boundaryGap = false, stack, stackNormalize = false, symbol, symbolSize, areaOpacity = 0.6, areaFill = 'gradient', showXAxis = true, showXAxisTicks = true, showYAxis = true, showYAxisTicks = true, showXAxisSplitLines = true, showYAxisSplitLines = true, grid, showLegend =
|
|
20
|
+
const ChartComponent = ({ data, width = 220, height = 350, type = 'default', step, boundaryGap = false, stack, stackNormalize = false, symbol, symbolSize, areaOpacity = 0.6, areaFill = 'gradient', showXAxis = true, showXAxisTicks = true, showYAxis = true, showYAxisTicks = true, showXAxisSplitLines = true, showYAxisSplitLines = true, grid, showLegend = true, legendPosition = 'bottom', showHighlighter = true, tooltip = 'card', xAxisTickLabelFormatter, yAxisTickLabelFormatter, xAxisLabel, yAxisLabel, minX, maxX, intervalX, minY, maxY, intervalY, onSelect, renderTooltip, ...props }) => {
|
|
18
21
|
const { theme } = useChartTheme(props.theme, props.colors);
|
|
19
22
|
const chartRef = useRef(null);
|
|
20
23
|
const onSelectRef = useRef(onSelect);
|
|
21
24
|
onSelectRef.current = onSelect;
|
|
22
|
-
const
|
|
25
|
+
const axisTooltipContextRef = useRef({
|
|
23
26
|
displaySeries: [],
|
|
24
|
-
|
|
27
|
+
categoryAxisData: [],
|
|
28
|
+
});
|
|
29
|
+
const themeSeriesRef = useRef(theme.series);
|
|
30
|
+
themeSeriesRef.current = theme.series;
|
|
31
|
+
const tooltipOverlayActive = renderTooltip != null || tooltip !== 'none';
|
|
32
|
+
const renderTooltipFn = useMemo(() => {
|
|
33
|
+
if (renderTooltip != null)
|
|
34
|
+
return renderTooltip;
|
|
35
|
+
if (tooltip === 'none')
|
|
36
|
+
return () => null;
|
|
37
|
+
return createAxisTooltipPreset(tooltip);
|
|
38
|
+
}, [renderTooltip, tooltip]);
|
|
39
|
+
const { attachAxisTooltipListeners, renderAxisTooltipOverlay } = useAxisTooltip({
|
|
40
|
+
active: tooltipOverlayActive,
|
|
41
|
+
renderTooltip: renderTooltipFn,
|
|
42
|
+
contextRef: axisTooltipContextRef,
|
|
43
|
+
themeSeriesRef,
|
|
44
|
+
width,
|
|
45
|
+
height,
|
|
25
46
|
});
|
|
26
47
|
// Derive smooth/step from type
|
|
27
48
|
const effectiveSmooth = type === 'smooth';
|
|
@@ -85,31 +106,16 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
85
106
|
: { data: normalizedData };
|
|
86
107
|
});
|
|
87
108
|
}, [normalizedSeries, stackNormalize]);
|
|
109
|
+
const valueAxisBounds = useMemo(() => valueAxisBoundsFromProps({ minY, maxY, intervalY }), [minY, maxY, intervalY]);
|
|
110
|
+
const xAxisBounds = useMemo(() => xAxisBoundsFromProps({ minX, maxX, intervalX }), [minX, maxX, intervalX]);
|
|
88
111
|
const xAxisData = useMemo(() => {
|
|
89
112
|
const dataPoints = normalizedSeries
|
|
90
113
|
.map(s => s.data.map(item => item[0]))
|
|
91
114
|
.flat();
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, [normalizedSeries, xAxisTicks]);
|
|
96
|
-
selectContextRef.current = { displaySeries, xAxisData };
|
|
115
|
+
return getAxis(dataPoints).map(String);
|
|
116
|
+
}, [normalizedSeries]);
|
|
117
|
+
axisTooltipContextRef.current = { displaySeries, categoryAxisData: xAxisData };
|
|
97
118
|
const option = useMemo(() => {
|
|
98
|
-
// Build tooltip config
|
|
99
|
-
// axisPointer with snap: true so the pointer snaps to data points and triggers
|
|
100
|
-
// series emphasis (circle) at the hovered position. See https://echarts.apache.org/en/option.html#tooltip.axisPointer
|
|
101
|
-
const tooltipConfig = showHighlighter ? {
|
|
102
|
-
trigger: 'axis',
|
|
103
|
-
axisPointer: {
|
|
104
|
-
type: 'line',
|
|
105
|
-
snap: true,
|
|
106
|
-
lineStyle: {
|
|
107
|
-
type: 'solid',
|
|
108
|
-
width: 1,
|
|
109
|
-
color: theme.series[0].color ?? '#999',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
} : null;
|
|
113
119
|
// Build xAxis config (category with data indices)
|
|
114
120
|
const xAxisConfig = {
|
|
115
121
|
type: 'category',
|
|
@@ -135,7 +141,7 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
135
141
|
show: false,
|
|
136
142
|
},
|
|
137
143
|
axisTick: {
|
|
138
|
-
show: showXAxisTicks,
|
|
144
|
+
show: showXAxis && showXAxisTicks,
|
|
139
145
|
lineStyle: {
|
|
140
146
|
color: theme.axis.x.tickColor,
|
|
141
147
|
width: theme.axis.x.tickWidth,
|
|
@@ -148,15 +154,15 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
148
154
|
width: theme.axis.x.splitLineWidth,
|
|
149
155
|
},
|
|
150
156
|
},
|
|
157
|
+
boundaryGap,
|
|
158
|
+
...(xAxisBounds ?? {}),
|
|
151
159
|
};
|
|
152
|
-
|
|
153
|
-
// Build yAxis config (value, auto-scale from data)
|
|
160
|
+
// Build yAxis config (value axis: optional min/max/interval; else ECharts auto-scale, except stack-normalized %)
|
|
154
161
|
const yAxisConfig = {
|
|
155
162
|
type: 'value',
|
|
156
|
-
...(stackNormalize && displaySeries.length > 1
|
|
157
|
-
min: 0,
|
|
158
|
-
|
|
159
|
-
}),
|
|
163
|
+
...(stackNormalize && displaySeries.length > 1
|
|
164
|
+
? { min: 0, max: 100 }
|
|
165
|
+
: (valueAxisBounds ?? {})),
|
|
160
166
|
...(yAxisLabel != null && yAxisLabel !== '' && {
|
|
161
167
|
name: yAxisLabel,
|
|
162
168
|
nameLocation: 'middle',
|
|
@@ -180,7 +186,7 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
180
186
|
show: false,
|
|
181
187
|
},
|
|
182
188
|
axisTick: {
|
|
183
|
-
show: showYAxisTicks,
|
|
189
|
+
show: showYAxis && showYAxisTicks,
|
|
184
190
|
lineStyle: {
|
|
185
191
|
color: theme.axis.y.tickColor,
|
|
186
192
|
width: theme.axis.y.tickWidth,
|
|
@@ -195,16 +201,19 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
195
201
|
},
|
|
196
202
|
};
|
|
197
203
|
// Build legend config
|
|
198
|
-
const legendConfigFinal = showLegend && hasNamedSeries
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
const legendConfigFinal = showLegend && hasNamedSeries
|
|
205
|
+
? {
|
|
206
|
+
data: normalizedSeries
|
|
207
|
+
.filter((s) => 'name' in s && s.name)
|
|
208
|
+
.map((s) => s.name),
|
|
209
|
+
...echartsLegendLayoutFragment(legendPosition),
|
|
210
|
+
textStyle: {
|
|
211
|
+
color: theme.legend.textColor,
|
|
212
|
+
fontSize: theme.legend.fontSize,
|
|
213
|
+
},
|
|
214
|
+
backgroundColor: theme.legend.backgroundColor,
|
|
215
|
+
}
|
|
216
|
+
: undefined;
|
|
208
217
|
// Build series config (use displaySeries so stackNormalize uses percentage data)
|
|
209
218
|
const seriesConfig = displaySeries.map((s, index) => {
|
|
210
219
|
const seriesColor = theme.series[index % theme.series.length].color;
|
|
@@ -280,18 +289,31 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
280
289
|
return series;
|
|
281
290
|
});
|
|
282
291
|
const config = {
|
|
283
|
-
tooltip: tooltipConfig,
|
|
284
292
|
xAxis: xAxisConfig,
|
|
285
293
|
yAxis: yAxisConfig,
|
|
286
294
|
series: seriesConfig,
|
|
295
|
+
axisPointer: {
|
|
296
|
+
show: true,
|
|
297
|
+
type: 'line',
|
|
298
|
+
snap: true,
|
|
299
|
+
lineStyle: {
|
|
300
|
+
type: 'solid',
|
|
301
|
+
width: 1,
|
|
302
|
+
color: '#00000000',
|
|
303
|
+
show: false,
|
|
304
|
+
},
|
|
305
|
+
label: {
|
|
306
|
+
show: false,
|
|
307
|
+
}
|
|
308
|
+
}
|
|
287
309
|
};
|
|
288
310
|
// Add legend if configured
|
|
289
311
|
if (legendConfigFinal) {
|
|
290
312
|
config.legend = legendConfigFinal;
|
|
291
313
|
}
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
config.grid =
|
|
314
|
+
const mergedGrid = mergeCartesianGridForLegend(grid, legendPosition, showLegend, hasNamedSeries);
|
|
315
|
+
if (mergedGrid !== undefined && Object.keys(mergedGrid).length > 0) {
|
|
316
|
+
config.grid = mergedGrid;
|
|
295
317
|
}
|
|
296
318
|
return config;
|
|
297
319
|
}, [
|
|
@@ -317,16 +339,20 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
317
339
|
showYAxisSplitLines,
|
|
318
340
|
grid,
|
|
319
341
|
showLegend,
|
|
342
|
+
legendPosition,
|
|
320
343
|
hasNamedSeries,
|
|
321
344
|
showHighlighter,
|
|
345
|
+
tooltipOverlayActive,
|
|
322
346
|
xAxisTickLabelFormatter,
|
|
323
347
|
yAxisTickLabelFormatter,
|
|
324
|
-
xAxisTicks,
|
|
325
348
|
xAxisLabel,
|
|
326
349
|
yAxisLabel,
|
|
350
|
+
valueAxisBounds,
|
|
351
|
+
xAxisBounds,
|
|
327
352
|
]);
|
|
328
353
|
useEffect(() => {
|
|
329
354
|
let chart;
|
|
355
|
+
let detachAxisTooltip = () => { };
|
|
330
356
|
if (chartRef.current) {
|
|
331
357
|
try {
|
|
332
358
|
chart = echarts.init(chartRef.current, 'light', {
|
|
@@ -334,6 +360,7 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
334
360
|
height: height,
|
|
335
361
|
});
|
|
336
362
|
chart.setOption(option);
|
|
363
|
+
detachAxisTooltip = attachAxisTooltipListeners(chart);
|
|
337
364
|
const handleSeriesClick = (params) => {
|
|
338
365
|
const cb = onSelectRef.current;
|
|
339
366
|
if (typeof cb !== 'function')
|
|
@@ -347,7 +374,7 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
347
374
|
dataIndex < 0) {
|
|
348
375
|
return;
|
|
349
376
|
}
|
|
350
|
-
const { displaySeries: ds,
|
|
377
|
+
const { displaySeries: ds, categoryAxisData: xd } = axisTooltipContextRef.current;
|
|
351
378
|
const s = ds[seriesIndex];
|
|
352
379
|
if (!s?.data || !Array.isArray(s.data))
|
|
353
380
|
return;
|
|
@@ -386,6 +413,7 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
386
413
|
}
|
|
387
414
|
}
|
|
388
415
|
return () => {
|
|
416
|
+
detachAxisTooltip();
|
|
389
417
|
if (chart) {
|
|
390
418
|
try {
|
|
391
419
|
chart.dispose();
|
|
@@ -395,8 +423,11 @@ const ChartComponent = ({ data, width = 220, height = 350, type = 'default', ste
|
|
|
395
423
|
}
|
|
396
424
|
}
|
|
397
425
|
};
|
|
398
|
-
}, [option, width, height]);
|
|
399
|
-
return <
|
|
426
|
+
}, [option, width, height, attachAxisTooltipListeners]);
|
|
427
|
+
return (<View style={{ width, height, position: 'relative' }}>
|
|
428
|
+
<SkiaChart ref={chartRef} useRNGH/>
|
|
429
|
+
{renderAxisTooltipOverlay()}
|
|
430
|
+
</View>);
|
|
400
431
|
};
|
|
401
432
|
const AreaChartComponent = withResponsiveContainer(withChartTheme(ChartComponent));
|
|
402
433
|
export const AreaChart = Object.assign(AreaChartComponent, {
|