react-native-pure-chart icon indicating copy to clipboard operation
react-native-pure-chart copied to clipboard

Pie chart is not showing properly

Open prashant4dev opened this issue 6 years ago • 10 comments

simulator screen shot - iphone 8 plus - 2018-11-26 at 10 41 40

Please can any one help me on this ?

prashant4dev avatar Nov 26 '18 05:11 prashant4dev

I'm facing the same problem, any solutions?

This is hot it looks. Captura de pantalla 2019-03-19 a la(s) 17 44 11

This is the code i usisng

import React from 'react';
import {
  ScrollView,
  StyleSheet,
  Text,   
  View,
  Platform,
  Linking
} from 'react-native';
 import PureChart from 'react-native-pure-chart';
 import ActionButton from 'react-native-action-button';
 import Icon from 'react-native-vector-icons/dist/FontAwesome';

 import Colors from '../constants/Colors'

 const lineChartData = [ 
  {x: 'January', y: 30},
  {x: 'February', y: 200},
  {x: 'March', y: 170},
  {x: 'April', y: 250},
  {x: 'May', y: 10}
 ]

 const barChartData = [    
  {
    seriesName: 'series1', 
    data:[
      {x:'Theft',y:parseInt(Math.random() * 100)},
      {x:'Suspects',y: parseInt(Math.random() * 100)},
      {x: 'Burglary',y:parseInt(Math.random() * 100)},
      {x: 'Pickpocket',y:parseInt(Math.random() * 100)},                    
      {x:'Robbery',y:parseInt(Math.random() * 100)}  
    ],
    color: '#297AB1'
  },                     
 ]
 const pieData = [{label: 'Closed', value: 145, color: 'red'}, {label: 'Open', value: 55, color: 'green'} ]
 class DashboardScreen extends React.Component {
    static navigationOptions = {
      title: 'Dashboard',
      headerTintColor: '#fff',
      headerStyle: {
        backgroundColor: Colors.tintColor,
        color: '#fff',
      },
    };
  
    render() {
      return (
        <View style = {{flex:1}}>
        <ScrollView >            
          <View style = {styles.container}>
            <Text>
              Events per month
            </Text>
            <PureChart data={lineChartData} type='line' />
          </View>

          <View style = {styles.container}>
            <Text>
              Events per Category
            </Text>
            <PureChart data={barChartData} type='bar' />
          </View>
          <View style = {styles.container}>
            <Text>
              Events Open vs Closed
            </Text>            
              <PureChart data={pieData} type='pie' />            
          </View>           
        </ScrollView>
        <ActionButton
        buttonColor="rgba(231,76,60,1)"
        onPress={this.onPressCall.bind(this)}
        renderIcon={()=>{
          return(
            <View >
              <Icon
                name="warning"
                color="#fff"
                size={24}
            />   
            <Text style={{color:"#fff"}}>SOS</Text>
          </View>     
          )
        }}
      /> 
      </View>
      );
    }

    onPressCall() {
      let url = 'tel:911';
      console.log(Platform.OS)
      if (Platform.OS !== 'android'){
        url = 'telprompt:911';
      }
      Linking.canOpenURL(url)
        .then((supported) => {
          if (supported) {
            return Linking.openURL(url)
              .catch(() => null);
          } else {
            console.log(supported)
          }
        });
    }

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

export default DashboardScreen;

zedlen avatar Mar 19 '19 23:03 zedlen

Run it on the device it works fine.

prashant4dev avatar Mar 20 '19 02:03 prashant4dev

I run it on device, on android works perfectly, but in ios it doesnt work

WhatsApp Image 2019-03-20 at 11 43 49 AM

Simulator Screen Shot - iPhone X - 2019-03-20 at 11 45 27

zedlen avatar Mar 20 '19 17:03 zedlen

same issue. android works fine,but in ios device and simulatore not showing properly. anyone fixed this.

thanks in advance

Susmitha-Bogala avatar Apr 22 '19 10:04 Susmitha-Bogala

same here :(

yasarozg avatar Jul 24 '19 13:07 yasarozg

same issue on ios device

georgeCts avatar Feb 20 '20 16:02 georgeCts

any body help this issue?

duyquangg avatar Mar 11 '20 05:03 duyquangg

Same issue in ios

vish2595 avatar Jul 10 '20 07:07 vish2595

@vish2595 , @bkwilcox100 @duyquangg @georgeCts @yasarozg @Susmitha-Bogala @Prashant-Mutnale This library was not supported for very long. You should try the same library: react-native-chart-kit

TienNguyenanh avatar Feb 22 '21 06:02 TienNguyenanh

+1 Pie Chart quality is not really production ready please improve :-(

cederom avatar Aug 23 '21 18:08 cederom