项目作者: henryluki

项目描述 :
Animated Pie chart for React Native,use ART and Animated
高级语言: JavaScript
项目地址: git://github.com/henryluki/react-native-animated-pie.git
创建时间: 2018-08-11T09:27:39Z
项目社区:https://github.com/henryluki/react-native-animated-pie

开源协议:MIT License

下载


react-native-animated-pie

Animated Pie chart for React Native,use ART and Animated

Demo

demo

Install

  1. npm i --save react-native-animated-pie
  2. Link the ART library to your ReactNative project (how to link a library). You’ll find the React ART library in node_modules/react-native/Libraries/ART/ART.xcodeproj

Usage

  1. // @flow
  2. import * as React from "react";
  3. import { ScrollView, Easing } from "react-native";
  4. import Pie from "react-native-animated-pie";
  5. export default class PieExample extends React.Component<any> {
  6. render() {
  7. const series = [40, 12, 68, 100, 25, 45, 200, 11];
  8. const delay = 0;
  9. return (
  10. <ScrollView>
  11. <Pie
  12. series={series.map(d => d).sort((a, b) => b - a)}
  13. height={380}
  14. outerRadius={100}
  15. easing={Easing.linear}
  16. delay={delay}
  17. />
  18. <Pie
  19. series={series.map(d => d).sort((a, b) => a - b)}
  20. outerRadius={100}
  21. height={200}
  22. innerRadius={55}
  23. delay={delay + 1000}
  24. easing={Easing.circle}
  25. />
  26. </ScrollView>
  27. );
  28. }
  29. }

Props

series: Array<number | string> dataset, required

width?: number default window width

height?: number default width

outerRadius?: number default width / 2

innerRadius?: number default 0

x?: number coordinate of pie center, default width / 2

y?: number coordinate of pie center, default height / 2

colors?: Array<string> colors, check src/constants.js for default colors

delay?: number animation delay, default 0ms

animate?: boolean animation or not, default true

duration?: number animation duration, default 1000ms

easing?: Function easing func, default Easing.out(Easing.cubic)

License

MIT