You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-native-pie-chart-custom

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-pie-chart-custom

A customizable pie chart component for React Native

1.0.4
latest
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

react-native-pie-chart-custom

A customizable pie chart component for React Native, built using react-native-svg.

Installation

  • Install the library:

    npm install react-native-pie-chart-custom
    
    

Usage Example

Below is a simple example on how to integrate the PieChart into your React Native application. Ensure you have react-native-svg installed in your project to use react-native-pie-chart-custom.

Importing the Component

First, you need to import the PieChart from the library:

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

Sample Data

Prepare some data that you would like to display in the pie chart:

const dataOutstandingBill = [
    {value: 20, color: '#7bc043', label: '20K'},
    {value: 30, color: '#f18700', label: '30K'},
    {value: 50, color: '#0077b3', label: '50K'},
];

Rendering the PieChart

You can render the PieChart inside a view component in your screen. Customize it by setting its size prop to scale the pie chart:

import React from 'react';
import { View, StyleSheet } from 'react-native';

const App = () => {
  return (
    <View style={styles.container}>
      <PieChart data={dataOutstandingBill} size={150} />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#fff'
  }
});

export default App;

Customizing the PieChart

The PieChart component is highly customizable. You can adjust the size, pass different data arrays, and modify the styles to fit your design needs.

Keywords

react-native

FAQs

Package last updated on 13 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts