Last active
October 25, 2019 17:40
-
-
Save mattgle/6c1c4efe854f0662f0433b377a0ebd91 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, { useState, useEffect } from 'react'; | |
import { View } from 'react-native'; | |
import { VictoryPie } from 'victory-native'; | |
import styles from './styles'; | |
const graphicColor = ['#388087', '#6fb3b8', '#badfe7']; // Colors | |
const wantedGraphicData = [{ y: 10 }, { y: 50 }, { y: 40 }]; // Data that we want to display | |
const defaultGraphicData = [{ y: 0 }, { y: 0 }, { y: 100 }]; // Data used to make the animate prop work | |
function Home() { | |
const [graphicData, setGraphicData] = useState(defaultGraphicData); | |
useEffect(() => { | |
setGraphicData(wantedGraphicData); // Setting the data that we want to display | |
}, []); | |
return ( | |
<View style={styles.container}> | |
<VictoryPie | |
animate={{ easing: 'exp' }} | |
data={graphicData} | |
width={250} | |
height={250} | |
colorScale={graphicColor} | |
innerRadius={50} | |
/> | |
</View> | |
); | |
} | |
export default Home; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment