# react-native-gifted-charts
The most loved library for Bar, Line, Area, Pie, Donut, Stacked Bar, Population Pyramid, Radar, Bubble, Scatter and Candle Stick charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.
### Yet another chart library? Why?
**_To bring Life to your data_**
- Plenty of features with minimal code
- Apply animations to your charts on load and on value change, just by adding a prop
- Smooth animations implemented using the `Animated` API (no external library used for animations)
- Clickable and scrollable
- Three-D and gradient effects
- Fully customizable (see the [props](docs/docs.md))
- Detailed [documentation](https://gifted-charts.web.app/) with examples
- Support for **_combined_** Bar and Line charts
- Tested to be pixel perfect using [react-native-screenshot-test](https://www.npmjs.com/package/react-native-screenshot-test). See [the screenshot tests here](https://abhinandan-kushwaha.github.io/TestingCharts/ss-test/test.html)
- Detailed and illustrated [dev docs](docs/dev/index.md) that explain the architecture and working of the library
The web counterpart of this library is public now. Try out our new reactJS library- [react-gifted-charts](https://www.npmjs.com/package/react-gifted-charts)
The exact same piece of code that you write to render charts in react-native, can be used to render charts in reactJS using this library!
## [Release notes (Changelog) 🎉](release-notes/release-notes.md)
See the **[release changes by version here.](release-notes/release-notes.md)**
---
## Installation
### React Native CLI
```sh
npm install react-native-gifted-charts react-native-svg
```
### Expo
```sh
npx expo install react-native-gifted-charts react-native-svg
```
If your React Native version is below `0.87`, please install `react-native-linear-gradient` (or `expo-linear-gradient` for Expo projects).
**[gifted-charts-core](https://www.npmjs.com/package/gifted-charts-core)** contains the mathematical and logical utilities used by this library.
# 📚 Docs & Demos 🎦
- [Documentation and gallery](https://gifted-charts.web.app/)
- [Architecture and working (dev docs)](docs/dev/index.md)
- [Demo repo and snacks list](https://github.com/Abhinandan-Kushwaha/GiftedChartsDemo?tab=readme-ov-file#gifted-charts-demo)
- [Demo app on Play Store](https://play.google.com/store/apps/details?id=com.giftedcharts.demo)
## Usage
The simplest usage of various types of charts can be done as below-
```js
import { BarChart, LineChart, PieChart, PopulationPyramid, RadarChart, BubbleChart, CandleStickChart } from "react-native-gifted-charts";
// ...
const data=[ {value:50}, {value:80}, {value:90}, {value:70} ]
// For Horizontal Bar chart, just add the prop horizontal to the component
// For Area chart, just add the prop areaChart to the component
// For Donut chart, just add the prop donut to the component
// For Scatter chart, just add the prop scatterChart to the component
```
## Props tables
**1. [Bar Chart, Horizontal Bar Chart and Stacked Bar Chart props](docs/BarChart/BarChartProps.md)** \
**2. [Line Chart and Area Chart props](docs/LineChart/LineChartProps.md)** \
**3. [Bubble Chart props](docs/BubbleChart/BubbleChartProps.md)** \
**4. [Candle Stick Chart props](docs/CandleStickChart/CandleStickChartProps.md)** \
**5. [Pie Chart and Donut Chart props](docs/PieChart/PieChartProps.md)** \
**6. [Radar Chart props](docs/RadarChart/RadarChartProps.md)** \
**7. [Population Pyramid props](docs/PopulationPyramid/PopulationPyramid.md)**
## 🤝 Contributing
This project exists thanks to all the people who contribute.
_Dear developers_! Your small contribution can make someone's day 😊
One of the ways you can contribute is to address an [open issue](https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues).
Sometimes people report issues which don't exist, or request for features which are already present. Such issues can be addressed without pushing any code to the repo. Just show them in the comments how to do it.
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
📝 [To do list](./src/todos.md)
## 🧐 Test cases
- Test strategy and cases are discussed here- [TESTS.md](./TESTS.md)
- Pixel perfection is assured using [react-native-screenshot-test](https://www.npmjs.com/package/react-native-screenshot-test).
- 290+ screenshot tests have been written. See the [Reports here](https://abhinandan-kushwaha.github.io/TestingCharts/ss-test/test.html).
- Screenshot tests are written in a separate repo named [TestingCharts](https://github.com/Abhinandan-Kushwaha/TestingCharts)
## 🏆 Showcase
Showcase your dashing charts on [Expo snack](https://snack.expo.dev/) and list them on the [Demo app repo](https://github.com/Abhinandan-Kushwaha/GiftedChartsDemo?tab=readme-ov-file#gifted-charts-demo).
Your snack might get published in the [Demo app on Play Store!](https://play.google.com/store/apps/details?id=com.giftedcharts.demo)
## License
MIT