Giter Site home page Giter Site logo

react-native-animated-pie's Introduction

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

// @flow
import * as React from "react";
import { ScrollView, Easing } from "react-native";

import Pie from "react-native-animated-pie";

export default class PieExample extends React.Component<any> {
  render() {
    const series = [40, 12, 68, 100, 25, 45, 200, 11];
    const delay = 0;
    return (
      <ScrollView>
        <Pie
          series={series.map(d => d).sort((a, b) => b - a)}
          height={380}
          outerRadius={100}
          easing={Easing.linear}
          delay={delay}
        />
        <Pie
          series={series.map(d => d).sort((a, b) => a - b)}
          outerRadius={100}
          height={200}
          innerRadius={55}
          delay={delay + 1000}
          easing={Easing.circle}
        />
      </ScrollView>
    );
  }
}

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

react-native-animated-pie's People

Contributors

henryluki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.