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';
|
|
|
|
import {LineChart} from './src';
|
|
|
|
|
|
|
|
const App = () => {
|
|
|
|
const lineData = [
|
2021-08-02 10:03:45 +00:00
|
|
|
{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'},
|
2021-08-01 19:20:13 +00:00
|
|
|
];
|
|
|
|
const lineData2 = [
|
2021-08-02 10:03:45 +00:00
|
|
|
{value: 30, text: 'Jan', textShiftX: 8},
|
|
|
|
{value: 40, text: 'Feb'},
|
|
|
|
{value: 60, text: 'Mar'},
|
|
|
|
{value: 70, text: 'Apr'},
|
|
|
|
{value: 100, text: 'May'},
|
2021-08-01 19:20:13 +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'}}>
|
|
|
|
<LineChart
|
|
|
|
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 09:17:35 +00:00
|
|
|
thickness={1}
|
|
|
|
dataPointsHeight={8}
|
|
|
|
dataPointsWidth={8}
|
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-01 22:57:35 +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-07-30 13:08:12 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|