Last active
December 14, 2016 03:01
-
-
Save Jpadilla1/58f88276381b4f1ce31c to your computer and use it in GitHub Desktop.
react-native-ios-charts PieChart example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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