react-native-gifted-charts/App.js

93 lines
2.4 KiB
JavaScript
Raw Normal View History

2021-07-30 13:08:12 +00:00
import React from 'react';
2021-08-01 19:20:13 +00:00
import {View} from 'react-native';
2021-08-02 11:11:56 +00:00
import {BarChart, LineChart, PieChart} from './src';
2021-08-01 19:20:13 +00:00
const App = () => {
2021-08-02 11:24:44 +00:00
// const lineData = [
// {value: 40, text: 'Jan', textShiftX: 8, textShiftY: -10},
// {value: 80, text: 'Feb'},
// {value: 170, text: 'Mar', textFontSize: 16, textColor: 'blue'},
// {value: 90, text: 'Apr'},
// {value: 190, text: 'May'},
// ];
// const lineData2 = [
// {value: 30, text: 'Jan', textShiftX: 8},
// {value: 40, text: 'Feb'},
// {value: 60, text: 'Mar'},
// {value: 70, text: 'Apr'},
// {value: 100, text: 'May'},
// ];
2021-07-30 13:08:12 +00:00
2021-08-05 08:43:15 +00:00
const data = [
{value: 150},
{value: 80, text: 80},
{value: 90, text: 90, textColor: 'green', textBackgroundColor: 'pink'},
{value: 70},
];
2021-08-02 11:11:56 +00:00
2021-07-30 13:08:12 +00:00
return (
2021-08-01 19:20:13 +00:00
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
2021-08-05 08:43:15 +00:00
<BarChart
showGradient
gradientColor="gray"
frontColor="white"
data={data}
/>
2021-08-02 11:24:44 +00:00
<LineChart data={data} />
2021-08-05 08:43:15 +00:00
<PieChart
showText
showTextBackground
showValuesAsLabels
textSize={14}
data={data}
/>
2021-08-02 11:11:56 +00:00
{/* <LineChart data={data} curved /> */}
{/* <BarChart
data={data}
frontColor="lightgray"
cappedBars
capThickness={2}
capColor="gray"
/> */}
{/* <PieChart data={data} donut isThreeD shadow /> */}
2021-08-02 11:24:44 +00:00
{/* <BarChart data={data} horizontal noOfSections={5} /> */}
{/* <LineChart
2021-08-01 19:20:13 +00:00
xAxisColor="red"
xAxisThickness={2}
yAxisColor="purple"
yAxisThickness={0.5}
yAxisTextStyle={{color: 'blue', fontSize: 10}}
2021-08-01 19:20:13 +00:00
isAnimated
animationDuration={1200}
2021-08-01 19:20:13 +00:00
height={300}
rotateLabel
2021-08-02 11:11:56 +00:00
// thickness={1}
2021-08-02 09:17:35 +00:00
dataPointsHeight={8}
dataPointsWidth={8}
2021-08-02 11:11:56 +00:00
animateTogether
// textColor="skyblue"
2021-08-02 09:17:35 +00:00
// dataPointsShape="rectangular"
spacing={84}
2021-08-02 09:17:35 +00:00
initialSpacing={4}
2021-08-02 11:11:56 +00:00
// areaChart
2021-08-01 19:20:13 +00:00
color1="skyblue"
color2="orange"
data={[...lineData]}
startFillColor1="skyblue"
endOpacity1={0.1}
endFillColor1="skyblue"
startFillColor2="orange"
endFillColor2="white"
curved
// hideRules
2021-08-01 19:20:13 +00:00
showVerticalRules
// showYAxisIndices
// showXAxisIndices
2021-08-01 19:20:13 +00:00
data2={[...lineData2]}
2021-08-02 11:24:44 +00:00
/> */}
2021-07-30 13:08:12 +00:00
</View>
);
};
export default App;