2021-07-30 13:08:12 +00:00
|
|
|
import React from 'react';
|
2021-08-08 21:57:02 +00:00
|
|
|
import { View, StyleSheet } from 'react-native';
|
2021-08-05 20:09:16 +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 = [
|
2021-08-08 21:57:02 +00:00
|
|
|
{ value: 15, label: 'Jan', showVerticalLine: true },
|
|
|
|
{ value: 40, label: 'Feb', verticalLineColor: 'red', showVerticalLine: true, verticalLineThickness: StyleSheet.hairlineWidth },
|
2021-08-05 20:09:16 +00:00
|
|
|
{ value: 10, label: 'Mar', showDataPoint: true, dataPointShape: 'rectangular', dataPointHeight: 20, dataPointWidth: 20, },
|
2021-08-08 21:57:02 +00:00
|
|
|
{ value: 30, label: 'Apr', showVerticalLine: true, showDataPoint: true },
|
2021-08-05 08:43:15 +00:00
|
|
|
];
|
2021-08-02 11:11:56 +00:00
|
|
|
|
2021-08-08 23:23:39 +00:00
|
|
|
const stackData = [
|
|
|
|
{
|
|
|
|
stacks:
|
|
|
|
[{
|
|
|
|
value: 10, color: 'red'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 20, color: 'blue', marginBottom: 1
|
|
|
|
}],
|
|
|
|
label: 'Jan'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
stacks:
|
|
|
|
[{
|
|
|
|
value: 14, color: 'red'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 18, color: 'blue', marginBottom: 1
|
|
|
|
}],
|
|
|
|
label: 'Feb'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
stacks:
|
|
|
|
[{
|
|
|
|
value: 7, color: 'red'
|
|
|
|
},
|
|
|
|
{ value: 11, color: 'green', marginBottom: 1 },
|
|
|
|
{
|
|
|
|
value: 10, color: 'blue', marginBottom: 1
|
|
|
|
}],
|
|
|
|
label: 'Mar'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-07-30 13:08:12 +00:00
|
|
|
return (
|
2021-08-05 20:09:16 +00:00
|
|
|
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
2021-08-05 18:33:18 +00:00
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
// flex: 1,
|
|
|
|
// backgroundColor: 'pink',
|
|
|
|
width: 300,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
}}>
|
2021-08-08 21:57:02 +00:00
|
|
|
{/* <LineChart
|
2021-08-05 20:09:16 +00:00
|
|
|
data={data}
|
|
|
|
hideDataPoints
|
2021-08-08 21:57:02 +00:00
|
|
|
areaChart
|
|
|
|
curved
|
|
|
|
color='rgb(220,140,140)'
|
|
|
|
startFillColor='rgb(220,140,140)'
|
|
|
|
endFillColor='rgba(250,240,240)'
|
|
|
|
startOpacity={0.9}
|
|
|
|
endOpacity={0.3}
|
2021-08-05 20:09:16 +00:00
|
|
|
// dataPointsShape='rectangular'
|
|
|
|
// dataPointsHeight={12}
|
|
|
|
// dataPointsWidth={12}
|
2021-08-05 18:33:18 +00:00
|
|
|
/> */}
|
2021-08-08 21:57:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
{/* <BarChart
|
|
|
|
showGradient
|
|
|
|
// isThreeD
|
|
|
|
// isAnimated
|
|
|
|
// width={300}
|
|
|
|
gradientColor="lightgray"
|
|
|
|
// backgroundColor="yellow"
|
|
|
|
hideRules
|
|
|
|
// yAxisThickness={0}
|
|
|
|
roundedTop
|
|
|
|
showYAxisIndices
|
|
|
|
xAxisThickness={0}
|
|
|
|
spacing={30}
|
|
|
|
noOfSections={4}
|
|
|
|
// hideAxesAndRules
|
|
|
|
frontColor="#eeeeee"
|
|
|
|
barBorderRadius={10}
|
|
|
|
data={data}
|
|
|
|
/> */}
|
|
|
|
|
|
|
|
<BarChart
|
|
|
|
width={300}
|
2021-08-08 23:23:39 +00:00
|
|
|
rotateLabel
|
|
|
|
// isAnimated
|
|
|
|
horizontal
|
|
|
|
barWidth={8}
|
|
|
|
spacing={40}
|
|
|
|
noOfSections={4}
|
|
|
|
initialSpacing={50}
|
|
|
|
barBorderRadius={20}
|
|
|
|
stackData={stackData}
|
|
|
|
/>
|
2021-08-08 21:57:02 +00:00
|
|
|
|
|
|
|
|
2021-08-05 18:33:18 +00:00
|
|
|
{/* <Text>Hello</Text> */}
|
|
|
|
</View>
|
2021-08-05 12:12:48 +00:00
|
|
|
{/* <LineChart data={data} /> */}
|
|
|
|
{/* <PieChart
|
2021-08-05 08:43:15 +00:00
|
|
|
showText
|
|
|
|
showTextBackground
|
|
|
|
showValuesAsLabels
|
|
|
|
textSize={14}
|
|
|
|
data={data}
|
2021-08-05 12:12:48 +00:00
|
|
|
/> */}
|
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}
|
2021-08-01 22:57:35 +00:00
|
|
|
yAxisTextStyle={{color: 'blue', fontSize: 10}}
|
2021-08-01 19:20:13 +00:00
|
|
|
isAnimated
|
2021-08-01 22:57:35 +00:00
|
|
|
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
|
2021-08-02 10:03:45 +00:00
|
|
|
// textColor="skyblue"
|
2021-08-02 09:17:35 +00:00
|
|
|
// dataPointsShape="rectangular"
|
2021-08-01 22:57:35 +00:00
|
|
|
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
|
2021-08-01 22:57:35 +00:00
|
|
|
// hideRules
|
2021-08-01 19:20:13 +00:00
|
|
|
showVerticalRules
|
2021-08-01 22:57:35 +00:00
|
|
|
// 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;
|