Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/margelo/react-native-graph
📈 Beautiful, high-performance Graphs and Charts for React Native built with Skia
https://github.com/margelo/react-native-graph
android animated animation beautiful chart charts crypto graph graphs ios library linegraph performance react react-native skia stock svg wallet
Last synced: 6 days ago
JSON representation
📈 Beautiful, high-performance Graphs and Charts for React Native built with Skia
- Host: GitHub
- URL: https://github.com/margelo/react-native-graph
- Owner: margelo
- License: mit
- Created: 2022-04-29T12:40:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-05T03:57:14.000Z (5 months ago)
- Last Synced: 2024-12-31T10:03:18.853Z (13 days ago)
- Topics: android, animated, animation, beautiful, chart, charts, crypto, graph, graphs, ios, library, linegraph, performance, react, react-native, skia, stock, svg, wallet
- Language: TypeScript
- Homepage: https://margelo.io
- Size: 3.65 MB
- Stars: 2,109
- Watchers: 16
- Forks: 118
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- Awesome - React Native Graph - 📈 Beautiful, high-performance Graphs and Charts for React Native. (Development / Programming)
README
📈
react-native-graph
Beautiful, high-performance Graphs/Charts for React Native.
## About
**react-native-graph** is a Line Graph implementation based on the high performance 2D graphics rendering engine "Skia". It's used in the [Pink Panda Wallet app](https://pinkpanda.io) to power thousands of token graphs every day.
* 🏎️ Faster and smoother than react-native-svg graphs
* ⚡️ Native path interpolation in Skia
* 🐎 Up to 120 FPS animations
* 📈 Cubic bezier rendering for smoother edges
* 👍 Smooth pan/scrubbing gesture
* 💰 Made for crypto apps and Wallets
* ❌ Does not block navigation, press or scroll animations## Installation
yarn add react-native-reanimated
yarn add react-native-gesture-handler
yarn add @shopify/react-native-skia
yarn add react-native-graph## Usage
```jsx
function App() {
const priceHistory = usePriceHistory('ethereum')return
}
```## Configuration
### `animated`
Whether to animate between data changes.
Animations are ran using the [Skia animation system](https://shopify.github.io/react-native-skia/docs/animations/animations) and are fully natively interpolated to ensure best possible performance.
If `animated` is `false`, a light-weight implementation of the graph renderer will be used, which is optimal for displaying a lot of graphs in large lists.
Example:
```jsx
```
---
### `enablePanGesture`
Whether to enable the pan gesture.
> Requires `animated` to be `true`.
There are three events fired when the user interacts with the graph:
1. `onGestureStart`: Fired once the user presses and holds down on the graph. The pan gesture _activates_.
2. `onPointSelected`: Fired for each point the user pans through. You can use this event to update labels or highlight selection in the graph.
3. `onGestureEnd`: Fired once the user releases his finger and the pan gesture _deactivates_.The pan gesture can be configured using these props:
1. `panGestureDelay`: Set delay for the pan gesture to activate. Set to `0` to start immediately after touch. Defaults to `300`.
Example:
```jsx
hapticFeedback('impactLight')}
onPointSelected={(p) => updatePriceTitle(p)}
onGestureEnd={() => resetPriceTitle()}
/>
```---
### `TopAxisLabel` / `BottomAxisLabel`
Used to render labels above or below the Graph.
> Requires `animated` to be `true`.
Usually this is used to render the maximum and minimum values of the Graph. You can get the maximum and minimum values from your graph points array, and smoothly animate the labels on the X axis accordingly.
Example:
```jsx
}
BottomAxisLabel={() => }
/>
```### `Range`
Used to define a range for the graph canvas
This range has to be bigger than the span of the provided data points. This feature can be used, e.g. if the graph should show a fixed timeframe, whether there's data for that period or not.
This example shows data in the timeframe between 01/01/2000 to 01/31/2000 and caps the value between 0 and 200:
```jsx
```
---
### `SelectionDot`
Used to render the selection dot.
> Requires `animated` and `enablePanGesture` to be `true`.
If `SelectionDot` is missing or `undefined`, a default one is provided with an outer ring and light shadow.
Example:
```jsx
```
See this [example `` component](./example/src/components/CustomSelectionDot.tsx).
## Sponsor
**react-native-graph** is sponsored by [Pink Panda](https://pinkpanda.io).
Download the Pink Panda mobile app to see react-native-graph in action!
## Community Discord
[Join the Margelo Community Discord](https://discord.gg/6CSHz2qAvA) to chat about react-native-graph or other Margelo libraries.
## Adopting at scale
react-native-graph was built at Margelo, an elite app development agency. For enterprise support or other business inquiries, contact us at [email protected]!
## Thanks
Special thanks to [William Candillon](https://github.com/wcandillon) and [Christian Falch](https://github.com/chrfalch) for their amazing help and support for React Native Skia ❤️