Skip to content

Instantly share code, notes, and snippets.

@LintangWisesa
Created October 11, 2019 09:30
Show Gist options
  • Save LintangWisesa/6e42e23365b09bcde456e674e07ed010 to your computer and use it in GitHub Desktop.
Save LintangWisesa/6e42e23365b09bcde456e674e07ed010 to your computer and use it in GitHub Desktop.
React Native Chart Kit - #5 Pie Chart
<PieChart
data={
[
{
name: "Jawa Barat",
population: 48.0,
color: "rgba(131, 167, 234, 1)",
legendFontColor: "white",
legendFontSize: 11
},
{
name: "Jawa Timur",
population: 39.2,
color: "red",
legendFontColor: "white",
legendFontSize: 11
},
{
name: "Jawa Tengah",
population: 34.2,
color: "yellow",
legendFontColor: "white",
legendFontSize: 11
},
{
name: "Sumatera Utara",
population: 14.2,
color: "orange",
legendFontColor: "white",
legendFontSize: 11
},
{
name: "Banten",
population: 12.4,
color: "green",
legendFontColor: "white",
legendFontSize: 11
}
]
}
width={Dimensions.get("window").width - 50} // from react-native
height={220}
chartConfig={{
color: (opacity = 1) => `white`,
labelColor: (opacity = 1) => `white`,
style: {
borderRadius: 16
}
}}
backgroundColor="blue"
accessor="population"
paddingLeft="15"
absolute
style={{
marginVertical: 8,
borderRadius: 16
}}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment