0.1.2 • Published 12 months ago

rn-animated-pie-chart v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

React Native Animated Pie Chart

Animated Pie Chart for React Native

Installation

npm install rn-animated-pie-chart

React Native Animated Pie Chart is made up of some core utilities and those are then used by it to draw and animate the pie chart. Let's also install and configure dependencies used by this library.

Installing dependencies

In your project directory, run:

npm install react-native-svg
npm install react-native-reanimated

Add Reanimated's babel plugin to your "babel.config.js":

module.exports = {
    presets: [
      ...
    ],
    plugins: [
      ...
      'react-native-reanimated/plugin', // add this line
    ],
  };

For aditional instructions please visit React Native Reanimated and React Native SVG

Usage

import { PieChart, AnimatedPieChart } from 'rn-animated-pie-chart';

// ...

    <PieChart data={[10, 20]} /> // no animated
    <AnimatedPieChart
          data={[10, 20, 30]}
          colors={['red', 'blue', 'green']}
          size={200}
          holeSize={20}
        />

Props

PropertyTypeDefaultDescription
datanumber[]RequiredAn array of the data entries, each value must be a number
colorsnumber[]predifened colorsAn array of colors, it should have the same length as the data
sizenumber100The chart size in pixels
holeSizenumber0The size of the doughnut hole in pixels
startAnglenumber0The start angle in degrees of the entire pie
endAnglenumber360The end angle in degrees of the entire pie

License

MIT


Made with create-react-native-library

0.1.2

12 months ago

0.1.1

12 months ago