Giter Site home page Giter Site logo

mohamedsaidsallam / react-native-expo-pie-chart Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 376 KB

A customizable Pie Chart library that uses react-native-svg. Can be used for react native & expo.

Home Page: https://www.npmjs.com/package/react-native-expo-pie-chart

License: MIT License

JavaScript 33.68% TypeScript 66.32%
npm npm-package npm-module react-native pie-chart piechart react-native-package expo-package eslint prettier

react-native-expo-pie-chart's Introduction

react-native-expo-pie-chart

npm npm npm bundle size GitHub issues Npm Publish Workflow License

A customizable Pie Chart library that uses react-native-svg. Can be used for react native & expo.

Example

Installation

Install using npm

npm i react-native-expo-pie-chart

Please Note: react-native-svg is required as peer dependencies. Install it according to their documentation.

Usage

View it live: Expo Snack

import PieChart from 'react-native-expo-pie-chart';

<PieChart
    data={[
    {
        key: 'First Data',
        count: 20,
        color: 'blue',
    },
    {
        key: 'Second Data',
        count: 25,
        color: 'yellow',
    },
    {
        key: 'Third Data',
        count: 40,
        color: 'green',
    },
    {
        key: 'Forth Data',
        count: 35,
        color: 'orange',
    },
    ]}
    length={200}
/>

Props

Name Type Description Required Default
data dataItem[] โœ“
length number the side length of the bounding square 150
rotation number rotation of the pie chart -90
zeroTotalCircleColor string the color of the complete circle to display if the total of data.count is zero '#F1F6F9'
containerProps ViewProps props for wrapper view component
svgProps SvgProps props for the svg component (read react-native-svg docs))
gProps GProps props for the g component (read react-native-svg docs))
circleProps CircleProps props for the circle component (read react-native-svg docs))

Data Item

Name Type Description
color string the color of this item in the pie chart
count number the value of this item
key string unique key representing this item

Developing

You can use the example app to develop the package.

To link the package in development, You can use Yalc. Read through the installation and usage section in Yalc's documentation or use the following lines for a quick start:

npm i yalc -g

yalc publish

cd example
yalc add react-native-expo-pie-chart
npm install

License

This project is licensed under the MIT License - see the LICENSE file for details

react-native-expo-pie-chart's People

Contributors

mohamedsaidsallam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.