Skip to content

Instantly share code, notes, and snippets.

@LintangWisesa
Created October 11, 2019 09:29
Show Gist options
  • Save LintangWisesa/1d7b004deae1811ce14c2b5feeffafad to your computer and use it in GitHub Desktop.
Save LintangWisesa/1d7b004deae1811ce14c2b5feeffafad to your computer and use it in GitHub Desktop.
React Native Chart Kit - #4 Stacked Bar Chart
<StackedBarChart
data={{
labels: ["Test1", "Test2"],
legend: ["L1", "L2", "L3"],
data: [[60, 60, 60], [30, 30, 60]],
barColors: ["#dfe4ea", "#ced6e0", "#a4b0be"]
}}
width={Dimensions.get("window").width - 50} // from react-native
height={220}
yAxisLabel={"Rp"}
chartConfig={{
backgroundColor: "green",
backgroundGradientFrom: "green",
backgroundGradientTo: "green",
decimalPlaces: 2, // optional, defaults to 2dp
color: (opacity = 1) => `white`,
labelColor: (opacity = 1) => `white`,
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