Skip to content

Instantly share code, notes, and snippets.

@Jpadilla1
Last active December 14, 2016 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Jpadilla1/58f88276381b4f1ce31c to your computer and use it in GitHub Desktop.
Save Jpadilla1/58f88276381b4f1ce31c to your computer and use it in GitHub Desktop.
react-native-ios-charts PieChart example
import React, {
AppRegistry,
Component,
StyleSheet,
View
} from 'react-native';
import { PieChart } from 'react-native-ios-charts';
class charts extends Component {
render() {
const config = {
dataSets: [{
values: [5, 40, 77],
colors: ['red', 'green', 'blue'],
label: '2016'
}],
backgroundColor: 'transparent',
labels: ['A', 'B', 'C']
};
return (
<View style={styles.container}>
<PieChart config={config} style={styles.chart}/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'stretch',
backgroundColor: 'white',
paddingTop: 40,
paddingBottom: 40,
paddingLeft: 10,
paddingRight: 20
},
chart: {
flex: 1
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment