react-native-wagmi-charts 1.8.0 → 2.0.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.
- package/.DS_Store +0 -0
- package/README.md +331 -196
- package/example/.DS_Store +0 -0
- package/example/src/LineChart.tsx +10 -4
- package/example/src/data/line-data.json +20 -20
- package/lib/commonjs/charts/candle/utils/getDomain.js +19 -0
- package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/getHeight.js +19 -0
- package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/getPrice.js +20 -0
- package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/getY.js +19 -0
- package/lib/commonjs/charts/candle/utils/getY.js.map +1 -0
- package/lib/commonjs/charts/candle/utils/index.js +58 -0
- package/lib/commonjs/charts/candle/utils/index.js.map +1 -0
- package/lib/commonjs/charts/line/Chart.js +9 -3
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/ChartPath.js +73 -17
- package/lib/commonjs/charts/line/ChartPath.js.map +1 -1
- package/lib/commonjs/charts/line/Context.js +1 -0
- package/lib/commonjs/charts/line/Context.js.map +1 -1
- package/lib/commonjs/charts/line/Cursor.js +1 -0
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +10 -3
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +6 -6
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/DatetimeText.js +2 -0
- package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/line/Dot.js +67 -62
- package/lib/commonjs/charts/line/Dot.js.map +1 -1
- package/lib/commonjs/charts/line/Gradient.js +8 -25
- package/lib/commonjs/charts/line/Gradient.js.map +1 -1
- package/lib/commonjs/charts/line/Group.js +5 -25
- package/lib/commonjs/charts/line/Group.js.map +1 -1
- package/lib/commonjs/charts/line/Highlight.js +92 -0
- package/lib/commonjs/charts/line/Highlight.js.map +1 -0
- package/lib/commonjs/charts/line/HorizontalLine.js +6 -6
- package/lib/commonjs/charts/line/HorizontalLine.js.map +1 -1
- package/lib/commonjs/charts/line/Path.js +19 -30
- package/lib/commonjs/charts/line/Path.js.map +1 -1
- package/lib/commonjs/charts/line/PriceText.js +2 -0
- package/lib/commonjs/charts/line/PriceText.js.map +1 -1
- package/lib/commonjs/charts/line/Tooltip.js +2 -0
- package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
- package/lib/commonjs/charts/line/index.js +47 -20
- package/lib/commonjs/charts/line/index.js.map +1 -1
- package/lib/commonjs/charts/line/useAnimatedPath.js +44 -0
- package/lib/commonjs/charts/line/useAnimatedPath.js.map +1 -0
- package/lib/commonjs/charts/line/{utils.js → utils/getArea.js} +2 -49
- package/lib/commonjs/charts/line/utils/getArea.js.map +1 -0
- package/lib/commonjs/charts/line/utils/getDomain.js +16 -0
- package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -0
- package/lib/commonjs/charts/line/utils/getPath.js +34 -0
- package/lib/commonjs/charts/line/utils/getPath.js.map +1 -0
- package/lib/commonjs/charts/line/utils/index.js +71 -0
- package/lib/commonjs/charts/line/utils/index.js.map +1 -0
- package/lib/commonjs/charts/line/{interpolatePath.js → utils/interpolatePath.js} +1 -1
- package/lib/commonjs/charts/line/{interpolatePath.js.map → utils/interpolatePath.js.map} +1 -1
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +27 -0
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js.map +1 -0
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/formatDatetime.js +21 -0
- package/lib/commonjs/utils/formatDatetime.js.map +1 -0
- package/lib/commonjs/utils/formatPrice.js +46 -0
- package/lib/commonjs/utils/formatPrice.js.map +1 -0
- package/lib/commonjs/utils/index.js +45 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/{utils.js → utils/usePrevious.js} +1 -57
- package/lib/commonjs/utils/usePrevious.js.map +1 -0
- package/lib/module/charts/candle/utils/getDomain.js +12 -0
- package/lib/module/charts/candle/utils/getDomain.js.map +1 -0
- package/lib/module/charts/candle/utils/getHeight.js +11 -0
- package/lib/module/charts/candle/utils/getHeight.js.map +1 -0
- package/lib/module/charts/candle/utils/getPrice.js +12 -0
- package/lib/module/charts/candle/utils/getPrice.js.map +1 -0
- package/lib/module/charts/candle/utils/getY.js +11 -0
- package/lib/module/charts/candle/utils/getY.js.map +1 -0
- package/lib/module/charts/candle/utils/index.js +5 -0
- package/lib/module/charts/candle/utils/index.js.map +1 -0
- package/lib/module/charts/line/Chart.js +9 -4
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/ChartPath.js +69 -17
- package/lib/module/charts/line/ChartPath.js.map +1 -1
- package/lib/module/charts/line/Context.js +1 -0
- package/lib/module/charts/line/Context.js.map +1 -1
- package/lib/module/charts/line/Cursor.js +1 -0
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js +10 -4
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js +4 -3
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/DatetimeText.js +1 -0
- package/lib/module/charts/line/DatetimeText.js.map +1 -1
- package/lib/module/charts/line/Dot.js +66 -63
- package/lib/module/charts/line/Dot.js.map +1 -1
- package/lib/module/charts/line/Gradient.js +8 -24
- package/lib/module/charts/line/Gradient.js.map +1 -1
- package/lib/module/charts/line/Group.js +2 -24
- package/lib/module/charts/line/Group.js.map +1 -1
- package/lib/module/charts/line/Highlight.js +69 -0
- package/lib/module/charts/line/Highlight.js.map +1 -0
- package/lib/module/charts/line/HorizontalLine.js +4 -3
- package/lib/module/charts/line/HorizontalLine.js.map +1 -1
- package/lib/module/charts/line/Path.js +17 -29
- package/lib/module/charts/line/Path.js.map +1 -1
- package/lib/module/charts/line/PriceText.js +1 -0
- package/lib/module/charts/line/PriceText.js.map +1 -1
- package/lib/module/charts/line/Tooltip.js +1 -0
- package/lib/module/charts/line/Tooltip.js.map +1 -1
- package/lib/module/charts/line/index.js +12 -8
- package/lib/module/charts/line/index.js.map +1 -1
- package/lib/module/charts/line/useAnimatedPath.js +34 -0
- package/lib/module/charts/line/useAnimatedPath.js.map +1 -0
- package/lib/module/charts/line/utils/getArea.js +19 -0
- package/lib/module/charts/line/utils/getArea.js.map +1 -0
- package/lib/module/charts/line/utils/getDomain.js +9 -0
- package/lib/module/charts/line/utils/getDomain.js.map +1 -0
- package/lib/module/charts/line/utils/getPath.js +21 -0
- package/lib/module/charts/line/utils/getPath.js.map +1 -0
- package/lib/module/charts/line/utils/index.js +6 -0
- package/lib/module/charts/line/utils/index.js.map +1 -0
- package/lib/module/charts/line/{interpolatePath.js → utils/interpolatePath.js} +1 -1
- package/lib/module/charts/line/{interpolatePath.js.map → utils/interpolatePath.js.map} +1 -1
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js +20 -0
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/formatDatetime.js +14 -0
- package/lib/module/utils/formatDatetime.js.map +1 -0
- package/lib/module/{utils.js → utils/formatPrice.js} +1 -29
- package/lib/module/utils/formatPrice.js.map +1 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/utils/usePrevious.js +14 -0
- package/lib/module/utils/usePrevious.js.map +1 -0
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +2 -0
- package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +6 -0
- package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +6 -0
- package/lib/typescript/src/charts/candle/utils/getY.d.ts +6 -0
- package/lib/typescript/src/charts/candle/utils/index.d.ts +4 -0
- package/lib/typescript/src/charts/line/Chart.d.ts +5 -1
- package/lib/typescript/src/charts/line/ChartPath.d.ts +10 -1
- package/lib/typescript/src/charts/line/Context.d.ts +3 -0
- package/lib/typescript/src/charts/line/Cursor.d.ts +3 -0
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +4 -1
- package/lib/typescript/src/charts/line/CursorLine.d.ts +4 -1
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +3 -0
- package/lib/typescript/src/charts/line/Dot.d.ts +10 -7
- package/lib/typescript/src/charts/line/Gradient.d.ts +3 -0
- package/lib/typescript/src/charts/line/Group.d.ts +1 -2
- package/lib/typescript/src/charts/line/Highlight.d.ts +15 -0
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts +4 -1
- package/lib/typescript/src/charts/line/Path.d.ts +5 -1
- package/lib/typescript/src/charts/line/PriceText.d.ts +3 -0
- package/lib/typescript/src/charts/line/Tooltip.d.ts +3 -0
- package/lib/typescript/src/charts/line/index.d.ts +15 -25
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +8 -0
- package/lib/typescript/src/charts/line/utils/getArea.d.ts +9 -0
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts +2 -0
- package/lib/typescript/src/charts/line/utils/getPath.d.ts +11 -0
- package/lib/typescript/src/charts/line/utils/index.d.ts +5 -0
- package/lib/typescript/src/charts/line/{interpolatePath.d.ts → utils/interpolatePath.d.ts} +1 -1
- package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/utils/formatDatetime.d.ts +8 -0
- package/lib/typescript/src/utils/formatPrice.d.ts +8 -0
- package/lib/typescript/src/utils/index.d.ts +3 -0
- package/lib/typescript/src/utils/usePrevious.d.ts +1 -0
- package/package.json +4 -2
- package/src/charts/candle/utils/getDomain.ts +9 -0
- package/src/charts/candle/utils/getHeight.ts +21 -0
- package/src/charts/candle/utils/getPrice.ts +17 -0
- package/src/charts/candle/utils/getY.ts +16 -0
- package/src/charts/candle/utils/index.ts +4 -0
- package/src/charts/line/Chart.tsx +9 -3
- package/src/charts/line/ChartPath.tsx +109 -33
- package/src/charts/line/Context.tsx +2 -0
- package/src/charts/line/Cursor.tsx +2 -0
- package/src/charts/line/CursorCrosshair.tsx +20 -5
- package/src/charts/line/CursorLine.tsx +5 -3
- package/src/charts/line/DatetimeText.tsx +2 -0
- package/src/charts/line/Dot.tsx +83 -86
- package/src/charts/line/Gradient.tsx +7 -34
- package/src/charts/line/Group.tsx +4 -47
- package/src/charts/line/Highlight.tsx +78 -0
- package/src/charts/line/HorizontalLine.tsx +5 -3
- package/src/charts/line/Path.tsx +14 -38
- package/src/charts/line/PriceText.tsx +2 -0
- package/src/charts/line/Tooltip.tsx +2 -0
- package/src/charts/line/index.ts +11 -7
- package/src/charts/line/useAnimatedPath.ts +47 -0
- package/src/charts/line/utils/getArea.ts +38 -0
- package/src/charts/line/utils/getDomain.ts +7 -0
- package/src/charts/line/utils/getPath.ts +48 -0
- package/src/charts/line/utils/index.ts +5 -0
- package/src/charts/line/{interpolatePath.ts → utils/interpolatePath.ts} +1 -1
- package/src/charts/line/utils/lineChartDataPropToArray.ts +25 -0
- package/src/index.ts +1 -1
- package/src/utils/formatDatetime.ts +16 -0
- package/src/{utils.ts → utils/formatPrice.ts} +0 -31
- package/src/utils/index.ts +3 -0
- package/src/utils/usePrevious.ts +13 -0
- package/yarn.lock +8 -1
- package/lib/commonjs/charts/line/utils.js.map +0 -1
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/module/charts/line/utils.js +0 -60
- package/lib/module/charts/line/utils.js.map +0 -1
- package/lib/module/utils.js.map +0 -1
- package/lib/typescript/src/charts/line/utils.d.ts +0 -20
- package/lib/typescript/src/utils.d.ts +0 -17
- package/src/charts/line/utils.ts +0 -100
package/README.md
CHANGED
|
@@ -31,23 +31,34 @@ A sweet & simple chart library for React Native that will make us feel like **W*
|
|
|
31
31
|
- [Basic Usage](#basic-usage)
|
|
32
32
|
- [Line chart](#line-chart)
|
|
33
33
|
- [Candlestick chart](#candlestick-chart)
|
|
34
|
-
- [Guides](#guides)
|
|
34
|
+
- [Line Chart Guides](#line-chart-guides)
|
|
35
35
|
- [Interactive cursors](#interactive-cursors)
|
|
36
36
|
- [Interactive labels](#interactive-labels)
|
|
37
37
|
- [Interactive tooltips](#interactive-tooltips)
|
|
38
38
|
- [Haptic feedback](#haptic-feedback)
|
|
39
39
|
- [Colors](#colors)
|
|
40
40
|
- [Gradients](#gradients)
|
|
41
|
+
- [Dots](#dots)
|
|
42
|
+
- [Horizontal lines](#horizontal-lines)
|
|
41
43
|
- [Customizing size](#customizing-size)
|
|
42
44
|
- [Customizing labels](#customizing-labels)
|
|
43
45
|
- [Customizing tooltips](#customizing-tooltips)
|
|
46
|
+
- [Candlestick Chart Guides](#candlestick-chart-guides)
|
|
47
|
+
- [Interactive cursors](#interactive-cursors-1)
|
|
48
|
+
- [Interactive labels](#interactive-labels-1)
|
|
49
|
+
- [Interactive tooltips](#interactive-tooltips-1)
|
|
50
|
+
- [Haptic feedback](#haptic-feedback-1)
|
|
51
|
+
- [Colors](#colors-1)
|
|
52
|
+
- [Customizing labels](#customizing-labels-1)
|
|
44
53
|
- [Component APIs](#component-apis)
|
|
45
54
|
- [LineChart.Provider](#linechartprovider)
|
|
46
55
|
- [LineChart](#linechart)
|
|
47
56
|
- [LineChart.Path](#linechartpath)
|
|
48
57
|
- [LineChart.CursorCrosshair](#linechartcursorcrosshair-1)
|
|
49
58
|
- [LineChart.CursorLine](#linechartcursorline-1)
|
|
50
|
-
- [LineChart.
|
|
59
|
+
- [LineChart.Dot](#linechartdot)
|
|
60
|
+
- [LineChart.Highlight](#linechartdot)
|
|
61
|
+
- [LineChart.HorizontalLine](#linecharthorizontalline)
|
|
51
62
|
- [LineChart.Gradient](#linechartgradient)
|
|
52
63
|
- [LineChart.Tooltip](#linecharttooltip)
|
|
53
64
|
- [LineChart.PriceText](#linechartpricetext)
|
|
@@ -55,7 +66,7 @@ A sweet & simple chart library for React Native that will make us feel like **W*
|
|
|
55
66
|
- [CandlestickChart.Provider](#candlestickchartprovider)
|
|
56
67
|
- [CandlestickChart](#candlestickchart)
|
|
57
68
|
- [CandlestickChart.Candles](#candlestickchartcandles)
|
|
58
|
-
- [CandlestickChart.Crosshair](#candlestickchartcrosshair
|
|
69
|
+
- [CandlestickChart.Crosshair](#candlestickchartcrosshair)
|
|
59
70
|
- [CandlestickChart.Tooltip](#candlestickcharttooltip)
|
|
60
71
|
- [CandlestickChart.PriceText](#candlestickchartpricetext)
|
|
61
72
|
- [CandlestickChart.DatetimeText](#candlestickchartdatetimetext)
|
|
@@ -67,9 +78,7 @@ A sweet & simple chart library for React Native that will make us feel like **W*
|
|
|
67
78
|
- [CandlestickChart.useCandleData](#candlestickchartusecandledata)
|
|
68
79
|
- [CandlestickChart.useDatetime](#candlestickchartusedatetime)
|
|
69
80
|
- [CandlestickChart.usePrice](#candlestickchartuseprice)
|
|
70
|
-
- [Web Support
|
|
71
|
-
- [Disable Transitions](#disable-transitions)
|
|
72
|
-
- [Reanimated Version](#reanimated-version)
|
|
81
|
+
- [Web Support](#web-support)
|
|
73
82
|
- [Credits](#credits)
|
|
74
83
|
|
|
75
84
|
## Install
|
|
@@ -184,14 +193,12 @@ function Example() {
|
|
|
184
193
|
}
|
|
185
194
|
```
|
|
186
195
|
|
|
187
|
-
## Guides
|
|
196
|
+
## Line Chart Guides
|
|
188
197
|
|
|
189
|
-
Below are some guides to help you make your charts suit your brand. Hopefully a combination of the below will enable you to make a great chart! :-)
|
|
198
|
+
Below are some line chart guides to help you make your charts suit your brand. Hopefully a combination of the below will enable you to make a great chart! :-)
|
|
190
199
|
|
|
191
200
|
### Interactive cursors
|
|
192
201
|
|
|
193
|
-
#### Line chart
|
|
194
|
-
|
|
195
202
|
To render an interactive cursor on your line chart, you can include either the `LineChart.CursorCrosshair` or `LineChart.CursorLine` components:
|
|
196
203
|
|
|
197
204
|
##### `LineChart.CursorCrosshair`
|
|
@@ -220,53 +227,8 @@ To render an interactive cursor on your line chart, you can include either the `
|
|
|
220
227
|
|
|
221
228
|
<img src="https://user-images.githubusercontent.com/7336481/133027471-1c620ece-a95e-46b7-bd92-50f33757ce92.gif" width="200px" />
|
|
222
229
|
|
|
223
|
-
##### `LineChart.HorizontalLine`
|
|
224
|
-
|
|
225
|
-
It's a static horizontal line which moves whenever your data change. It's located on height of point which is on `at` position of provided data.
|
|
226
|
-
|
|
227
|
-
```jsx
|
|
228
|
-
<LineChart.Provider data={data}>
|
|
229
|
-
<LineChart>
|
|
230
|
-
<LineChart.Path>
|
|
231
|
-
<LineChart.HorizontalLine at={{ index: 0 }} />
|
|
232
|
-
</LineChart.Path>
|
|
233
|
-
</LineChart>
|
|
234
|
-
</LineChart.Provider>
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
To pass a Y value to your `HorizontalLine` instead, you can use `value`:
|
|
238
|
-
|
|
239
|
-
```jsx
|
|
240
|
-
<LineChart.Provider data={data}>
|
|
241
|
-
<LineChart>
|
|
242
|
-
<LineChart.Path>
|
|
243
|
-
<LineChart.HorizontalLine at={{ value: 3027.84 }} />
|
|
244
|
-
</LineChart.Path>
|
|
245
|
-
</LineChart>
|
|
246
|
-
</LineChart.Provider>
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
#### Candlestick chart
|
|
250
|
-
|
|
251
|
-
To render an interactive cursor on your candlestick chart, you can include the `CandlestickChart.Crosshair` component:
|
|
252
|
-
|
|
253
|
-
##### `CandlestickChart.Crosshair`
|
|
254
|
-
|
|
255
|
-
```jsx
|
|
256
|
-
<CandlestickChart.Provider data={data}>
|
|
257
|
-
<CandlestickChart>
|
|
258
|
-
<CandlestickChart.Candles />
|
|
259
|
-
<CandlestickChart.Crosshair />
|
|
260
|
-
</CandlestickChart>
|
|
261
|
-
</CandlestickChart.Provider>
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
<img src="https://user-images.githubusercontent.com/7336481/133027656-a877b248-77c1-4bf3-822f-a05dee4efa20.gif" width="200px" />
|
|
265
|
-
|
|
266
230
|
### Interactive labels
|
|
267
231
|
|
|
268
|
-
#### Line chart
|
|
269
|
-
|
|
270
232
|
To render an interactive label on your line chart as your cursor moves along the graph, you can use the `PriceText` or `DatetimeText` components:
|
|
271
233
|
|
|
272
234
|
> Note: These components **must** be within the `LineChart.Provider` component.
|
|
@@ -284,32 +246,8 @@ To render an interactive label on your line chart as your cursor moves along the
|
|
|
284
246
|
|
|
285
247
|
<img src="https://user-images.githubusercontent.com/7336481/133028134-a0b65499-9edf-4535-9fcc-fcf8c1e4e0c4.gif" width="200px" />
|
|
286
248
|
|
|
287
|
-
#### Candlestick chart
|
|
288
|
-
|
|
289
|
-
To render an interactive label on your candlestick chart, you can use the `PriceText` or `DatetimeText` components:
|
|
290
|
-
|
|
291
|
-
> Note: These components **must** be within the `CandlestickChart.Provider` component.
|
|
292
|
-
|
|
293
|
-
```jsx
|
|
294
|
-
<CandlestickChart.Provider data={data}>
|
|
295
|
-
<CandlestickChart>
|
|
296
|
-
<CandlestickChart.Candles />
|
|
297
|
-
<CandlestickChart.Crosshair />
|
|
298
|
-
</CandlestickChart>
|
|
299
|
-
<CandlestickChart.PriceText type="open" />
|
|
300
|
-
<CandlestickChart.PriceText type="high" />
|
|
301
|
-
<CandlestickChart.PriceText type="low" />
|
|
302
|
-
<CandlestickChart.PriceText type="close" />
|
|
303
|
-
<CandlestickChart.DatetimeText />
|
|
304
|
-
</LineChart.Provider>
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
<img src="https://user-images.githubusercontent.com/7336481/133034935-faea61e6-09c2-4dba-a1ab-555d1ebee880.gif" width="200px" />
|
|
308
|
-
|
|
309
249
|
### Interactive tooltips
|
|
310
250
|
|
|
311
|
-
#### Line charts
|
|
312
|
-
|
|
313
251
|
To render an interactive tooltip that follows your cursor, you can use the `Tooltip` component.
|
|
314
252
|
|
|
315
253
|
```jsx
|
|
@@ -343,29 +281,10 @@ You can even add another tooltip to show something like date/time:
|
|
|
343
281
|
|
|
344
282
|
<img src="https://user-images.githubusercontent.com/7336481/133036011-8a9b4865-10dd-4e88-9fd1-1e109435a73c.gif" width="200px" />
|
|
345
283
|
|
|
346
|
-
#### Candlestick charts
|
|
347
|
-
|
|
348
|
-
To render an interactive tooltip that follows your crosshair, you can use the `Tooltip` component.
|
|
349
|
-
|
|
350
|
-
```jsx
|
|
351
|
-
<CandlestickChart.Provider data={data}>
|
|
352
|
-
<CandlestickChart>
|
|
353
|
-
<CandlestickChart.Candles />
|
|
354
|
-
<CandlestickChart.Crosshair>
|
|
355
|
-
<CandlestickChart.Tooltip />
|
|
356
|
-
</CandlestickChart.Crosshair>
|
|
357
|
-
</CandlestickChart>
|
|
358
|
-
</CandlestickChart.Provider>
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
<img src="https://user-images.githubusercontent.com/7336481/133036451-e1f2f12b-9e96-4a0f-8c69-4f630bb8ded3.gif" width="200px" />
|
|
362
|
-
|
|
363
284
|
### Haptic feedback
|
|
364
285
|
|
|
365
286
|
By making use of the chart event handlers, you are able to integrate haptic feedback into your charts.
|
|
366
287
|
|
|
367
|
-
#### Line charts
|
|
368
|
-
|
|
369
288
|
We can utilise the `onActivated` and `onEnded` events to create haptic feedback on our line chart.
|
|
370
289
|
|
|
371
290
|
```jsx
|
|
@@ -420,40 +339,11 @@ function Example() {
|
|
|
420
339
|
}
|
|
421
340
|
```
|
|
422
341
|
|
|
423
|
-
#### Candlestick charts
|
|
424
|
-
|
|
425
|
-
We can utilise the `onCurrentXChange` event to create haptic feedback on our candlestick chart.
|
|
426
|
-
|
|
427
|
-
```jsx
|
|
428
|
-
import * as haptics from 'expo-haptics';
|
|
429
|
-
|
|
430
|
-
const data = [...];
|
|
431
|
-
|
|
432
|
-
function invokeHaptic() {
|
|
433
|
-
haptics.impactAsync(haptics.ImpactFeedbackStyle.Light);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
function Example() {
|
|
437
|
-
return (
|
|
438
|
-
<CandlestickChart.Provider data={data}>
|
|
439
|
-
<CandlestickChart>
|
|
440
|
-
<CandlestickChart.Candles />
|
|
441
|
-
<CandlestickChart.Crosshair onCurrentXChange={invokeHaptic}>
|
|
442
|
-
<CandlestickChart.Tooltip />
|
|
443
|
-
</CandlestickChart.Crosshair>
|
|
444
|
-
</CandlestickChart>
|
|
445
|
-
</CandlestickChart.Provider>
|
|
446
|
-
)
|
|
447
|
-
}
|
|
448
|
-
```
|
|
449
|
-
|
|
450
342
|
### Colors
|
|
451
343
|
|
|
452
344
|
By default, the charts come with default colors out-of-the-box... But you probably will want to change these to suit your brand.
|
|
453
345
|
|
|
454
|
-
####
|
|
455
|
-
|
|
456
|
-
##### Coloring the path
|
|
346
|
+
#### Coloring the path
|
|
457
347
|
|
|
458
348
|
To customise the color of the line chart path, supply a `color` prop to `LineChart.Path`. This can be any valid React Native `StyleSheet` compatible color.
|
|
459
349
|
|
|
@@ -467,7 +357,7 @@ To customise the color of the line chart path, supply a `color` prop to `LineCha
|
|
|
467
357
|
|
|
468
358
|
<img src="https://user-images.githubusercontent.com/7336481/133037040-ce13ba5b-6ee5-45a2-ba14-18bf12e13746.png" width="200px" />
|
|
469
359
|
|
|
470
|
-
|
|
360
|
+
#### Coloring the cursor
|
|
471
361
|
|
|
472
362
|
To customise the color of the line chart cursor, supply a `color` prop to `LineChart.CursorCrosshair`. This can be any valid React Native `StyleSheet` compatible color.
|
|
473
363
|
|
|
@@ -484,66 +374,101 @@ To customise the color of the line chart cursor, supply a `color` prop to `LineC
|
|
|
484
374
|
|
|
485
375
|
<img width="200px" alt="Screen Shot 2021-09-13 at 4 53 46 pm" src="https://user-images.githubusercontent.com/7336481/133037333-6b1345e5-a98b-459c-b3b1-6e5b08143f33.png">
|
|
486
376
|
|
|
487
|
-
|
|
377
|
+
### Gradients
|
|
488
378
|
|
|
489
|
-
|
|
379
|
+
By using the `LineChart.Gradient` component, you can apply a gradient to the area underneath your path.
|
|
490
380
|
|
|
491
|
-
|
|
381
|
+
```jsx
|
|
382
|
+
<LineChart.Provider data={data}>
|
|
383
|
+
<LineChart>
|
|
384
|
+
<LineChart.Path color="red">
|
|
385
|
+
<LineChart.Gradient />
|
|
386
|
+
<LineChart.Path>
|
|
387
|
+
</LineChart>
|
|
388
|
+
</LineChart.Provider>
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
<img width="346" alt="Screen Shot 2021-10-25 at 8 32 07 pm" src="https://user-images.githubusercontent.com/7336481/138672128-c691036e-404f-4148-8a3b-00ea2f7df27f.png">
|
|
392
|
+
|
|
393
|
+
The gradient will inherit your path's color by default, however, you can provide a color prop to `LineChart.Gradient`:
|
|
492
394
|
|
|
493
395
|
```jsx
|
|
494
|
-
<
|
|
495
|
-
<
|
|
496
|
-
<
|
|
497
|
-
|
|
498
|
-
|
|
396
|
+
<LineChart.Provider data={data}>
|
|
397
|
+
<LineChart>
|
|
398
|
+
<LineChart.Path color="red">
|
|
399
|
+
<LineChart.Gradient color="black" />
|
|
400
|
+
<LineChart.Path>
|
|
401
|
+
</LineChart>
|
|
402
|
+
</LineChart.Provider>
|
|
499
403
|
```
|
|
500
404
|
|
|
501
|
-
<img width="
|
|
405
|
+
<img width="345" alt="Screen Shot 2021-10-25 at 8 32 26 pm" src="https://user-images.githubusercontent.com/7336481/138672153-9ba11b02-b750-4ab0-a2e2-c18a9af4635f.png">
|
|
502
406
|
|
|
503
|
-
|
|
407
|
+
### Dots
|
|
504
408
|
|
|
505
|
-
|
|
409
|
+
You can render dots on your line chart with `LineChart.Dot`.
|
|
506
410
|
|
|
507
411
|
```jsx
|
|
508
|
-
<
|
|
509
|
-
<
|
|
510
|
-
<
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
</
|
|
412
|
+
<LineChart.Provider data={data}>
|
|
413
|
+
<LineChart>
|
|
414
|
+
<LineChart.Path>
|
|
415
|
+
<LineChart.Dot color="red" at={10} />
|
|
416
|
+
</LineChart.Path>
|
|
417
|
+
</LineChart>
|
|
418
|
+
</LineChart.Provider>
|
|
514
419
|
```
|
|
515
420
|
|
|
516
|
-
|
|
421
|
+
Your dot can also have an animated pulse by passing the `hasPulse` prop.
|
|
517
422
|
|
|
518
|
-
|
|
423
|
+
```jsx
|
|
424
|
+
<LineChart.Provider data={data}>
|
|
425
|
+
<LineChart>
|
|
426
|
+
<LineChart.Path>
|
|
427
|
+
<LineChart.Dot color="red" at={10} hasPulse />
|
|
428
|
+
</LineChart.Path>
|
|
429
|
+
</LineChart>
|
|
430
|
+
</LineChart.Provider>
|
|
431
|
+
```
|
|
519
432
|
|
|
520
|
-
|
|
433
|
+
### Path highlighting
|
|
434
|
+
|
|
435
|
+
You can highlight a section of your path with `LineChart.Highlight`.
|
|
521
436
|
|
|
522
437
|
```jsx
|
|
523
438
|
<LineChart.Provider data={data}>
|
|
524
439
|
<LineChart>
|
|
525
|
-
<LineChart.Path color="red">
|
|
526
|
-
<LineChart.Gradient />
|
|
527
440
|
<LineChart.Path>
|
|
441
|
+
<LineChart.Highlight color="red" from={10} to={15} />
|
|
442
|
+
</LineChart.Path>
|
|
528
443
|
</LineChart>
|
|
529
444
|
</LineChart.Provider>
|
|
530
445
|
```
|
|
531
446
|
|
|
532
|
-
|
|
447
|
+
### Horizontal lines
|
|
533
448
|
|
|
534
|
-
|
|
449
|
+
You can render a static horizontal line on your line chart which moves whenever your data change. It's located on height of point which is on `at` position of provided data.
|
|
535
450
|
|
|
536
451
|
```jsx
|
|
537
452
|
<LineChart.Provider data={data}>
|
|
538
453
|
<LineChart>
|
|
539
|
-
<LineChart.Path color="red">
|
|
540
|
-
<LineChart.Gradient color="black" />
|
|
541
454
|
<LineChart.Path>
|
|
455
|
+
<LineChart.HorizontalLine at={{ index: 0 }} />
|
|
456
|
+
</LineChart.Path>
|
|
542
457
|
</LineChart>
|
|
543
458
|
</LineChart.Provider>
|
|
544
459
|
```
|
|
545
460
|
|
|
546
|
-
|
|
461
|
+
You can also pass a (y) value to `HorizontalLine` with the `value` attribute:
|
|
462
|
+
|
|
463
|
+
```jsx
|
|
464
|
+
<LineChart.Provider data={data}>
|
|
465
|
+
<LineChart>
|
|
466
|
+
<LineChart.Path>
|
|
467
|
+
<LineChart.HorizontalLine at={{ value: 3027.84 }} />
|
|
468
|
+
</LineChart.Path>
|
|
469
|
+
</LineChart>
|
|
470
|
+
</LineChart.Provider>
|
|
471
|
+
```
|
|
547
472
|
|
|
548
473
|
### Customizing size
|
|
549
474
|
|
|
@@ -567,7 +492,6 @@ By default, the price labels have a precision of `2`, meaning that the prices wi
|
|
|
567
492
|
|
|
568
493
|
```jsx
|
|
569
494
|
<LineChart.PriceText precision={4} />
|
|
570
|
-
<CandlestickChart.PriceText precision={4} />
|
|
571
495
|
```
|
|
572
496
|
|
|
573
497
|
##### Custom formatting
|
|
@@ -656,6 +580,188 @@ You can customize the gutters of the tooltip by providing `cursorGutter`, `xGutt
|
|
|
656
580
|
|
|
657
581
|
<img src="https://user-images.githubusercontent.com/7336481/133054393-28d542c1-c9fc-4ba6-b4a0-86cf096ebcda.gif" width="200px" />
|
|
658
582
|
|
|
583
|
+
## Candlestick Chart Guides
|
|
584
|
+
|
|
585
|
+
### Interactive cursors
|
|
586
|
+
|
|
587
|
+
To render an interactive cursor on your candlestick chart, you can include the `CandlestickChart.Crosshair` component:
|
|
588
|
+
|
|
589
|
+
```jsx
|
|
590
|
+
<CandlestickChart.Provider data={data}>
|
|
591
|
+
<CandlestickChart>
|
|
592
|
+
<CandlestickChart.Candles />
|
|
593
|
+
<CandlestickChart.Crosshair />
|
|
594
|
+
</CandlestickChart>
|
|
595
|
+
</CandlestickChart.Provider>
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
<img src="https://user-images.githubusercontent.com/7336481/133027656-a877b248-77c1-4bf3-822f-a05dee4efa20.gif" width="200px" />
|
|
599
|
+
|
|
600
|
+
### Interactive labels
|
|
601
|
+
|
|
602
|
+
To render an interactive label on your candlestick chart, you can use the `PriceText` or `DatetimeText` components:
|
|
603
|
+
|
|
604
|
+
> Note: These components **must** be within the `CandlestickChart.Provider` component.
|
|
605
|
+
|
|
606
|
+
```jsx
|
|
607
|
+
<CandlestickChart.Provider data={data}>
|
|
608
|
+
<CandlestickChart>
|
|
609
|
+
<CandlestickChart.Candles />
|
|
610
|
+
<CandlestickChart.Crosshair />
|
|
611
|
+
</CandlestickChart>
|
|
612
|
+
<CandlestickChart.PriceText type="open" />
|
|
613
|
+
<CandlestickChart.PriceText type="high" />
|
|
614
|
+
<CandlestickChart.PriceText type="low" />
|
|
615
|
+
<CandlestickChart.PriceText type="close" />
|
|
616
|
+
<CandlestickChart.DatetimeText />
|
|
617
|
+
</LineChart.Provider>
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
<img src="https://user-images.githubusercontent.com/7336481/133034935-faea61e6-09c2-4dba-a1ab-555d1ebee880.gif" width="200px" />
|
|
621
|
+
|
|
622
|
+
### Interactive tooltips
|
|
623
|
+
|
|
624
|
+
To render an interactive tooltip that follows your crosshair, you can use the `Tooltip` component.
|
|
625
|
+
|
|
626
|
+
```jsx
|
|
627
|
+
<CandlestickChart.Provider data={data}>
|
|
628
|
+
<CandlestickChart>
|
|
629
|
+
<CandlestickChart.Candles />
|
|
630
|
+
<CandlestickChart.Crosshair>
|
|
631
|
+
<CandlestickChart.Tooltip />
|
|
632
|
+
</CandlestickChart.Crosshair>
|
|
633
|
+
</CandlestickChart>
|
|
634
|
+
</CandlestickChart.Provider>
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
<img src="https://user-images.githubusercontent.com/7336481/133036451-e1f2f12b-9e96-4a0f-8c69-4f630bb8ded3.gif" width="200px" />
|
|
638
|
+
|
|
639
|
+
### Haptic feedback
|
|
640
|
+
|
|
641
|
+
By making use of the chart event handlers, you are able to integrate haptic feedback into your charts.
|
|
642
|
+
|
|
643
|
+
We can utilise the `onCurrentXChange` event to create haptic feedback on our candlestick chart.
|
|
644
|
+
|
|
645
|
+
```jsx
|
|
646
|
+
import * as haptics from 'expo-haptics';
|
|
647
|
+
|
|
648
|
+
const data = [...];
|
|
649
|
+
|
|
650
|
+
function invokeHaptic() {
|
|
651
|
+
haptics.impactAsync(haptics.ImpactFeedbackStyle.Light);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
function Example() {
|
|
655
|
+
return (
|
|
656
|
+
<CandlestickChart.Provider data={data}>
|
|
657
|
+
<CandlestickChart>
|
|
658
|
+
<CandlestickChart.Candles />
|
|
659
|
+
<CandlestickChart.Crosshair onCurrentXChange={invokeHaptic}>
|
|
660
|
+
<CandlestickChart.Tooltip />
|
|
661
|
+
</CandlestickChart.Crosshair>
|
|
662
|
+
</CandlestickChart>
|
|
663
|
+
</CandlestickChart.Provider>
|
|
664
|
+
)
|
|
665
|
+
}
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### Colors
|
|
669
|
+
|
|
670
|
+
By default, the charts come with default colors out-of-the-box... But you probably will want to change these to suit your brand.
|
|
671
|
+
|
|
672
|
+
#### Coloring the candles
|
|
673
|
+
|
|
674
|
+
To customise the color of the candlestick chart candles, supply a `negativeColor` and a `positiveColor` to `CandlestickChart.Candles`. This can be any valid React Native `StyleSheet` compatible color.
|
|
675
|
+
|
|
676
|
+
```jsx
|
|
677
|
+
<CandlestickChart.Provider data={data}>
|
|
678
|
+
<CandlestickChart>
|
|
679
|
+
<CandlestickChart.Candles positiveColor="hotpink" negativeColor="black" />
|
|
680
|
+
</CandlestickChart>
|
|
681
|
+
</CandlestickChart.Provider>
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
<img width="200px" alt="Screen Shot 2021-09-13 at 4 58 52 pm" src="https://user-images.githubusercontent.com/7336481/133037949-aba76daa-20bb-4d4e-b05e-b0cff42b69a6.png">
|
|
685
|
+
|
|
686
|
+
#### Coloring the crosshair
|
|
687
|
+
|
|
688
|
+
To customise the color of the line chart cursor, supply a `color` prop to `CandlestickChart.Crosshair`. This can be any valid React Native `StyleSheet` compatible color.
|
|
689
|
+
|
|
690
|
+
```jsx
|
|
691
|
+
<CandlestickChart.Provider data={data}>
|
|
692
|
+
<CandlestickChart>
|
|
693
|
+
<CandlestickChart.Candles positiveColor="hotpink" negativeColor="black" />
|
|
694
|
+
<CandlestickChart.Crosshair color="hotpink" />
|
|
695
|
+
</CandlestickChart>
|
|
696
|
+
</CandlestickChart.Provider>
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
<img width="200px" alt="Screen Shot 2021-09-13 at 4 58 52 pm" src="https://user-images.githubusercontent.com/7336481/133038181-33ee91bf-a5e2-4124-ab7b-df745a5ba804.gif">
|
|
700
|
+
|
|
701
|
+
### Customizing labels
|
|
702
|
+
|
|
703
|
+
#### Price labels
|
|
704
|
+
|
|
705
|
+
##### Precision
|
|
706
|
+
|
|
707
|
+
By default, the price labels have a precision of `2`, meaning that the prices will always be to 2 decimal places. However, you can customize this with the `precision` prop:
|
|
708
|
+
|
|
709
|
+
```jsx
|
|
710
|
+
<CandlestickChart.PriceText precision={4} />
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
##### Custom formatting
|
|
714
|
+
|
|
715
|
+
To customize the formatting of the price text, you can supply a `format` function in the form of a [reanimated worklet](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/worklets):
|
|
716
|
+
|
|
717
|
+
> Note: due to the nature of reanimated worklets, you cannot define functions that run on the React Native JS thread. [Read more here](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/worklets)
|
|
718
|
+
|
|
719
|
+
```jsx
|
|
720
|
+
<CandlestickChart.PriceText
|
|
721
|
+
format={({ value }) => {
|
|
722
|
+
'worklet';
|
|
723
|
+
const formattedPrice = yourOwnFormatValueFn(value);
|
|
724
|
+
return `$${formattedPrice} AUD`;
|
|
725
|
+
}}
|
|
726
|
+
/>
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
#### Datetime labels
|
|
730
|
+
|
|
731
|
+
##### Date/time options
|
|
732
|
+
|
|
733
|
+
Internally, WAGMI charts uses [`Date.prototype.toLocaleString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString) to generate the date/time label. You can customise it's options like so:
|
|
734
|
+
|
|
735
|
+
```jsx
|
|
736
|
+
<CandlestickChart.DatetimeText
|
|
737
|
+
locale="en-AU"
|
|
738
|
+
options={{
|
|
739
|
+
year: 'numeric',
|
|
740
|
+
month: 'numeric',
|
|
741
|
+
day: 'numeric',
|
|
742
|
+
hour: 'numeric',
|
|
743
|
+
minute: 'numeric',
|
|
744
|
+
second: 'numeric',
|
|
745
|
+
}}
|
|
746
|
+
/>
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
##### Custom formatting
|
|
750
|
+
|
|
751
|
+
To customize the formatting of the date/time text, you can supply a `format` function in the form of a [reanimated worklet](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/worklets):
|
|
752
|
+
|
|
753
|
+
> Note: due to the nature of reanimated worklets, you cannot define functions that run on the React Native JS thread. [Read more here](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/worklets)
|
|
754
|
+
|
|
755
|
+
```jsx
|
|
756
|
+
<CandlestickChart.DatetimeText
|
|
757
|
+
format={({ value }) => {
|
|
758
|
+
'worklet';
|
|
759
|
+
const formattedDate = yourOwnFormatValueFn(value);
|
|
760
|
+
return formattedDate;
|
|
761
|
+
}}
|
|
762
|
+
/>
|
|
763
|
+
```
|
|
764
|
+
|
|
659
765
|
## Component APIs
|
|
660
766
|
|
|
661
767
|
### LineChart.Provider
|
|
@@ -702,13 +808,42 @@ You can customize the gutters of the tooltip by providing `cursorGutter`, `xGutt
|
|
|
702
808
|
| `color` | `string` | `"gray"` | Color of the cursor line |
|
|
703
809
|
| `lineProps` | `LineProps` | | Props of the cursor line. Takes React Native SVG's `Line` props. |
|
|
704
810
|
|
|
811
|
+
### LineChart.Dot
|
|
812
|
+
|
|
813
|
+
| Prop | Type | Default | Description |
|
|
814
|
+
| ------------------- | -------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
815
|
+
| `at` | `number` | | Index of followed `data` item. |
|
|
816
|
+
| `color` | `string` | `"black"` | Color of the dot |
|
|
817
|
+
| `size` | `number` | `4` | Size of the dot. |
|
|
818
|
+
| `inactiveColor` | `string` | | Color of the dot when the chart is inactive. |
|
|
819
|
+
| `showInactiveColor` | `boolean` | `true` | Whether or not to show the inactive dot when the chart is inactive. |
|
|
820
|
+
| `hasOuterDot` | `boolean` | `false` | Whether or not the dot has an outer circle. |
|
|
821
|
+
| `hasPulse` | `boolean` | `false` | Whether or not the dot has an animated pulse. |
|
|
822
|
+
| `outerSize` | `number` | `16` | Size of the outer dot. |
|
|
823
|
+
| `pulseBehaviour` | `"while-inactive"` or `"always"` | `"while-inactive"` | Behaviour of the pulse. If `always`, the outer dot will still animate when interaction is active. If `while-inactive`, the outer dot will animate only when the interaction is inactive. |
|
|
824
|
+
| `pulseDurationMs` | `number` | `800` | Duration in ms of the pulse animation. |
|
|
825
|
+
| `dotProps` | `CircleProps` | | Props of the dot (accepts React Native SVG's `Circle` props). |
|
|
826
|
+
| `outerDotProps` | `CircleProps` | | Props of the outer dot (accepts React Native SVG's `Circle` props). |
|
|
827
|
+
|
|
828
|
+
### LineChart.Highlight
|
|
829
|
+
|
|
830
|
+
| Prop | Type | Default | Description |
|
|
831
|
+
| ------------------- | --------- | --------- | ------------------------------------------------------------------------- |
|
|
832
|
+
| `from` | `number` | | Data index of where to start the highlight. |
|
|
833
|
+
| `to` | `number` | | Data index of where to end the highlight. |
|
|
834
|
+
| `color` | `string` | `"black"` | Color of the highlighted path. |
|
|
835
|
+
| `inactiveColor` | `string` | | Color of the highlight when the chart is inactive. |
|
|
836
|
+
| `showInactiveColor` | `boolean` | `true` | Whether or not to show the inactive highlight when the chart is inactive. |
|
|
837
|
+
| `width` | `number` | `3` | Width of the highlight stroke. |
|
|
838
|
+
|
|
839
|
+
|
|
705
840
|
### LineChart.HorizontalLine
|
|
706
841
|
|
|
707
|
-
| Prop | Type
|
|
708
|
-
| ----------- |
|
|
709
|
-
| `color` | `string`
|
|
710
|
-
| `lineProps` | `LineProps`
|
|
711
|
-
| `at` | `number
|
|
842
|
+
| Prop | Type | Default | Description |
|
|
843
|
+
| ----------- | ------------------------------------------------------ | -------- | ---------------------------------------------------------------------------------------------------------- |
|
|
844
|
+
| `color` | `string` | `"gray"` | Color of the cursor line |
|
|
845
|
+
| `lineProps` | `LineProps` | | Props of the cursor line. Takes React Native SVG's `Line` props. |
|
|
846
|
+
| `at` | `number` or `{ index: number }` or `{ value: number }` | `0` | Index of followed `data` item. You can alternatively pass `{ value: number }`, corresponding to a y value. |
|
|
712
847
|
|
|
713
848
|
### LineChart.Gradient
|
|
714
849
|
|
|
@@ -719,31 +854,31 @@ You can customize the gutters of the tooltip by providing `cursorGutter`, `xGutt
|
|
|
719
854
|
|
|
720
855
|
### LineChart.Tooltip
|
|
721
856
|
|
|
722
|
-
| Prop
|
|
723
|
-
|
|
|
724
|
-
| `xGutter`
|
|
725
|
-
| `yGutter`
|
|
726
|
-
| `cursorGutter` | `number`
|
|
727
|
-
| `position`
|
|
857
|
+
| Prop | Type | Default | Description |
|
|
858
|
+
| -------------- | --------------------- | ------- | ---------------------------------------------------- |
|
|
859
|
+
| `xGutter` | `number` | `8` | X axis gutter in which the tooltip will not pass. |
|
|
860
|
+
| `yGutter` | `number` | `8` | Y axis gutter in which the tooltip will not pass. |
|
|
861
|
+
| `cursorGutter` | `number` | `48` | Gutter (spacing) between the cursor and the tooltip. |
|
|
862
|
+
| `position` | `"top"` or `"bottom"` | `"top"` | Position of the tooltip relative to the cursor. |
|
|
728
863
|
|
|
729
864
|
### LineChart.PriceText
|
|
730
865
|
|
|
731
|
-
| Prop
|
|
732
|
-
|
|
|
733
|
-
| `format`
|
|
734
|
-
| `precision` | `number`
|
|
735
|
-
| `variant`
|
|
736
|
-
| `...props`
|
|
866
|
+
| Prop | Type | Default | Description |
|
|
867
|
+
| ----------- | ---------------------------------- | ------------- | ------------------------------------------ |
|
|
868
|
+
| `format` | `({ value, formatted }) => string` | | Custom format function of the price. |
|
|
869
|
+
| `precision` | `number` | `2` | Default precision of the price. |
|
|
870
|
+
| `variant` | `"formatted"` or `"value"` | `"formatted"` | Default representation of the price value. |
|
|
871
|
+
| `...props` | `TextProps` | | Inherits React Native's `Text` props |
|
|
737
872
|
|
|
738
873
|
### LineChart.DatetimeText
|
|
739
874
|
|
|
740
|
-
| Prop
|
|
741
|
-
|
|
|
742
|
-
| `format`
|
|
743
|
-
| `locale`
|
|
744
|
-
| `options` | `{}`
|
|
745
|
-
| `style`
|
|
746
|
-
| `variant` | `"formatted"
|
|
875
|
+
| Prop | Type | Default | Description |
|
|
876
|
+
| --------- | ---------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
877
|
+
| `format` | `({ value, formatted }) => string` | | Custom format function of the timestamp. |
|
|
878
|
+
| `locale` | `string` | `"en-US"` | Locale of the timestamp. |
|
|
879
|
+
| `options` | `{}` | | Options to pass to `toLocaleString()`. [Available options are here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString) |
|
|
880
|
+
| `style` | `{}` | | Style of the price text |
|
|
881
|
+
| `variant` | `"formatted"` or `"value"` | `"formatted"` | Default representation of the timestamp value. |
|
|
747
882
|
|
|
748
883
|
### CandlestickChart.Provider
|
|
749
884
|
|
|
@@ -774,8 +909,8 @@ You can customize the gutters of the tooltip by providing `cursorGutter`, `xGutt
|
|
|
774
909
|
### CandlestickChart.Crosshair
|
|
775
910
|
|
|
776
911
|
| Prop | Type | Default | Description |
|
|
777
|
-
| ------------------ | ------------------------------ | --------- | ------------------------------------------------ |
|
|
778
|
-
| `color` | `string` | `"black"` | Color of the crosshair |
|
|
912
|
+
| ------------------ | ------------------------------ | --------- | ------------------------------------------------ |
|
|
913
|
+
| `color` | `string` | `"black"` | Color of the crosshair |
|
|
779
914
|
| `onCurrentXChange` | `(xValue: number) => void` | | Callback to invoke when the x coordinate changes |
|
|
780
915
|
| `...props` | `LongPressGestureHandlerProps` | | |
|
|
781
916
|
|
|
@@ -790,22 +925,22 @@ You can customize the gutters of the tooltip by providing `cursorGutter`, `xGutt
|
|
|
790
925
|
|
|
791
926
|
### CandlestickChart.PriceText
|
|
792
927
|
|
|
793
|
-
| Prop
|
|
794
|
-
|
|
|
795
|
-
| `format`
|
|
796
|
-
| `precision` | `number`
|
|
797
|
-
| `variant`
|
|
798
|
-
| `...props`
|
|
928
|
+
| Prop | Type | Default | Description |
|
|
929
|
+
| ----------- | ---------------------------------- | ------------- | ------------------------------------------ |
|
|
930
|
+
| `format` | `({ value, formatted }) => string` | | Custom format function of the price. |
|
|
931
|
+
| `precision` | `number` | `2` | Default precision of the price. |
|
|
932
|
+
| `variant` | `"formatted"` or `"value"` | `"formatted"` | Default representation of the price value. |
|
|
933
|
+
| `...props` | `TextProps` | | Inherits React Native's `Text` props |
|
|
799
934
|
|
|
800
935
|
### CandlestickChart.DatetimeText
|
|
801
936
|
|
|
802
|
-
| Prop
|
|
803
|
-
|
|
|
804
|
-
| `format`
|
|
805
|
-
| `locale`
|
|
806
|
-
| `options` | `{}`
|
|
807
|
-
| `style`
|
|
808
|
-
| `variant` | `"formatted"
|
|
937
|
+
| Prop | Type | Default | Description |
|
|
938
|
+
| --------- | ---------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
939
|
+
| `format` | `({ value, formatted }) => string` | | Custom format function of the timestamp. |
|
|
940
|
+
| `locale` | `string` | `"en-US"` | Locale of the timestamp. |
|
|
941
|
+
| `options` | `{}` | | Options to pass to `toLocaleString()`. [Available options are here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString) |
|
|
942
|
+
| `style` | `{}` | | Style of the price text |
|
|
943
|
+
| `variant` | `"formatted"` or `"value"` | `"formatted"` | Default representation of the timestamp value. |
|
|
809
944
|
|
|
810
945
|
## Hooks
|
|
811
946
|
|