Skip to content

Instantly share code, notes, and snippets.

@LintangWisesa
Created October 11, 2019 09:26
Show Gist options
  • Save LintangWisesa/c26290d9cadb058d7c78fbe79af1f0af to your computer and use it in GitHub Desktop.
Save LintangWisesa/c26290d9cadb058d7c78fbe79af1f0af to your computer and use it in GitHub Desktop.
React Native Chart Kit - #1 Line Chart
<LineChart
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: "red",
backgroundGradientFrom: "red",
backgroundGradientTo: "red",
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