Last active
July 29, 2020 13:01
-
-
Save mohit-kaushik/d1140d596e0de5284ec136136ef6faa0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 from 'react' | |
| import { View, Text, Dimensions } from 'react-native' | |
| import { LineChart } from 'react-native-chart-kit' | |
| const Charts = () => { | |
| return ( | |
| <View> | |
| <LineChart | |
| data={{ | |
| labels: ["January", "February", "March", "April", "May", "June"], | |
| 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} | |
| height={250} | |
| yAxisLabel="$" | |
| yAxisSuffix="k" | |
| yAxisInterval={1} | |
| chartConfig={{ | |
| backgroundColor: "white", | |
| backgroundGradientFrom: "#fbfbfb", | |
| backgroundGradientTo: "#fbfbfb", | |
| decimalPlaces: 2, // optional, defaults to 2dp | |
| color: (opacity = 1) => `rgba(0, 0, 0, ${opacity})`, | |
| labelColor: (opacity = 1) => `rgba(0, 0, 0, ${opacity})`, | |
| style: { | |
| borderRadius: 0 | |
| }, | |
| propsForDots: { | |
| r: "6", | |
| strokeWidth: "2", | |
| stroke: "#fbfbfb" | |
| } | |
| }} | |
| bezier | |
| style={{ | |
| marginVertical: 8, | |
| borderRadius: 6 | |
| }} | |
| /> | |
| </View> | |
| ) | |
| } | |
| export default Charts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment