Skip to content

Instantly share code, notes, and snippets.

@LintangWisesa
Created October 11, 2019 09:28
Show Gist options
  • Save LintangWisesa/87c1764bdeeed346f4125b53b6ebeb68 to your computer and use it in GitHub Desktop.
Save LintangWisesa/87c1764bdeeed346f4125b53b6ebeb68 to your computer and use it in GitHub Desktop.
React Native Chart Kit - #3 Bar Chart
<BarChart
data={{
labels: ["Januari", "Februari", "Maret", "April", "Mei", "Juni"],
datasets: [
{
data: [
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100
]
}
]
}}
width={Dimensions.get("window").width - 50} // from react-native
height={220}
yAxisLabel={"Rp"}
chartConfig={{
backgroundColor: "yellow",
backgroundGradientFrom: "yellow",
backgroundGradientTo: "yellow",
decimalPlaces: 2, // optional, defaults to 2dp
color: (opacity = 1) => `black`,
labelColor: (opacity = 1) => `black`,
barPercentage:1,
style: {
borderRadius: 16
}
}}
style={{
marginVertical: 8,
borderRadius: 16
}}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment