react-native-wagmi-charts 2.3.0 → 2.4.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/.editorconfig +15 -0
- package/.gitattributes +3 -0
- package/.gitignore +60 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc.js +5 -0
- package/.yarnrc +3 -0
- package/README.md +25 -24
- package/babel.config.js +3 -0
- package/example/.expo/README.md +8 -0
- package/example/.expo/devices.json +3 -0
- package/example/README.md +32 -0
- package/example/app.json +22 -0
- package/example/babel.config.js +23 -0
- package/example/index.js +8 -0
- package/example/metro.config.js +40 -0
- package/example/package.json +42 -0
- package/example/src/App.tsx +64 -0
- package/example/src/CandlestickChart.tsx +155 -0
- package/example/src/LineChart.tsx +267 -0
- package/example/src/data/candlestick-data.json +142 -0
- package/example/src/data/candlestick-data2.json +142 -0
- package/example/src/data/line-data-non-linear-domain.json +34 -0
- package/example/src/data/line-data.json +82 -0
- package/example/src/data/line-data2.json +82 -0
- package/example/src/line-data-gh.json +18 -0
- package/example/tsconfig.json +6 -0
- package/example/webpack.config.js +25 -0
- package/example/yarn.lock +9306 -0
- package/lib/commonjs/charts/candle/Candle.js +6 -19
- package/lib/commonjs/charts/candle/Candle.js.map +1 -1
- package/lib/commonjs/charts/candle/Candles.js +6 -13
- package/lib/commonjs/charts/candle/Candles.js.map +1 -1
- package/lib/commonjs/charts/candle/Chart.js +3 -12
- package/lib/commonjs/charts/candle/Chart.js.map +1 -1
- package/lib/commonjs/charts/candle/Context.js +4 -12
- package/lib/commonjs/charts/candle/Context.js.map +1 -1
- package/lib/commonjs/charts/candle/Crosshair.js +3 -18
- package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
- package/lib/commonjs/charts/candle/CrosshairTooltip.js +6 -21
- package/lib/commonjs/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/commonjs/charts/candle/DatetimeText.js +2 -8
- package/lib/commonjs/charts/candle/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/candle/HoverTrap/index.web.js +11 -25
- package/lib/commonjs/charts/candle/HoverTrap/index.web.js.map +1 -1
- package/lib/commonjs/charts/candle/Line.js +3 -12
- package/lib/commonjs/charts/candle/Line.js.map +1 -1
- package/lib/commonjs/charts/candle/PriceText.js +2 -8
- package/lib/commonjs/charts/candle/PriceText.js.map +1 -1
- package/lib/commonjs/charts/candle/index.js +1 -32
- package/lib/commonjs/charts/candle/index.js.map +1 -1
- package/lib/commonjs/charts/candle/types.js.map +1 -1
- package/lib/commonjs/charts/candle/useCandleData.js +0 -4
- package/lib/commonjs/charts/candle/useCandleData.js.map +1 -1
- package/lib/commonjs/charts/candle/useCandlestickChart.js +2 -7
- package/lib/commonjs/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/commonjs/charts/candle/useDatetime.js +0 -4
- package/lib/commonjs/charts/candle/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/candle/usePrice.js +0 -8
- package/lib/commonjs/charts/candle/usePrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getDomain.js +0 -1
- package/lib/commonjs/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getHeight.js +0 -2
- package/lib/commonjs/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getPrice.js +0 -2
- package/lib/commonjs/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/getY.js +0 -2
- package/lib/commonjs/charts/candle/utils/getY.js.map +1 -1
- package/lib/commonjs/charts/candle/utils/index.js +0 -8
- package/lib/commonjs/charts/candle/utils/index.js.map +1 -1
- package/lib/commonjs/charts/candle/utils.js +1 -6
- package/lib/commonjs/charts/candle/utils.js.map +1 -1
- package/lib/commonjs/charts/line/Chart.js +9 -28
- package/lib/commonjs/charts/line/Chart.js.map +1 -1
- package/lib/commonjs/charts/line/ChartPath.js +23 -46
- package/lib/commonjs/charts/line/ChartPath.js.map +1 -1
- package/lib/commonjs/charts/line/Context.js +8 -19
- package/lib/commonjs/charts/line/Context.js.map +1 -1
- package/lib/commonjs/charts/line/Cursor.js +41 -66
- package/lib/commonjs/charts/line/Cursor.js.map +1 -1
- package/lib/commonjs/charts/line/CursorCrosshair.js +5 -14
- package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/commonjs/charts/line/CursorLine.js +5 -19
- package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
- package/lib/commonjs/charts/line/Data.js +5 -17
- package/lib/commonjs/charts/line/Data.js.map +1 -1
- package/lib/commonjs/charts/line/DatetimeText.js +2 -9
- package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
- package/lib/commonjs/charts/line/Dot.js +27 -33
- package/lib/commonjs/charts/line/Dot.js.map +1 -1
- package/lib/commonjs/charts/line/Gradient.js +12 -19
- package/lib/commonjs/charts/line/Gradient.js.map +1 -1
- package/lib/commonjs/charts/line/Group.js +2 -14
- package/lib/commonjs/charts/line/Group.js.map +1 -1
- package/lib/commonjs/charts/line/Highlight.js +9 -21
- package/lib/commonjs/charts/line/Highlight.js.map +1 -1
- package/lib/commonjs/charts/line/HorizontalLine.js +8 -23
- package/lib/commonjs/charts/line/HorizontalLine.js.map +1 -1
- package/lib/commonjs/charts/line/HoverTrap/index.js +0 -4
- package/lib/commonjs/charts/line/HoverTrap/index.js.map +1 -1
- package/lib/commonjs/charts/line/HoverTrap/index.web.js +11 -24
- package/lib/commonjs/charts/line/HoverTrap/index.web.js.map +1 -1
- package/lib/commonjs/charts/line/LineChartPathContext.js +1 -6
- package/lib/commonjs/charts/line/LineChartPathContext.js.map +1 -1
- package/lib/commonjs/charts/line/Path.js +9 -18
- package/lib/commonjs/charts/line/Path.js.map +1 -1
- package/lib/commonjs/charts/line/PriceText.js +2 -9
- package/lib/commonjs/charts/line/PriceText.js.map +1 -1
- package/lib/commonjs/charts/line/Tooltip.js +25 -47
- package/lib/commonjs/charts/line/Tooltip.js.map +1 -1
- package/lib/commonjs/charts/line/index.js +1 -39
- package/lib/commonjs/charts/line/index.js.map +1 -1
- package/lib/commonjs/charts/line/types.js.map +1 -1
- package/lib/commonjs/charts/line/useAnimatedPath.js +6 -12
- package/lib/commonjs/charts/line/useAnimatedPath.js.map +1 -1
- package/lib/commonjs/charts/line/useCurrentY.js +0 -7
- package/lib/commonjs/charts/line/useCurrentY.js.map +1 -1
- package/lib/commonjs/charts/line/useDatetime.js +0 -4
- package/lib/commonjs/charts/line/useDatetime.js.map +1 -1
- package/lib/commonjs/charts/line/useLineChart.js +4 -10
- package/lib/commonjs/charts/line/useLineChart.js.map +1 -1
- package/lib/commonjs/charts/line/usePrice.js +1 -5
- package/lib/commonjs/charts/line/usePrice.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getArea.js +11 -11
- package/lib/commonjs/charts/line/utils/getArea.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getDomain.js +0 -1
- package/lib/commonjs/charts/line/utils/getDomain.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getPath.js +5 -8
- package/lib/commonjs/charts/line/utils/getPath.js.map +1 -1
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js +15 -0
- package/lib/commonjs/charts/line/utils/getXPositionForCurve.js.map +1 -0
- package/lib/commonjs/charts/line/utils/index.js +0 -10
- package/lib/commonjs/charts/line/utils/index.js.map +1 -1
- package/lib/commonjs/charts/line/utils/interpolatePath.js +119 -124
- package/lib/commonjs/charts/line/utils/interpolatePath.js.map +1 -1
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js +0 -3
- package/lib/commonjs/charts/line/utils/lineChartDataPropToArray.js.map +1 -1
- package/lib/commonjs/components/AnimatedText.js +6 -17
- package/lib/commonjs/components/AnimatedText.js.map +1 -1
- package/lib/commonjs/index.js +0 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/formatDatetime.js +0 -1
- package/lib/commonjs/utils/formatDatetime.js.map +1 -1
- package/lib/commonjs/utils/formatPrice.js +2 -12
- package/lib/commonjs/utils/formatPrice.js.map +1 -1
- package/lib/commonjs/utils/index.js +0 -6
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/usePrevious.js +4 -9
- package/lib/commonjs/utils/usePrevious.js.map +1 -1
- package/lib/module/charts/candle/Candle.js +4 -2
- package/lib/module/charts/candle/Candle.js.map +1 -1
- package/lib/module/charts/candle/Candles.js +4 -3
- package/lib/module/charts/candle/Candles.js.map +1 -1
- package/lib/module/charts/candle/Chart.js.map +1 -1
- package/lib/module/charts/candle/Context.js.map +1 -1
- package/lib/module/charts/candle/Crosshair.js +1 -4
- package/lib/module/charts/candle/Crosshair.js.map +1 -1
- package/lib/module/charts/candle/CrosshairTooltip.js +3 -6
- package/lib/module/charts/candle/CrosshairTooltip.js.map +1 -1
- package/lib/module/charts/candle/DatetimeText.js.map +1 -1
- package/lib/module/charts/candle/HoverTrap/index.web.js +11 -15
- package/lib/module/charts/candle/HoverTrap/index.web.js.map +1 -1
- package/lib/module/charts/candle/Line.js +1 -2
- package/lib/module/charts/candle/Line.js.map +1 -1
- package/lib/module/charts/candle/PriceText.js.map +1 -1
- package/lib/module/charts/candle/index.js.map +1 -1
- package/lib/module/charts/candle/types.js.map +1 -1
- package/lib/module/charts/candle/useCandleData.js +0 -1
- package/lib/module/charts/candle/useCandleData.js.map +1 -1
- package/lib/module/charts/candle/useCandlestickChart.js.map +1 -1
- package/lib/module/charts/candle/useDatetime.js.map +1 -1
- package/lib/module/charts/candle/usePrice.js +0 -2
- package/lib/module/charts/candle/usePrice.js.map +1 -1
- package/lib/module/charts/candle/utils/getDomain.js.map +1 -1
- package/lib/module/charts/candle/utils/getHeight.js.map +1 -1
- package/lib/module/charts/candle/utils/getPrice.js.map +1 -1
- package/lib/module/charts/candle/utils/getY.js.map +1 -1
- package/lib/module/charts/candle/utils/index.js.map +1 -1
- package/lib/module/charts/candle/utils.js.map +1 -1
- package/lib/module/charts/line/Chart.js +8 -12
- package/lib/module/charts/line/Chart.js.map +1 -1
- package/lib/module/charts/line/ChartPath.js +21 -28
- package/lib/module/charts/line/ChartPath.js.map +1 -1
- package/lib/module/charts/line/Context.js +4 -6
- package/lib/module/charts/line/Context.js.map +1 -1
- package/lib/module/charts/line/Cursor.js +37 -50
- package/lib/module/charts/line/Cursor.js.map +1 -1
- package/lib/module/charts/line/CursorCrosshair.js +3 -3
- package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
- package/lib/module/charts/line/CursorLine.js +3 -3
- package/lib/module/charts/line/CursorLine.js.map +1 -1
- package/lib/module/charts/line/Data.js +0 -2
- package/lib/module/charts/line/Data.js.map +1 -1
- package/lib/module/charts/line/DatetimeText.js.map +1 -1
- package/lib/module/charts/line/Dot.js +25 -18
- package/lib/module/charts/line/Dot.js.map +1 -1
- package/lib/module/charts/line/Gradient.js +10 -5
- package/lib/module/charts/line/Gradient.js.map +1 -1
- package/lib/module/charts/line/Group.js +0 -2
- package/lib/module/charts/line/Group.js.map +1 -1
- package/lib/module/charts/line/Highlight.js +7 -5
- package/lib/module/charts/line/Highlight.js.map +1 -1
- package/lib/module/charts/line/HorizontalLine.js +6 -8
- package/lib/module/charts/line/HorizontalLine.js.map +1 -1
- package/lib/module/charts/line/HoverTrap/index.js.map +1 -1
- package/lib/module/charts/line/HoverTrap/index.web.js +11 -15
- package/lib/module/charts/line/HoverTrap/index.web.js.map +1 -1
- package/lib/module/charts/line/LineChartPathContext.js.map +1 -1
- package/lib/module/charts/line/Path.js +7 -4
- package/lib/module/charts/line/Path.js.map +1 -1
- package/lib/module/charts/line/PriceText.js.map +1 -1
- package/lib/module/charts/line/Tooltip.js +21 -33
- package/lib/module/charts/line/Tooltip.js.map +1 -1
- package/lib/module/charts/line/index.js.map +1 -1
- package/lib/module/charts/line/types.js.map +1 -1
- package/lib/module/charts/line/useAnimatedPath.js +3 -5
- package/lib/module/charts/line/useAnimatedPath.js.map +1 -1
- package/lib/module/charts/line/useCurrentY.js +0 -1
- package/lib/module/charts/line/useCurrentY.js.map +1 -1
- package/lib/module/charts/line/useDatetime.js.map +1 -1
- package/lib/module/charts/line/useLineChart.js +2 -1
- package/lib/module/charts/line/useLineChart.js.map +1 -1
- package/lib/module/charts/line/usePrice.js +1 -1
- package/lib/module/charts/line/usePrice.js.map +1 -1
- package/lib/module/charts/line/utils/getArea.js +9 -6
- package/lib/module/charts/line/utils/getArea.js.map +1 -1
- package/lib/module/charts/line/utils/getDomain.js.map +1 -1
- package/lib/module/charts/line/utils/getPath.js +3 -3
- package/lib/module/charts/line/utils/getPath.js.map +1 -1
- package/lib/module/charts/line/utils/getXPositionForCurve.js +9 -0
- package/lib/module/charts/line/utils/getXPositionForCurve.js.map +1 -0
- package/lib/module/charts/line/utils/index.js.map +1 -1
- package/lib/module/charts/line/utils/interpolatePath.js +116 -117
- package/lib/module/charts/line/utils/interpolatePath.js.map +1 -1
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js +0 -2
- package/lib/module/charts/line/utils/lineChartDataPropToArray.js.map +1 -1
- package/lib/module/components/AnimatedText.js +4 -3
- package/lib/module/components/AnimatedText.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/formatDatetime.js.map +1 -1
- package/lib/module/utils/formatPrice.js +2 -11
- package/lib/module/utils/formatPrice.js.map +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/usePrevious.js +2 -3
- package/lib/module/utils/usePrevious.js.map +1 -1
- package/lib/typescript/example/src/App.d.ts +4 -0
- package/lib/typescript/example/src/App.d.ts.map +1 -0
- package/lib/typescript/example/src/CandlestickChart.d.ts +3 -0
- package/lib/typescript/example/src/CandlestickChart.d.ts.map +1 -0
- package/lib/typescript/example/src/LineChart.d.ts +3 -0
- package/lib/typescript/example/src/LineChart.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/Candle.d.ts +7 -5
- package/lib/typescript/src/charts/candle/Candle.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/Candles.d.ts +4 -3
- package/lib/typescript/src/charts/candle/Candles.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/Chart.d.ts +3 -2
- package/lib/typescript/src/charts/candle/Chart.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/Context.d.ts +3 -2
- package/lib/typescript/src/charts/candle/Context.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/Crosshair.d.ts +3 -2
- package/lib/typescript/src/charts/candle/Crosshair.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts +4 -3
- package/lib/typescript/src/charts/candle/CrosshairTooltip.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts +4 -3
- package/lib/typescript/src/charts/candle/DatetimeText.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/HoverTrap/index.web.d.ts +3 -2
- package/lib/typescript/src/charts/candle/HoverTrap/index.web.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/Line.d.ts +4 -3
- package/lib/typescript/src/charts/candle/Line.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/PriceText.d.ts +4 -3
- package/lib/typescript/src/charts/candle/PriceText.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/index.d.ts +3 -2
- package/lib/typescript/src/charts/candle/index.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/types.d.ts +7 -6
- package/lib/typescript/src/charts/candle/types.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/useCandleData.d.ts +1 -0
- package/lib/typescript/src/charts/candle/useCandleData.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +1 -0
- package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/useDatetime.d.ts +1 -0
- package/lib/typescript/src/charts/candle/useDatetime.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/usePrice.d.ts +1 -0
- package/lib/typescript/src/charts/candle/usePrice.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts +1 -0
- package/lib/typescript/src/charts/candle/utils/getDomain.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/utils/getHeight.d.ts +1 -0
- package/lib/typescript/src/charts/candle/utils/getHeight.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/utils/getPrice.d.ts +1 -0
- package/lib/typescript/src/charts/candle/utils/getPrice.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/utils/getY.d.ts +1 -0
- package/lib/typescript/src/charts/candle/utils/getY.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/utils/index.d.ts +1 -0
- package/lib/typescript/src/charts/candle/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/charts/candle/utils.d.ts +1 -0
- package/lib/typescript/src/charts/candle/utils.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Chart.d.ts +3 -2
- package/lib/typescript/src/charts/line/Chart.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/ChartPath.d.ts +3 -2
- package/lib/typescript/src/charts/line/ChartPath.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Context.d.ts +3 -2
- package/lib/typescript/src/charts/line/Context.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Cursor.d.ts +3 -2
- package/lib/typescript/src/charts/line/Cursor.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +3 -2
- package/lib/typescript/src/charts/line/CursorCrosshair.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/CursorLine.d.ts +3 -2
- package/lib/typescript/src/charts/line/CursorLine.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Data.d.ts +6 -4
- package/lib/typescript/src/charts/line/Data.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/DatetimeText.d.ts +4 -3
- package/lib/typescript/src/charts/line/DatetimeText.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Dot.d.ts +4 -3
- package/lib/typescript/src/charts/line/Dot.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Gradient.d.ts +3 -2
- package/lib/typescript/src/charts/line/Gradient.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Group.d.ts +4 -2
- package/lib/typescript/src/charts/line/Group.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Highlight.d.ts +4 -3
- package/lib/typescript/src/charts/line/Highlight.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts +4 -3
- package/lib/typescript/src/charts/line/HorizontalLine.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +3 -2
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +3 -2
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/LineChartPathContext.d.ts +1 -0
- package/lib/typescript/src/charts/line/LineChartPathContext.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Path.d.ts +4 -3
- package/lib/typescript/src/charts/line/Path.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/PriceText.d.ts +4 -3
- package/lib/typescript/src/charts/line/PriceText.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/Tooltip.d.ts +4 -3
- package/lib/typescript/src/charts/line/Tooltip.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/index.d.ts +2 -1
- package/lib/typescript/src/charts/line/index.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/types.d.ts +8 -7
- package/lib/typescript/src/charts/line/types.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts +1 -0
- package/lib/typescript/src/charts/line/useAnimatedPath.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/useCurrentY.d.ts +1 -0
- package/lib/typescript/src/charts/line/useCurrentY.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/useDatetime.d.ts +1 -0
- package/lib/typescript/src/charts/line/useDatetime.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/useLineChart.d.ts +1 -0
- package/lib/typescript/src/charts/line/useLineChart.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/usePrice.d.ts +1 -0
- package/lib/typescript/src/charts/line/usePrice.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/utils/getArea.d.ts +3 -1
- package/lib/typescript/src/charts/line/utils/getArea.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts +1 -0
- package/lib/typescript/src/charts/line/utils/getDomain.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/utils/getPath.d.ts +1 -0
- package/lib/typescript/src/charts/line/utils/getPath.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts +3 -0
- package/lib/typescript/src/charts/line/utils/getXPositionForCurve.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/utils/index.d.ts +1 -0
- package/lib/typescript/src/charts/line/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/utils/interpolatePath.d.ts +1 -0
- package/lib/typescript/src/charts/line/utils/interpolatePath.d.ts.map +1 -0
- package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts +1 -0
- package/lib/typescript/src/charts/line/utils/lineChartDataPropToArray.d.ts.map +1 -0
- package/lib/typescript/src/components/AnimatedText.d.ts +3 -2
- package/lib/typescript/src/components/AnimatedText.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/formatDatetime.d.ts +1 -0
- package/lib/typescript/src/utils/formatDatetime.d.ts.map +1 -0
- package/lib/typescript/src/utils/formatPrice.d.ts +1 -0
- package/lib/typescript/src/utils/formatPrice.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +1 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/usePrevious.d.ts +1 -0
- package/lib/typescript/src/utils/usePrevious.d.ts.map +1 -0
- package/package.json +12 -9
- package/scripts/bootstrap.js +24 -0
- package/src/charts/candle/Candle.tsx +3 -3
- package/src/charts/candle/CrosshairTooltip.tsx +2 -2
- package/src/charts/candle/HoverTrap/index.web.tsx +0 -1
- package/src/charts/line/Chart.tsx +6 -4
- package/src/charts/line/Cursor.tsx +52 -67
- package/src/charts/line/Dot.tsx +8 -8
- package/src/charts/line/Gradient.tsx +1 -0
- package/src/charts/line/HorizontalLine.tsx +8 -15
- package/src/charts/line/HoverTrap/index.web.tsx +0 -1
- package/src/charts/line/Tooltip.tsx +21 -13
- package/src/charts/line/useAnimatedPath.ts +3 -3
- package/src/charts/line/utils/getArea.ts +8 -5
- package/src/charts/line/utils/getXPositionForCurve.ts +9 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +28 -0
- package/yarn.lock +8529 -0
package/.DS_Store
ADDED
|
Binary file
|
package/.editorconfig
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# EditorConfig helps developers define and maintain consistent
|
|
2
|
+
# coding styles between different editors and IDEs
|
|
3
|
+
# editorconfig.org
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
|
|
9
|
+
indent_style = space
|
|
10
|
+
indent_size = 2
|
|
11
|
+
|
|
12
|
+
end_of_line = lf
|
|
13
|
+
charset = utf-8
|
|
14
|
+
trim_trailing_whitespace = true
|
|
15
|
+
insert_final_newline = true
|
package/.gitattributes
ADDED
package/.gitignore
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# OSX
|
|
2
|
+
#
|
|
3
|
+
.DS_Store
|
|
4
|
+
|
|
5
|
+
# XDE
|
|
6
|
+
.expo/
|
|
7
|
+
|
|
8
|
+
# VSCode
|
|
9
|
+
.vscode/
|
|
10
|
+
jsconfig.json
|
|
11
|
+
|
|
12
|
+
# Xcode
|
|
13
|
+
#
|
|
14
|
+
build/
|
|
15
|
+
*.pbxuser
|
|
16
|
+
!default.pbxuser
|
|
17
|
+
*.mode1v3
|
|
18
|
+
!default.mode1v3
|
|
19
|
+
*.mode2v3
|
|
20
|
+
!default.mode2v3
|
|
21
|
+
*.perspectivev3
|
|
22
|
+
!default.perspectivev3
|
|
23
|
+
xcuserdata
|
|
24
|
+
*.xccheckout
|
|
25
|
+
*.moved-aside
|
|
26
|
+
DerivedData
|
|
27
|
+
*.hmap
|
|
28
|
+
*.ipa
|
|
29
|
+
*.xcuserstate
|
|
30
|
+
project.xcworkspace
|
|
31
|
+
|
|
32
|
+
# Android/IJ
|
|
33
|
+
#
|
|
34
|
+
.idea
|
|
35
|
+
.gradle
|
|
36
|
+
local.properties
|
|
37
|
+
android.iml
|
|
38
|
+
|
|
39
|
+
# Cocoapods
|
|
40
|
+
#
|
|
41
|
+
example/ios/Pods
|
|
42
|
+
|
|
43
|
+
# node.js
|
|
44
|
+
#
|
|
45
|
+
node_modules/
|
|
46
|
+
npm-debug.log
|
|
47
|
+
yarn-debug.log
|
|
48
|
+
yarn-error.log
|
|
49
|
+
|
|
50
|
+
# BUCK
|
|
51
|
+
buck-out/
|
|
52
|
+
\.buckd/
|
|
53
|
+
android/app/libs
|
|
54
|
+
android/keystores/debug.keystore
|
|
55
|
+
|
|
56
|
+
# Expo
|
|
57
|
+
.expo/*
|
|
58
|
+
|
|
59
|
+
# generated by bob
|
|
60
|
+
lib/
|
package/.prettierrc.js
ADDED
package/.yarnrc
ADDED
package/README.md
CHANGED
|
@@ -386,7 +386,7 @@ To customise the color of the line chart cursor, supply a `color` prop to `LineC
|
|
|
386
386
|
<LineChart.Provider data={data}>
|
|
387
387
|
<LineChart>
|
|
388
388
|
<LineChart.Path color="hotpink" />
|
|
389
|
-
<LineChart.CursorCrosshair color="hotpink />
|
|
389
|
+
<LineChart.CursorCrosshair color="hotpink" />
|
|
390
390
|
</LineChart>
|
|
391
391
|
</LineChart.Provider>
|
|
392
392
|
```
|
|
@@ -405,7 +405,7 @@ To achieve this, simply add `<LineChart.HoverTrap />` as the child of your curso
|
|
|
405
405
|
<LineChart.Provider data={data}>
|
|
406
406
|
<LineChart>
|
|
407
407
|
<LineChart.Path color="hotpink" />
|
|
408
|
-
<LineChart.CursorCrosshair color="hotpink>
|
|
408
|
+
<LineChart.CursorCrosshair color="hotpink" >
|
|
409
409
|
<LineChart.HoverTrap />
|
|
410
410
|
</LineChart.CursorCrosshair>
|
|
411
411
|
</LineChart>
|
|
@@ -812,10 +812,11 @@ To customize the formatting of the date/time text, you can supply a `format` fun
|
|
|
812
812
|
|
|
813
813
|
### LineChart.Provider
|
|
814
814
|
|
|
815
|
-
| Prop
|
|
816
|
-
|
|
|
817
|
-
| `data`
|
|
818
|
-
| `yRange`
|
|
815
|
+
| Prop | Type | Default | Description |
|
|
816
|
+
| --------- | --------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
817
|
+
| `data` | `Array<{ timestamp: number, value: number }>` | | The line chart data as an array of timestamps & values (prices). |
|
|
818
|
+
| `yRange` | `{ min?: number; max?: number }` | | Set a custom range for the y values of your chart. See [#20](https://github.com/coinjar/react-native-wagmi-charts/issues/20) for a use-case. |
|
|
819
|
+
| `xDomain` | `[ min: number; max: number ]` | | Scale x values proportionate to their time scale. Distance between points will be relative to each other instead of same spacing between in point. See [#140](https://github.com/coinjar/react-native-wagmi-charts/issues/140#issuecomment-1614264020) for a use-case. |
|
|
819
820
|
|
|
820
821
|
### LineChart
|
|
821
822
|
|
|
@@ -837,16 +838,16 @@ To customize the formatting of the date/time text, you can supply a `format` fun
|
|
|
837
838
|
|
|
838
839
|
### LineChart.CursorCrosshair
|
|
839
840
|
|
|
840
|
-
| Prop | Type | Default | Description
|
|
841
|
-
| ----------------------- | ------------------------------ | --------- |
|
|
842
|
-
| `color` | `string` | `"black"` | Color of the crosshair dot
|
|
843
|
-
| `size` | `number` | `8` | Size of the crosshair dot
|
|
844
|
-
| `outerSize` | `number` | `32` | Size of the outer crosshair dot (faded dot)
|
|
845
|
-
| `crosshairWrapperProps` | `ViewProps` | | Props of the wrapper component of the crosshair
|
|
846
|
-
| `crosshairProps` | `ViewProps` | | Props of the crosshair dot
|
|
847
|
-
| `crosshairOuterProps` | `ViewProps` | | Props of the crosshair outer dot
|
|
848
|
-
| `snapToPoint` | `boolean` | `false` | Snap cursor to X position of nearest data point |
|
|
849
|
-
| `...props` | `LongPressGestureHandlerProps` | |
|
|
841
|
+
| Prop | Type | Default | Description |
|
|
842
|
+
| ----------------------- | ------------------------------ | --------- | --------------------------------------------------------------------- |
|
|
843
|
+
| `color` | `string` | `"black"` | Color of the crosshair dot |
|
|
844
|
+
| `size` | `number` | `8` | Size of the crosshair dot |
|
|
845
|
+
| `outerSize` | `number` | `32` | Size of the outer crosshair dot (faded dot) |
|
|
846
|
+
| `crosshairWrapperProps` | `ViewProps` | | Props of the wrapper component of the crosshair |
|
|
847
|
+
| `crosshairProps` | `ViewProps` | | Props of the crosshair dot |
|
|
848
|
+
| `crosshairOuterProps` | `ViewProps` | | Props of the crosshair outer dot |
|
|
849
|
+
| `snapToPoint` | `boolean` | `false` | **REACT NATIVE ONLY** Snap cursor to X position of nearest data point |
|
|
850
|
+
| `...props` | `LongPressGestureHandlerProps` | | |
|
|
850
851
|
|
|
851
852
|
### LineChart.CursorLine
|
|
852
853
|
|
|
@@ -900,13 +901,13 @@ To customize the formatting of the date/time text, you can supply a `format` fun
|
|
|
900
901
|
|
|
901
902
|
### LineChart.Tooltip
|
|
902
903
|
|
|
903
|
-
| Prop | Type | Default | Description
|
|
904
|
-
| -------------- | --------------------- | ------- |
|
|
905
|
-
| `xGutter` | `number` | `8` | X axis gutter in which the tooltip will not pass.
|
|
906
|
-
| `yGutter` | `number` | `8` | Y axis gutter in which the tooltip will not pass.
|
|
907
|
-
| `cursorGutter` | `number` | `48` | Gutter (spacing) between the cursor and the tooltip.
|
|
908
|
-
| `position` | `"top"` or `"bottom"` | `"top"` | Position of the tooltip relative to the cursor.
|
|
909
|
-
| `textStyle` | `{}` | | Style of the tooltip text
|
|
904
|
+
| Prop | Type | Default | Description |
|
|
905
|
+
| -------------- | --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
906
|
+
| `xGutter` | `number` | `8` | X axis gutter in which the tooltip will not pass. |
|
|
907
|
+
| `yGutter` | `number` | `8` | Y axis gutter in which the tooltip will not pass. |
|
|
908
|
+
| `cursorGutter` | `number` | `48` | Gutter (spacing) between the cursor and the tooltip. |
|
|
909
|
+
| `position` | `"top"` or `"bottom"` | `"top"` | Position of the tooltip relative to the cursor. |
|
|
910
|
+
| `textStyle` | `{}` | | Style of the tooltip text |
|
|
910
911
|
| `at` | `number` | | Make the tooltip static at the given `data` index (which shows the tooltip always, unless there is interaction with the chart) |
|
|
911
912
|
|
|
912
913
|
### LineChart.PriceText
|
|
@@ -1065,7 +1066,7 @@ const { value, formatted } = LineChart.usePrice({
|
|
|
1065
1066
|
**Arguments**
|
|
1066
1067
|
|
|
1067
1068
|
| Variable | Type | Default | Description |
|
|
1068
|
-
| -----------
|
|
1069
|
+
| ----------- | ---------------------------------- | ------- | ------------------------------------ |
|
|
1069
1070
|
| `format` | `({ value, formatted }) => string` | | Custom format function of the price. |
|
|
1070
1071
|
| `precision` | `number` | `2` | Precision of the price value. |
|
|
1071
1072
|
| `index` | `number` | | Get the price for a specific index |
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
> Why do I have a folder named ".expo" in my project?
|
|
2
|
+
The ".expo" folder is created when an Expo project is started using "expo start" command.
|
|
3
|
+
> What do the files contain?
|
|
4
|
+
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
|
|
5
|
+
- "settings.json": contains the server configuration that is used to serve the application manifest.
|
|
6
|
+
> Should I commit the ".expo" folder?
|
|
7
|
+
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
|
|
8
|
+
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# react-native-wagmi-charts Example Project 🧑🏫
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First install project dependencies in this directory:
|
|
6
|
+
|
|
7
|
+
`npm install`
|
|
8
|
+
|
|
9
|
+
After dependencies are installed, you can go ahead and run the project on either a simulator, or a real device using the following commands
|
|
10
|
+
|
|
11
|
+
For iOS:
|
|
12
|
+
|
|
13
|
+
`npm run ios`
|
|
14
|
+
|
|
15
|
+
For Android:
|
|
16
|
+
|
|
17
|
+
`npm run android`
|
|
18
|
+
|
|
19
|
+
For Web:
|
|
20
|
+
|
|
21
|
+
`npm run web`
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## Example Charts
|
|
25
|
+
|
|
26
|
+
The following charts are included:
|
|
27
|
+
|
|
28
|
+
- Candlestick Chart
|
|
29
|
+
- Line Chart
|
|
30
|
+
|
|
31
|
+
### Sample Data
|
|
32
|
+
The charts in this example use hardcoded data, which is stored in the `src/data` directory
|
package/example/app.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-wagmi-charts-example",
|
|
3
|
+
"displayName": "CandlestickChart Example",
|
|
4
|
+
"expo": {
|
|
5
|
+
"name": "react-native-wagmi-charts-example",
|
|
6
|
+
"slug": "react-native-wagmi-charts-example",
|
|
7
|
+
"description": "Example app for react-native-wagmi-charts",
|
|
8
|
+
"privacy": "public",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"platforms": [
|
|
11
|
+
"ios",
|
|
12
|
+
"android",
|
|
13
|
+
"web"
|
|
14
|
+
],
|
|
15
|
+
"ios": {
|
|
16
|
+
"supportsTablet": true
|
|
17
|
+
},
|
|
18
|
+
"assetBundlePatterns": [
|
|
19
|
+
"**/*"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const pkg = require('../package.json');
|
|
3
|
+
|
|
4
|
+
module.exports = function (api) {
|
|
5
|
+
api.cache(true);
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
presets: ['babel-preset-expo'],
|
|
9
|
+
plugins: [
|
|
10
|
+
[
|
|
11
|
+
'module-resolver',
|
|
12
|
+
{
|
|
13
|
+
extensions: ['.tsx', '.ts', '.js', '.json'],
|
|
14
|
+
alias: {
|
|
15
|
+
// For development, we want to alias the library to the source
|
|
16
|
+
[pkg.name]: path.join(__dirname, '..', pkg.source),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
'react-native-reanimated/plugin',
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
};
|
package/example/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { registerRootComponent } from 'expo';
|
|
2
|
+
|
|
3
|
+
import App from './src/App';
|
|
4
|
+
|
|
5
|
+
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
|
|
6
|
+
// It also ensures that whether you load the app in the Expo client or in a native build,
|
|
7
|
+
// the environment is set up appropriately
|
|
8
|
+
registerRootComponent(App);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const blacklist = require('metro-config/src/defaults/exclusionList');
|
|
3
|
+
const escape = require('escape-string-regexp');
|
|
4
|
+
const pak = require('../package.json');
|
|
5
|
+
|
|
6
|
+
const root = path.resolve(__dirname, '..');
|
|
7
|
+
|
|
8
|
+
const modules = Object.keys({
|
|
9
|
+
...pak.peerDependencies,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
projectRoot: __dirname,
|
|
14
|
+
watchFolders: [root],
|
|
15
|
+
|
|
16
|
+
// We need to make sure that only one version is loaded for peerDependencies
|
|
17
|
+
// So we blacklist them at the root, and alias them to the versions in example's node_modules
|
|
18
|
+
resolver: {
|
|
19
|
+
blacklistRE: blacklist(
|
|
20
|
+
modules.map(
|
|
21
|
+
(m) =>
|
|
22
|
+
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
|
|
23
|
+
)
|
|
24
|
+
),
|
|
25
|
+
|
|
26
|
+
extraNodeModules: modules.reduce((acc, name) => {
|
|
27
|
+
acc[name] = path.join(__dirname, 'node_modules', name);
|
|
28
|
+
return acc;
|
|
29
|
+
}, {}),
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
transformer: {
|
|
33
|
+
getTransformOptions: async () => ({
|
|
34
|
+
transform: {
|
|
35
|
+
experimentalImportSupport: false,
|
|
36
|
+
inlineRequires: true,
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-wagmi-charts-example",
|
|
3
|
+
"description": "Example app for react-native-wagmi-charts",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"private": true,
|
|
6
|
+
"main": "index",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"android": "npx expo start --android",
|
|
9
|
+
"ios": "npx expo start --ios",
|
|
10
|
+
"web": "npx expo start --web",
|
|
11
|
+
"start": "npx expo start",
|
|
12
|
+
"test": "jest",
|
|
13
|
+
"postinstall": "patch-package"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@types/react": "~18.2.14",
|
|
17
|
+
"bumbag": "^2.2.1",
|
|
18
|
+
"bumbag-native": "^2.3.0",
|
|
19
|
+
"expo": "^49.0.0",
|
|
20
|
+
"expo-haptics": "~12.4.0",
|
|
21
|
+
"expo-splash-screen": "~0.20.5",
|
|
22
|
+
"react": "18.2.0",
|
|
23
|
+
"react-dom": "18.2.0",
|
|
24
|
+
"react-native": "0.72.3",
|
|
25
|
+
"react-native-gesture-handler": "~2.12.0",
|
|
26
|
+
"react-native-reanimated": "~3.3.0",
|
|
27
|
+
"react-native-svg": "13.9.0",
|
|
28
|
+
"react-native-web": "~0.19.6"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@babel/core": "^7.20.0",
|
|
32
|
+
"@babel/runtime": "^7.20.0",
|
|
33
|
+
"@expo/webpack-config": "^18.0.1",
|
|
34
|
+
"babel-loader": "^8.2.3",
|
|
35
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
36
|
+
"babel-preset-expo": "^9.5.0",
|
|
37
|
+
"jsonfile": "^6.1.0",
|
|
38
|
+
"patch-package": "^6.4.7",
|
|
39
|
+
"postinstall-postinstall": "^2.1.0",
|
|
40
|
+
"typescript": "^5.1.3"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import 'react-native-gesture-handler';
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Button,
|
|
6
|
+
Text,
|
|
7
|
+
Heading,
|
|
8
|
+
Level,
|
|
9
|
+
Provider as BumbagNativeProvider,
|
|
10
|
+
} from 'bumbag-native';
|
|
11
|
+
|
|
12
|
+
import CandlestickChart from './CandlestickChart';
|
|
13
|
+
import LineChart from './LineChart';
|
|
14
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
15
|
+
|
|
16
|
+
export default function App() {
|
|
17
|
+
const [selected, setSelected] = React.useState('');
|
|
18
|
+
return (
|
|
19
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
20
|
+
<BumbagNativeProvider>
|
|
21
|
+
<Box.Safe flex="1">
|
|
22
|
+
<Level
|
|
23
|
+
verticalBelow=""
|
|
24
|
+
paddingX="major-2"
|
|
25
|
+
paddingY="major-2"
|
|
26
|
+
alignY="center"
|
|
27
|
+
>
|
|
28
|
+
<Heading.H5 key={'heading'}>
|
|
29
|
+
React Native WAGMI Charts 💸
|
|
30
|
+
</Heading.H5>
|
|
31
|
+
{selected ? (
|
|
32
|
+
<Button
|
|
33
|
+
size="small"
|
|
34
|
+
key="back-button"
|
|
35
|
+
onPress={() => setSelected('')}
|
|
36
|
+
>
|
|
37
|
+
Back
|
|
38
|
+
</Button>
|
|
39
|
+
) : null}
|
|
40
|
+
</Level>
|
|
41
|
+
<Box.Scroll>
|
|
42
|
+
{!selected && (
|
|
43
|
+
<Box paddingX="major-2" marginTop="major-6">
|
|
44
|
+
<Heading.H6 marginBottom="major-2">
|
|
45
|
+
Click a chart below to get started
|
|
46
|
+
</Heading.H6>
|
|
47
|
+
<Button onPress={() => setSelected('candlestick')}>
|
|
48
|
+
<Text>Candlestick</Text>
|
|
49
|
+
</Button>
|
|
50
|
+
<Button onPress={() => setSelected('line')}>
|
|
51
|
+
<Text>Line</Text>
|
|
52
|
+
</Button>
|
|
53
|
+
</Box>
|
|
54
|
+
)}
|
|
55
|
+
<Box marginTop="major-2">
|
|
56
|
+
{selected === 'candlestick' && <CandlestickChart />}
|
|
57
|
+
{selected === 'line' && <LineChart />}
|
|
58
|
+
</Box>
|
|
59
|
+
</Box.Scroll>
|
|
60
|
+
</Box.Safe>
|
|
61
|
+
</BumbagNativeProvider>
|
|
62
|
+
</GestureHandlerRootView>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { Box, Button, Flex, Heading, Text, Stack } from 'bumbag-native';
|
|
4
|
+
import { CandlestickChart, TCandle } from 'react-native-wagmi-charts';
|
|
5
|
+
import * as haptics from 'expo-haptics';
|
|
6
|
+
|
|
7
|
+
import mockData from './data/candlestick-data.json';
|
|
8
|
+
import mockData2 from './data/candlestick-data2.json';
|
|
9
|
+
|
|
10
|
+
function invokeHaptic() {
|
|
11
|
+
if (['ios', 'android'].includes(Platform.OS)) {
|
|
12
|
+
haptics.impactAsync(haptics.ImpactFeedbackStyle.Light);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function App() {
|
|
17
|
+
const [data, setData] = React.useState<TCandle[]>(mockData);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<Heading.H5 paddingX="major-2" marginBottom="major-2">
|
|
22
|
+
Candlestick Chart 🕯
|
|
23
|
+
</Heading.H5>
|
|
24
|
+
<CandlestickChart.Provider data={data}>
|
|
25
|
+
<CandlestickChart>
|
|
26
|
+
<CandlestickChart.Candles />
|
|
27
|
+
<CandlestickChart.Crosshair onCurrentXChange={invokeHaptic}>
|
|
28
|
+
<CandlestickChart.Tooltip />
|
|
29
|
+
</CandlestickChart.Crosshair>
|
|
30
|
+
</CandlestickChart>
|
|
31
|
+
<Heading.H6>Load Data</Heading.H6>
|
|
32
|
+
<Box marginTop="major-2">
|
|
33
|
+
<Flex flexWrap={'wrap'}>
|
|
34
|
+
<Button onPress={() => setData(mockData)}>candlestick-data</Button>
|
|
35
|
+
<Button onPress={() => setData(mockData2)}>
|
|
36
|
+
candlestick-data2
|
|
37
|
+
</Button>
|
|
38
|
+
</Flex>
|
|
39
|
+
</Box>
|
|
40
|
+
<Stack padding="major-2" spacing="major-1">
|
|
41
|
+
<Heading.H6>PriceText</Heading.H6>
|
|
42
|
+
<Box>
|
|
43
|
+
<Text fontWeight="500">Formatted: </Text>
|
|
44
|
+
<Flex>
|
|
45
|
+
<Box flex="1">
|
|
46
|
+
<Text fontSize="100">Current</Text>
|
|
47
|
+
<CandlestickChart.PriceText />
|
|
48
|
+
</Box>
|
|
49
|
+
<Box flex="1">
|
|
50
|
+
<Text fontSize="100">Open</Text>
|
|
51
|
+
<CandlestickChart.PriceText type="open" />
|
|
52
|
+
</Box>
|
|
53
|
+
<Box flex="1">
|
|
54
|
+
<Text fontSize="100">High</Text>
|
|
55
|
+
<CandlestickChart.PriceText type="high" />
|
|
56
|
+
</Box>
|
|
57
|
+
<Box flex="1">
|
|
58
|
+
<Text fontSize="100">Low</Text>
|
|
59
|
+
<CandlestickChart.PriceText type="low" />
|
|
60
|
+
</Box>
|
|
61
|
+
<Box flex="1">
|
|
62
|
+
<Text fontSize="100">Close</Text>
|
|
63
|
+
<CandlestickChart.PriceText type="close" />
|
|
64
|
+
</Box>
|
|
65
|
+
</Flex>
|
|
66
|
+
</Box>
|
|
67
|
+
<Box>
|
|
68
|
+
<Text fontWeight="500">Value: </Text>
|
|
69
|
+
<Flex>
|
|
70
|
+
<Box flex="1">
|
|
71
|
+
<Text fontSize="100">Current</Text>
|
|
72
|
+
<CandlestickChart.PriceText variant="value" />
|
|
73
|
+
</Box>
|
|
74
|
+
<Box flex="1">
|
|
75
|
+
<Text fontSize="100">Open</Text>
|
|
76
|
+
<CandlestickChart.PriceText type="open" variant="value" />
|
|
77
|
+
</Box>
|
|
78
|
+
<Box flex="1">
|
|
79
|
+
<Text fontSize="100">High</Text>
|
|
80
|
+
<CandlestickChart.PriceText type="high" variant="value" />
|
|
81
|
+
</Box>
|
|
82
|
+
<Box flex="1">
|
|
83
|
+
<Text fontSize="100">Low</Text>
|
|
84
|
+
<CandlestickChart.PriceText type="low" variant="value" />
|
|
85
|
+
</Box>
|
|
86
|
+
<Box flex="1">
|
|
87
|
+
<Text fontSize="100">Close</Text>
|
|
88
|
+
<CandlestickChart.PriceText type="close" variant="value" />
|
|
89
|
+
</Box>
|
|
90
|
+
</Flex>
|
|
91
|
+
</Box>
|
|
92
|
+
<Box>
|
|
93
|
+
<Text fontWeight="500">Custom format: </Text>
|
|
94
|
+
<Flex>
|
|
95
|
+
<Box flex="1">
|
|
96
|
+
<Text fontSize="100">Current</Text>
|
|
97
|
+
<CandlestickChart.PriceText
|
|
98
|
+
format={(d) => {
|
|
99
|
+
'worklet';
|
|
100
|
+
return `$${d.formatted} AUD`;
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
</Box>
|
|
104
|
+
<Box flex="1">
|
|
105
|
+
<Text fontSize="100">Open</Text>
|
|
106
|
+
<CandlestickChart.PriceText
|
|
107
|
+
type="open"
|
|
108
|
+
format={(d) => {
|
|
109
|
+
'worklet';
|
|
110
|
+
return `$${d.formatted} AUD`;
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
</Box>
|
|
114
|
+
<Box flex="1">
|
|
115
|
+
<Text fontSize="100">Close</Text>
|
|
116
|
+
<CandlestickChart.PriceText
|
|
117
|
+
type="close"
|
|
118
|
+
format={(d) => {
|
|
119
|
+
'worklet';
|
|
120
|
+
return `$${d.formatted} AUD`;
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
</Box>
|
|
124
|
+
</Flex>
|
|
125
|
+
</Box>
|
|
126
|
+
</Stack>
|
|
127
|
+
<Stack padding="major-2" spacing="minor-1">
|
|
128
|
+
<Heading.H6>DatetimeText</Heading.H6>
|
|
129
|
+
<Flex>
|
|
130
|
+
<Text fontWeight="500">Formatted: </Text>
|
|
131
|
+
<CandlestickChart.DatetimeText />
|
|
132
|
+
</Flex>
|
|
133
|
+
<Flex>
|
|
134
|
+
<Text fontWeight="500">Float: </Text>
|
|
135
|
+
<CandlestickChart.DatetimeText variant="value" />
|
|
136
|
+
</Flex>
|
|
137
|
+
<Flex>
|
|
138
|
+
<Text fontWeight="500">Custom format: </Text>
|
|
139
|
+
<CandlestickChart.DatetimeText
|
|
140
|
+
locale="en-AU"
|
|
141
|
+
options={{
|
|
142
|
+
year: 'numeric',
|
|
143
|
+
month: 'numeric',
|
|
144
|
+
day: 'numeric',
|
|
145
|
+
hour: 'numeric',
|
|
146
|
+
minute: 'numeric',
|
|
147
|
+
second: 'numeric',
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
</Flex>
|
|
151
|
+
</Stack>
|
|
152
|
+
</CandlestickChart.Provider>
|
|
153
|
+
</>
|
|
154
|
+
);
|
|
155
|
+
}
|