2021-07-30 13:12:53 +00:00
|
|
|
# react-native-gifted-charts
|
|
|
|
|
2021-08-02 11:13:32 +00:00
|
|
|
The most complete library for Bar, Line, Area, Pie, and Donut charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.
|
2021-07-30 13:12:53 +00:00
|
|
|
|
2021-08-04 21:15:46 +00:00
|
|
|
### Yet another chart library? Why?
|
2021-08-04 21:14:35 +00:00
|
|
|
|
2021-08-13 14:38:57 +00:00
|
|
|
**_To bring Life to your data_**
|
2021-08-08 23:54:50 +00:00
|
|
|
|
2021-08-04 21:14:35 +00:00
|
|
|
1. Plenty of features with minimal code
|
|
|
|
2. Apply animations to your charts on load and on value change, just by adding a prop
|
|
|
|
3. Smooth animations implemented using LayoutAnimation
|
|
|
|
4. Clickable and scrollable
|
|
|
|
5. Three-D and gradient effects
|
|
|
|
6. Fully customizable
|
|
|
|
7. Detailed documentation with examples
|
|
|
|
|
2021-08-08 23:56:19 +00:00
|
|
|
---
|
|
|
|
|
2021-08-08 23:54:50 +00:00
|
|
|
![alt text](/demos/altBars.svg)
|
|
|
|
![alt text](/demos/barPairs.svg)
|
2021-08-14 09:40:12 +00:00
|
|
|
<img src='/demos/movingBars.gif' alt='' width=300/>
|
2021-08-14 09:48:25 +00:00
|
|
|
<img src='/demos/lineLabelled.png' alt='' height=380 width=380/>
|
2021-08-08 23:54:50 +00:00
|
|
|
![alt text](/demos/lineArea.png)
|
2021-08-14 09:40:12 +00:00
|
|
|
<img src='/demos/line.gif' alt='' height=400/>
|
2021-08-08 23:54:50 +00:00
|
|
|
![alt text](/demos/pielabbelled.svg)
|
2021-08-01 23:25:13 +00:00
|
|
|
|
2021-08-08 23:56:19 +00:00
|
|
|
---
|
|
|
|
|
2021-07-30 13:12:53 +00:00
|
|
|
## Installation
|
|
|
|
|
|
|
|
```sh
|
2021-08-07 11:55:16 +00:00
|
|
|
npm install react-native-gifted-charts react-native-linear-gradient react-native-svg
|
2021-07-30 13:12:53 +00:00
|
|
|
```
|
|
|
|
|
2021-08-07 11:55:16 +00:00
|
|
|
For Pie chart and Donut chart, these additional packages should be installed-
|
2021-08-02 14:39:00 +00:00
|
|
|
|
|
|
|
```sh
|
2021-08-07 11:55:16 +00:00
|
|
|
npm i react-native-canvas react-native-webview
|
2021-08-02 14:39:00 +00:00
|
|
|
```
|
|
|
|
|
2021-08-13 14:38:57 +00:00
|
|
|
You can omit the above packages if you don't intend to use Pie chart or Donut chart.
|
2021-08-07 11:55:16 +00:00
|
|
|
|
2021-08-02 14:39:00 +00:00
|
|
|
For iOS-
|
|
|
|
|
|
|
|
```sh
|
2021-08-02 14:42:26 +00:00
|
|
|
cd ios && pod install
|
2021-08-02 14:39:00 +00:00
|
|
|
```
|
|
|
|
|
2021-08-13 11:28:55 +00:00
|
|
|
# Docs
|
2021-08-13 14:38:57 +00:00
|
|
|
|
2021-08-13 11:28:55 +00:00
|
|
|
[Documentation and gallery](https://gifted-charts.web.app/)
|
|
|
|
|
2021-07-30 13:12:53 +00:00
|
|
|
## Usage
|
|
|
|
|
2021-08-02 11:20:24 +00:00
|
|
|
The simplest usage of various types of charts can be done as below-
|
2021-08-02 11:00:43 +00:00
|
|
|
|
2021-07-30 13:12:53 +00:00
|
|
|
```js
|
2021-08-02 11:00:43 +00:00
|
|
|
import { BarChart, LineChart, PieChart } from "react-native-gifted-charts";
|
2021-07-30 13:12:53 +00:00
|
|
|
|
|
|
|
// ...
|
2021-08-02 11:02:45 +00:00
|
|
|
const data=[ {value:50}, {value:80}, {value:90}, {value:70} ]
|
2021-08-02 11:00:43 +00:00
|
|
|
|
2021-08-02 11:02:25 +00:00
|
|
|
<BarChart data = {data} />
|
|
|
|
<LineChart data = {data} />
|
2021-08-02 11:21:40 +00:00
|
|
|
<PieChart data = {data} />
|
2021-08-02 11:00:43 +00:00
|
|
|
|
2021-08-02 11:20:24 +00:00
|
|
|
// For Horizontal Bar chart, just add the prop horizontal to the <BarChart/> component
|
2021-08-03 13:20:52 +00:00
|
|
|
|
2021-08-02 11:20:24 +00:00
|
|
|
<BarChart data = {data} horizontal />
|
|
|
|
|
|
|
|
// For Area chart, just add the prop areaChart to the <LineChart/> component
|
2021-08-03 13:20:52 +00:00
|
|
|
|
2021-08-02 11:02:25 +00:00
|
|
|
<LineChart data = {data} areaChart />
|
2021-07-30 13:12:53 +00:00
|
|
|
|
2021-08-02 11:20:24 +00:00
|
|
|
// For Donut chart, just add the prop donut to the <PieChart/> component
|
2021-08-03 13:20:52 +00:00
|
|
|
|
2021-08-02 11:02:25 +00:00
|
|
|
<PieChart data = {data} donut />
|
2021-07-30 13:12:53 +00:00
|
|
|
```
|
|
|
|
|
2021-08-03 12:26:35 +00:00
|
|
|
## Props tables
|
2021-08-03 10:06:06 +00:00
|
|
|
|
2021-08-08 23:27:06 +00:00
|
|
|
**[1. BarChart, Horizontal BarChart and Stacked Bar Chart props](docs/BarChart/BarChartProps.md)** \
|
2021-08-03 12:26:35 +00:00
|
|
|
**[2. LineChart and AreaChart props](docs/LineChart/LineChartProps.md)** \
|
|
|
|
**[3. PieChart and DonutChart props](docs/PieChart/PieChartProps.md)**
|
2021-08-03 10:06:06 +00:00
|
|
|
|
2021-07-30 13:12:53 +00:00
|
|
|
## Contributing
|
|
|
|
|
|
|
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
MIT
|