Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import React, { useState, useEffect } from 'react';
  2. import { View } from 'react-native';
  3. import { VictoryPie } from 'victory-native';
  4.  
  5. import styles from './styles';
  6.  
  7. const graphicColor = ['#388087', '#6fb3b8', '#badfe7']; // Colors
  8. const wantedGraphicData = [{ y: 10 }, { y: 50 }, { y: 40 }]; // Data that we want to display
  9. const defaultGraphicData = [{ y: 0 }, { y: 0 }, { y: 100 }]; // Data used to make the animate prop work
  10.  
  11. function Home() {
  12. const [graphicData, setGraphicData] = useState(defaultGraphicData);
  13.  
  14. useEffect(() => {
  15. setGraphicData(wantedGraphicData); // Setting the data that we want to display
  16. }, []);
  17.  
  18. return (
  19. <View style={styles.container}>
  20. <VictoryPie
  21. animate={{ easing: 'exp' }}
  22. data={graphicData}
  23. width={250}
  24. height={250}
  25. colorScale={graphicColor}
  26. innerRadius={50}
  27. />
  28. </View>
  29. );
  30. }
  31.  
  32. export default Home;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement