Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-pie-chart

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-pie-chart - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "react-native-pie-chart",
"version": "1.0.4",
"version": "1.0.5",
"description": "pie chart for react native",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

import React, { Component } from 'react';
import { ART } from 'react-native';
import { Platform, ART } from 'react-native';
const { Surface, Group, Path, Shape } = ART;

@@ -22,5 +22,7 @@ import Wedge from './Wedge';

render() {
const radius = this.getRadius();
const rotation = Platform.OS === 'ios' ? 0 : -90;
return (
<Surface style={this.props.style} width={this.props.chart_wh} height={this.props.chart_wh}>
<Group>
<Group rotation={rotation} originX={radius} originY={radius}>
{Object.keys(this.props.series).map((key)=>{

@@ -27,0 +29,0 @@ return (

@@ -26,3 +26,3 @@ /**

import React, {Component, PropTypes} from 'react';
import {ART} from 'react-native';
import {Platform, ART} from 'react-native';
const {Shape, Path} = ART;

@@ -131,6 +131,21 @@

path.move(or + or * ss, or - or * sc). // move to starting point
arc(or * ds, or * -dc, or, or, large). // outer arc
line(dr * es, dr * -ec); // width of arc or wedge
// Update by Gene Xu to fix android issue, follow below
// https://github.com/facebook/react-native/blob/master/Libraries/ART/ARTSerializablePath.js
// https://github.com/bgryszko/react-native-circular-progress/blob/master/src/CircularProgress.js
// https://github.com/nihgwu/react-native-pie
const ARC = 4;
const CIRCLE_X = or;
const CIRCLE_Y = or;
const RX = or - or / 2;
const TwoPI = 2 * Math.PI;
if (Platform.OS === 'ios') {
path.move(or + or * ss, or - or * sc). // move to starting point
arc(or * ds, or * -dc, or, or, large). // outer arc
line(dr * es, dr * -ec); // width of arc or wedge
} else {
path.path.push(ARC, CIRCLE_X, CIRCLE_Y, RX, startAngle / 360 * TwoPI, (startAngle / 360 * TwoPI) - ((endAngle - startAngle) / 360 * TwoPI), 0)
}
if (ir) {

@@ -165,3 +180,7 @@ path.counterArc(ir * -ds, ir * dc, ir, ir, large); // inner arc

return <Shape {...this.props} d={path}/>;
if (Platform.OS === 'ios') {
return <Shape {...this.props} d={path}/>;
} else {
return <Shape d={path} stroke={this.props.fill} strokeWidth={outerRadius} strokeCap='butt' />;
}
}

@@ -168,0 +187,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc