Skip to content
项目

Abhinandan-Kushwaha/react-native-gifted-charts

在 GitHub 查看

关于

React Native 中广受喜爱的图表库,支持柱状图、折线图、面积图、饼图、圆环图、堆叠柱状图、人口金字塔图、雷达图、气泡图、散点图和 K 线图,并支持 2D、3D、渐变、动画以及实时数据更新。

数据与分析

这些数字如何统计

实测星标增长

24小时
0
7天
+2
15天
+3
1个月
+1

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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)
  • Detailed documentation with examples
  • Support for combined Bar and Line charts
  • Tested to be pixel perfect using react-native-screenshot-test. See the screenshot tests here
  • Detailed and illustrated dev docs 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
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) 🎉

See the release changes by version here.

Bar Chart Line and Area Chart Bar and Pie Chart
Area Chart with Pointer Candle Stick Chart
Area Chart with Crosshair Bubble Chart
Radar Chart Population Pyramid Chart
Donut Chart with External Labels

Installation

React Native CLI

npm install react-native-gifted-charts react-native-svg

Expo

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 contains the mathematical and logical utilities used by this library.

📚 Docs & Demos 🎦

Usage

The simplest usage of various types of charts can be done as below-

import { BarChart, LineChart, PieChart, PopulationPyramid, RadarChart, BubbleChart, CandleStickChart } from "react-native-gifted-charts";

// ...
const data=[ {value:50}, {value:80}, {value:90}, {value:70} ]

<BarChart data = {data} />
<LineChart data = {data} />
<PieChart data = {data} />
<PopulationPyramid data = {[{left:10,right:12}, {left:9,right:8}]} />
<RadarChart data = {[50, 80, 90, 70]} />
<BubbleChart data = {[
  {x: 20, y: 4, r: 10},
  {x: 40, y: 6, r: 20},
]} />
<CandleStickChart data = {[
  {open: 82, close: 76, high: 90, low: 60},
  {open: 50, close: 57, high: 71, low: 44},
]} />

// For Horizontal Bar chart, just add the prop horizontal to the <BarChart/> component

<BarChart data = {data} horizontal />

// For Area chart, just add the prop areaChart to the <LineChart/> component

<LineChart data = {data} areaChart />

// For Donut chart, just add the prop donut to the <PieChart/> component

<PieChart data = {data} donut />

// For Scatter chart, just add the prop scatterChart to the <BubbleChart/> component

<BubbleChart
  data = {[
    {x: 20, y: 4, r: 10},
    {x: 40, y: 6, r: 20},
  ]}
  scatterChart
/>

Props tables

1. Bar Chart, Horizontal Bar Chart and Stacked Bar Chart props
2. Line Chart and Area Chart props
3. Bubble Chart props
4. Candle Stick Chart props
5. Pie Chart and Donut Chart props
6. Radar Chart props
7. Population Pyramid props

🤝 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.

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 to learn how to contribute to the repository and the development workflow.

📝 To do list

🧐 Test cases

🏆 Showcase

Showcase your dashing charts on Expo snack and list them on the Demo app repo.
Your snack might get published in the Demo app on Play Store!

License

MIT

探索相关项目

加载中…