2022-01-12 16:52:27 +05:30
|
|
|
import React, {useEffect, useState} from 'react';
|
2021-08-16 13:41:23 +05:30
|
|
|
import {TouchableOpacity} from 'react-native';
|
|
|
|
import {Alert} from 'react-native';
|
2021-08-12 20:02:44 +05:30
|
|
|
import {View, Text, StyleSheet} from 'react-native';
|
2022-01-28 04:17:45 +05:30
|
|
|
import {BarChart, LineChart, PieChart} from './src';
|
2021-08-02 00:50:13 +05:30
|
|
|
|
|
|
|
const App = () => {
|
2021-08-16 13:41:23 +05:30
|
|
|
const [toggle, setToggle] = useState(true);
|
2022-01-12 19:09:17 +05:30
|
|
|
// useEffect(() => {
|
|
|
|
// setTimeout(() => {
|
|
|
|
// setCurrentData(latestData5);
|
|
|
|
// }, 1100 + 100 + 310);
|
|
|
|
// setTimeout(() => {
|
|
|
|
// setCurrentData(latestData2);
|
|
|
|
// }, 1100 + 300 + 620);
|
2022-01-12 16:52:27 +05:30
|
|
|
|
2022-01-12 19:09:17 +05:30
|
|
|
// setTimeout(() => {
|
|
|
|
// setCurrentData(latestData5);
|
|
|
|
// }, 1100 + 500 + 930);
|
2022-01-12 16:52:27 +05:30
|
|
|
|
2022-01-12 19:09:17 +05:30
|
|
|
// setTimeout(() => {
|
|
|
|
// setCurrentData(latestData3);
|
|
|
|
// }, 1100 + 1000 + 1240);
|
2022-01-12 16:52:27 +05:30
|
|
|
|
2022-01-12 19:09:17 +05:30
|
|
|
// setTimeout(() => {
|
|
|
|
// setCurrentData(latestData4);
|
|
|
|
// }, 1100 + 1500 + 1550);
|
2022-01-12 16:52:27 +05:30
|
|
|
|
2022-01-12 19:09:17 +05:30
|
|
|
// setTimeout(() => {
|
|
|
|
// setCurrentData(latestData5);
|
|
|
|
// }, 6000);
|
2022-01-12 16:52:27 +05:30
|
|
|
|
2022-01-12 19:09:17 +05:30
|
|
|
// setTimeout(() => {
|
|
|
|
// setCurrentData(latestData);
|
|
|
|
// }, 7000);
|
|
|
|
// }, []);
|
2021-12-04 00:01:42 +05:30
|
|
|
const dPoint = () => {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
2022-01-12 16:52:27 +05:30
|
|
|
width: 14,
|
|
|
|
height: 14,
|
2021-12-04 00:01:42 +05:30
|
|
|
backgroundColor: 'white',
|
2022-01-12 16:52:27 +05:30
|
|
|
borderWidth: 3,
|
|
|
|
borderRadius: 7,
|
2021-12-04 00:01:42 +05:30
|
|
|
borderColor: '#07BAD1',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
const lcomp = val => {
|
|
|
|
return (
|
|
|
|
<View style={{width: 70, marginLeft: 7}}>
|
|
|
|
<Text style={{color: 'white', fontWeight: 'bold'}}>{val}</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
const latestData = [
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 600 - 100,
|
|
|
|
labelComponent: () => lcomp('22 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 210,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 250,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 320,
|
|
|
|
labelComponent: () => lcomp('24 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
showStrip: true,
|
|
|
|
stripHeight: 190,
|
|
|
|
stripColor: 'black',
|
|
|
|
dataPointLabelComponent: () => {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'black',
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
paddingVertical: 5,
|
|
|
|
borderRadius: 4,
|
|
|
|
}}>
|
|
|
|
<Text style={{color: 'white'}}>410</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dataPointLabelShiftY: -70,
|
|
|
|
dataPointLabelShiftX: -14,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 310,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 270,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 240,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 130,
|
|
|
|
labelComponent: () => lcomp('26 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 100,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 210,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 270,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 240,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 100,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 210,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 20,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 100,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const latestData2 = [
|
|
|
|
{
|
|
|
|
value: 400 - 100,
|
|
|
|
labelComponent: () => lcomp('22 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 210,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 250,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 320,
|
|
|
|
labelComponent: () => lcomp('24 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
showStrip: true,
|
|
|
|
stripHeight: 190,
|
|
|
|
stripColor: 'black',
|
|
|
|
dataPointLabelComponent: () => {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'black',
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
paddingVertical: 5,
|
|
|
|
borderRadius: 4,
|
|
|
|
}}>
|
|
|
|
<Text style={{color: 'white'}}>410</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dataPointLabelShiftY: -70,
|
|
|
|
dataPointLabelShiftX: -14,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 310,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 270,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 240,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 130,
|
|
|
|
labelComponent: () => lcomp('26 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 100,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 210,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 270,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 240,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 100,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 210,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 20,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 400 - 100,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const latestData3 = [
|
|
|
|
{
|
|
|
|
value: 600 - 170,
|
|
|
|
labelComponent: () => lcomp('22 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 60,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 290,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 390,
|
|
|
|
labelComponent: () => lcomp('24 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
showStrip: true,
|
|
|
|
stripHeight: 190,
|
|
|
|
stripColor: 'black',
|
|
|
|
dataPointLabelComponent: () => {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'black',
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
paddingVertical: 5,
|
|
|
|
borderRadius: 4,
|
|
|
|
}}>
|
|
|
|
<Text style={{color: 'white'}}>410</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dataPointLabelShiftY: -70,
|
|
|
|
dataPointLabelShiftX: -14,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 210,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 370,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 140,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 330,
|
|
|
|
labelComponent: () => lcomp('26 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 50,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 200,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 110,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 370,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 140,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 320,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 20,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 310,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 120,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 600 - 100,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const latestData4 = [
|
|
|
|
{
|
|
|
|
value: 300 - 170,
|
2021-12-04 00:01:42 +05:30
|
|
|
labelComponent: () => lcomp('22 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 60,
|
2021-12-04 00:01:42 +05:30
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 290,
|
2021-12-04 00:01:42 +05:30
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 120,
|
2021-12-04 00:01:42 +05:30
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 390,
|
2021-12-04 00:01:42 +05:30
|
|
|
labelComponent: () => lcomp('24 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
showStrip: true,
|
|
|
|
stripHeight: 190,
|
|
|
|
stripColor: 'black',
|
|
|
|
dataPointLabelComponent: () => {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'black',
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
paddingVertical: 5,
|
|
|
|
borderRadius: 4,
|
|
|
|
}}>
|
|
|
|
<Text style={{color: 'white'}}>410</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dataPointLabelShiftY: -70,
|
|
|
|
dataPointLabelShiftX: -14,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 210,
|
2021-12-04 00:01:42 +05:30
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 370,
|
2021-12-04 00:01:42 +05:30
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 140,
|
2021-12-04 00:01:42 +05:30
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 330,
|
2021-12-04 00:01:42 +05:30
|
|
|
labelComponent: () => lcomp('26 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 50,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 200,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 110,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 370,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 140,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 320,
|
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 20,
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 310,
|
|
|
|
labelComponent: () => lcomp('28 Nov'),
|
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 300 - 120,
|
2021-12-04 00:01:42 +05:30
|
|
|
hideDataPoint: true,
|
|
|
|
},
|
|
|
|
{
|
2022-01-12 16:52:27 +05:30
|
|
|
value: 300 - 100,
|
2021-12-04 00:01:42 +05:30
|
|
|
customDataPoint: dPoint,
|
|
|
|
},
|
|
|
|
];
|
2022-01-12 16:52:27 +05:30
|
|
|
const latestData5 = [];
|
|
|
|
for (let i = 0; i < latestData.length; i++) {
|
|
|
|
latestData5[i] = {...latestData, value: 300};
|
|
|
|
}
|
|
|
|
|
|
|
|
const [currentData, setCurrentData] = useState(latestData);
|
2021-08-16 13:41:23 +05:30
|
|
|
|
2021-12-04 00:01:42 +05:30
|
|
|
const customLabel = val => {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
backgroundColor: 'black',
|
|
|
|
// padding: 16,
|
|
|
|
borderRadius: 8,
|
|
|
|
width: 30,
|
|
|
|
paddingVertical: 4,
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
}}>
|
|
|
|
<Text style={{color: 'white'}}>{val}</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
2022-01-12 19:09:17 +05:30
|
|
|
const ndd = [
|
2022-01-28 04:17:45 +05:30
|
|
|
{value: 30, color: 'rgb(84,219,234)'},
|
|
|
|
{value: 40, color: 'lightgreen'},
|
|
|
|
{value: 20, color: 'orange'},
|
2022-01-12 19:09:17 +05:30
|
|
|
];
|
2021-12-02 17:21:19 +05:30
|
|
|
const [data, setData] = useState([
|
2021-11-26 23:34:22 +05:30
|
|
|
{value: 15, label: 'Jan'},
|
2021-08-12 20:02:44 +05:30
|
|
|
{
|
|
|
|
value: 40,
|
|
|
|
label: 'Feb',
|
|
|
|
verticalLineColor: 'red',
|
2021-08-16 13:41:23 +05:30
|
|
|
// showVerticalLine: true,
|
2021-08-12 20:02:44 +05:30
|
|
|
verticalLineThickness: StyleSheet.hairlineWidth,
|
2021-12-04 00:01:42 +05:30
|
|
|
dataPointLabelComponent: () => customLabel(40),
|
2021-08-12 20:02:44 +05:30
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 10,
|
|
|
|
label: 'Mar',
|
2021-12-04 00:01:42 +05:30
|
|
|
dataPointLabelComponent: () => customLabel(10),
|
2021-08-12 20:02:44 +05:30
|
|
|
},
|
2021-08-16 13:41:23 +05:30
|
|
|
{
|
|
|
|
value: 30,
|
|
|
|
label: 'Apr',
|
2021-12-04 00:01:42 +05:30
|
|
|
dataPointLabelComponent: () => customLabel(30),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 20,
|
|
|
|
label: 'May',
|
|
|
|
dataPointLabelComponent: () => customLabel(20),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 40,
|
|
|
|
label: 'Jun',
|
|
|
|
focusedDataPointLabelComponent: () => customLabel(40),
|
2021-08-16 13:41:23 +05:30
|
|
|
},
|
|
|
|
{value: 48, label: 'Jul'},
|
|
|
|
{value: 30, label: 'Aug'},
|
|
|
|
{value: 20, label: 'Sep'},
|
|
|
|
{value: 40, label: 'Oct'},
|
|
|
|
{
|
|
|
|
value: 48,
|
|
|
|
label: 'Nov',
|
|
|
|
onPress: () => Alert.alert('Sales in Nov skyrocketed to $48 M'),
|
|
|
|
},
|
|
|
|
{value: 30, label: 'Dec'},
|
2021-12-02 17:21:19 +05:30
|
|
|
]);
|
2021-08-02 16:41:56 +05:30
|
|
|
|
2022-01-28 04:17:45 +05:30
|
|
|
const renderLegend = (text, color) => {
|
|
|
|
return (
|
|
|
|
<View style={{flexDirection: 'row', marginBottom: 12}}>
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
height: 18,
|
|
|
|
width: 18,
|
|
|
|
marginRight: 10,
|
|
|
|
borderRadius: 4,
|
|
|
|
backgroundColor: color || 'white',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<Text style={{color: 'white', fontSize: 16}}>{text || ''}</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
const barData = [
|
|
|
|
{
|
|
|
|
value: 15,
|
|
|
|
label: 'Mon',
|
|
|
|
},
|
|
|
|
{value: 30, label: 'Tue'},
|
|
|
|
{value: 26, label: 'Wed'},
|
2022-02-08 16:30:02 +05:30
|
|
|
{value: 40, label: 'Thu'},
|
2022-01-28 04:17:45 +05:30
|
|
|
{value: 16, label: 'Wed'},
|
|
|
|
{value: 40, label: 'Thu'},
|
|
|
|
];
|
|
|
|
|
2022-02-24 05:18:04 +05:30
|
|
|
const styleObject = {
|
|
|
|
marginLeft: -95,
|
|
|
|
paddingLeft: 120,
|
|
|
|
transform: [{rotate: '90deg'}],
|
|
|
|
};
|
|
|
|
const ddtt = [
|
|
|
|
{
|
|
|
|
value: 10,
|
|
|
|
label: 'January month',
|
|
|
|
labelTextStyle: styleObject,
|
|
|
|
labelWidth: 130,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 20,
|
|
|
|
label: 'February month',
|
|
|
|
labelTextStyle: styleObject,
|
|
|
|
labelWidth: 130,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 30,
|
|
|
|
label: 'March month',
|
|
|
|
labelTextStyle: styleObject,
|
|
|
|
labelWidth: 130,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: 20,
|
|
|
|
label: 'April month',
|
|
|
|
labelTextStyle: styleObject,
|
|
|
|
labelWidth: 130,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const [dtt,setDtt] = useState([
|
|
|
|
{value: 110},
|
|
|
|
{value: 130},
|
|
|
|
{value: 120},
|
|
|
|
{value: 160},
|
|
|
|
{value: 190},
|
|
|
|
]);
|
|
|
|
|
2021-07-30 18:38:12 +05:30
|
|
|
return (
|
2022-01-28 04:17:45 +05:30
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
marginVertical: 100,
|
2022-02-08 16:30:02 +05:30
|
|
|
// marginLeft: 46,
|
2022-02-24 05:18:04 +05:30
|
|
|
marginLeft: 20,
|
2022-01-28 04:17:45 +05:30
|
|
|
}}>
|
|
|
|
{/* <BarChart backgroundColor={'green'} data={barData} /> */}
|
2022-02-08 16:30:02 +05:30
|
|
|
<BarChart
|
2022-02-24 05:18:04 +05:30
|
|
|
// isAnimated={true}
|
|
|
|
isThreeD={true}
|
|
|
|
data={dtt}
|
|
|
|
labelsExtraHeight={60}
|
|
|
|
// maxValue={100}
|
|
|
|
// yAxisLabelTexts={['100','110','120','130','140','150','160','170','180','190','200']}
|
2022-02-08 16:30:02 +05:30
|
|
|
// backgroundColor={'red'}
|
2022-02-24 05:18:04 +05:30
|
|
|
// initialSpacing={10}
|
|
|
|
// yAxisSide='right'
|
|
|
|
// maxValue={40}
|
|
|
|
// data={barData}
|
|
|
|
// width={240}
|
|
|
|
// radius={170}
|
|
|
|
// donut={true}
|
|
|
|
// showText={true}
|
|
|
|
// showValuesAsLabels={true}
|
|
|
|
// semiCircle={true}
|
|
|
|
// isThreeD={true}
|
|
|
|
// rulesType='solid'
|
|
|
|
// // shiftInnerCenterY={100}
|
|
|
|
// shadow={true}
|
|
|
|
// strokeWidth={5}
|
|
|
|
// noOfSections={4}
|
|
|
|
// innerCircleBorderColor={'gray'}
|
2022-01-28 04:17:45 +05:30
|
|
|
// showTextBackground={true}
|
|
|
|
/>
|
2022-02-24 05:18:04 +05:30
|
|
|
<TouchableOpacity
|
|
|
|
onPress={()=>{dtt[1].value+=20;setDtt([...dtt])}}>
|
|
|
|
<Text>Press me</Text>
|
|
|
|
</TouchableOpacity>
|
2022-01-28 04:17:45 +05:30
|
|
|
{/* <View
|
2022-01-12 16:52:27 +05:30
|
|
|
style={{
|
|
|
|
marginVertical: 100,
|
2022-01-28 04:17:45 +05:30
|
|
|
marginHorizontal: 30,
|
|
|
|
borderRadius: 10,
|
2022-01-12 16:52:27 +05:30
|
|
|
paddingVertical: 50,
|
2022-01-28 04:17:45 +05:30
|
|
|
backgroundColor: '#414141',
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignItems: 'center',
|
2022-01-12 16:52:27 +05:30
|
|
|
}}>
|
2022-01-28 04:17:45 +05:30
|
|
|
<Text
|
|
|
|
style={{
|
|
|
|
color: 'white',
|
|
|
|
fontSize: 32,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
marginBottom: 12,
|
|
|
|
}}>
|
|
|
|
Quarterly Sales
|
|
|
|
</Text>
|
|
|
|
<PieChart
|
|
|
|
strokeColor="white"
|
|
|
|
strokeWidth={4}
|
|
|
|
donut
|
|
|
|
data={[
|
|
|
|
{value: 30, color: 'rgb(84,219,234)'},
|
|
|
|
{value: 40, color: 'lightgreen'},
|
|
|
|
{value: 20, color: 'orange'},
|
|
|
|
]}
|
|
|
|
innerCircleColor="#414141"
|
|
|
|
innerCircleBorderWidth={4}
|
|
|
|
innerCircleBorderColor={'white'}
|
|
|
|
showValuesAsLabels={true}
|
|
|
|
showText
|
|
|
|
textSize={18}
|
|
|
|
showTextBackground={true}
|
|
|
|
centerLabelComponent={() => {
|
|
|
|
return (
|
|
|
|
<View>
|
|
|
|
<Text style={{color: 'white', fontSize: 36}}>90</Text>
|
|
|
|
<Text style={{color: 'white', fontSize: 18}}>Total</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
width: '100%',
|
|
|
|
flexDirection: 'row',
|
|
|
|
justifyContent: 'space-evenly',
|
|
|
|
marginTop: 20,
|
|
|
|
}}>
|
|
|
|
{renderLegend('Jan', 'rgb(84,219,234)')}
|
|
|
|
{renderLegend('Feb', 'lightgreen')}
|
|
|
|
{renderLegend('Mar', 'orange')}
|
|
|
|
</View>
|
|
|
|
</View> */}
|
2022-01-12 16:52:27 +05:30
|
|
|
|
|
|
|
{/* <TouchableOpacity
|
|
|
|
onPress={() => setCurrentData(latestData)}
|
|
|
|
style={{padding: 12, backgroundColor: 'lightgreen', marginBottom: 15}}>
|
|
|
|
<Text>Smooth</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => setCurrentData(latestData2)}
|
|
|
|
style={{padding: 12, backgroundColor: 'lightgreen', marginBottom: 15}}>
|
|
|
|
<Text>Smooth Low</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => setCurrentData(latestData3)}
|
|
|
|
style={{padding: 12, backgroundColor: 'lightgreen', marginBottom: 15}}>
|
|
|
|
<Text>Edged</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => setCurrentData(latestData4)}
|
|
|
|
style={{padding: 12, backgroundColor: 'lightgreen', marginBottom: 15}}>
|
|
|
|
<Text>Edged Low</Text>
|
|
|
|
</TouchableOpacity>
|
|
|
|
<TouchableOpacity
|
|
|
|
onPress={() => setCurrentData(latestData5)}
|
|
|
|
style={{padding: 12, backgroundColor: 'lightgreen'}}>
|
|
|
|
<Text>Straight</Text>
|
|
|
|
</TouchableOpacity> */}
|
2021-12-04 00:01:42 +05:30
|
|
|
|
2022-01-28 04:17:45 +05:30
|
|
|
{/* {true ? (
|
|
|
|
<LineChart
|
2021-11-26 23:34:22 +05:30
|
|
|
isThreeD
|
|
|
|
key={'xyz'}
|
2022-01-28 04:17:45 +05:30
|
|
|
height={320}
|
2021-11-26 23:34:22 +05:30
|
|
|
maxValue={360}
|
|
|
|
showLine
|
2022-01-28 04:17:45 +05:30
|
|
|
hideOrigin
|
|
|
|
// animationDuration={000}
|
2021-12-02 18:55:03 +05:30
|
|
|
initialSpacing={30}
|
2021-11-26 23:34:22 +05:30
|
|
|
// showVerticalLines
|
|
|
|
lineConfig={{
|
|
|
|
// isAnimated: true,
|
|
|
|
delay: 800,
|
|
|
|
color: 'green',
|
|
|
|
// hideDataPoints: true,
|
|
|
|
// showDataPoint: false,
|
|
|
|
// dataPointsRadius: 5,
|
|
|
|
dataPointsColor: 'purple',
|
|
|
|
dataPointsRadius: 4,
|
|
|
|
thickness: 2,
|
|
|
|
shiftY: 25,
|
|
|
|
curved: true,
|
|
|
|
}}
|
2022-01-28 04:17:45 +05:30
|
|
|
yAxisLabelPrefix={'$'}
|
|
|
|
yAxisLabelSuffix={'.0'}
|
2021-11-26 23:34:22 +05:30
|
|
|
barWidth={32}
|
2021-11-23 21:17:50 +05:30
|
|
|
// width={190}
|
2021-11-26 23:34:22 +05:30
|
|
|
data={[
|
|
|
|
{
|
2022-01-28 04:17:45 +05:30
|
|
|
value: 70,
|
2021-11-26 23:34:22 +05:30
|
|
|
label: 'Jan',
|
2022-01-28 04:17:45 +05:30
|
|
|
topLabelComponent: () => {
|
|
|
|
return <Text>30</Text>;
|
|
|
|
},
|
2021-11-26 23:34:22 +05:30
|
|
|
},
|
|
|
|
{value: 250, label: 'Feb'},
|
|
|
|
{value: 200, label: 'Mar'},
|
|
|
|
{
|
|
|
|
value: 150,
|
|
|
|
label: 'Apr',
|
|
|
|
showVerticalLine: true,
|
|
|
|
verticalLineColor: 'black',
|
|
|
|
},
|
|
|
|
{value: 200, label: 'May'},
|
|
|
|
{value: 250, label: 'Jun'},
|
|
|
|
{value: 270, label: 'Jul'},
|
|
|
|
]}
|
2021-08-16 13:41:23 +05:30
|
|
|
// horizontal
|
2021-11-26 23:34:22 +05:30
|
|
|
// showReferenceLine1
|
|
|
|
// referenceLine1Position={120}
|
|
|
|
// referenceLine1Config={{
|
|
|
|
// type: 'solid',
|
|
|
|
// color: 'rgba(200,0,0,0.6)',
|
|
|
|
// thickness: 1,
|
|
|
|
// }}
|
|
|
|
// showReferenceLine2
|
|
|
|
// referenceLine2Position={240}
|
|
|
|
// referenceLine2Config={{
|
|
|
|
// type: 'solid',
|
|
|
|
// color: 'rgba(0,0,0,0.6)',
|
|
|
|
// thickness: 1,
|
|
|
|
// }}
|
|
|
|
// showReferenceLine3
|
|
|
|
// referenceLine3Position={330}
|
|
|
|
// referenceLine3Config={{
|
|
|
|
// type: 'solid',
|
|
|
|
// color: 'rgba(0,0,200,0.6)',
|
|
|
|
// thickness: 1,
|
|
|
|
// }}
|
2021-11-23 21:17:50 +05:30
|
|
|
// showYAxisIndices
|
2021-08-16 13:41:23 +05:30
|
|
|
isAnimated
|
|
|
|
showGradient
|
2021-11-26 23:34:22 +05:30
|
|
|
// cappedBars
|
2021-08-16 13:41:23 +05:30
|
|
|
yAxisColor={'rgb(78, 0, 142)'}
|
|
|
|
xAxisColor={'rgb(78, 0, 142)'}
|
|
|
|
xAxisThickness={3}
|
|
|
|
yAxisThickness={3}
|
|
|
|
yAxisTextStyle={{color: 'rgb(78, 0, 142)'}}
|
|
|
|
capColor={'rgb(78, 0, 142)'}
|
|
|
|
capThickness={4}
|
2021-11-26 23:34:22 +05:30
|
|
|
// barWidth={35}
|
2022-01-28 04:17:45 +05:30
|
|
|
gradientColor={'rgba(200, 100, 244,0.2)'}
|
|
|
|
frontColor={'rgba(78, 0, 142,1)'}
|
2021-11-26 23:34:22 +05:30
|
|
|
// rulesType="dashed"
|
|
|
|
// rulesColor={'rgba(0,200,0,0.5)'}
|
|
|
|
// rulesThickness={1}
|
|
|
|
// dashWidth={12}
|
|
|
|
// dashGap={2}
|
2021-08-16 13:41:23 +05:30
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<LineChart
|
2021-11-23 21:17:50 +05:30
|
|
|
// width={150}
|
2021-12-02 17:21:19 +05:30
|
|
|
// hideDataPoints1
|
|
|
|
// spacing={30}
|
2021-08-16 13:41:23 +05:30
|
|
|
data={data}
|
2021-12-04 00:01:42 +05:30
|
|
|
dataPointLabelWidth={30}
|
|
|
|
dataPointLabelShiftY={-30}
|
2021-12-02 17:21:19 +05:30
|
|
|
// data2={lineData1}
|
|
|
|
areaChart
|
2021-12-02 18:55:03 +05:30
|
|
|
initialSpacing={20}
|
2021-12-04 00:01:42 +05:30
|
|
|
customDataPoint={() => {
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
height: 10,
|
|
|
|
width: 10,
|
|
|
|
backgroundColor: 'red',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderColor: 'blue',
|
|
|
|
borderRadius: 5,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}}
|
2021-12-02 19:26:44 +05:30
|
|
|
// focusedCustomDataPoint={() => {
|
|
|
|
// return (
|
|
|
|
// <View
|
|
|
|
// style={{
|
|
|
|
// height: 14,
|
|
|
|
// width: 14,
|
|
|
|
// backgroundColor: 'green',
|
|
|
|
// borderWidth: 2,
|
|
|
|
// borderColor: 'yellow',
|
|
|
|
// borderRadius: 7,
|
|
|
|
// }}
|
|
|
|
// />
|
|
|
|
// );
|
|
|
|
// }}
|
|
|
|
// onPress={(item, index) => {
|
|
|
|
// console.log('index-->', index);
|
|
|
|
// setData(data => {
|
|
|
|
// item.focusedCustomDataPoint = () => {
|
|
|
|
// return (
|
|
|
|
// <View
|
|
|
|
// style={{
|
|
|
|
// height: 14,
|
|
|
|
// width: 14,
|
|
|
|
// backgroundColor: 'green',
|
|
|
|
// borderWidth: 2,
|
|
|
|
// borderColor: 'yellow',
|
|
|
|
// borderRadius: 7,
|
|
|
|
// }}
|
|
|
|
// />
|
|
|
|
// );
|
|
|
|
// };
|
|
|
|
// data[index] = item;
|
|
|
|
// console.log('data------.....', data);
|
|
|
|
// return data;
|
|
|
|
// });
|
|
|
|
// }}
|
2021-12-02 17:21:19 +05:30
|
|
|
// disableScroll
|
|
|
|
pressEnabled
|
|
|
|
// showDataPointOnPress
|
|
|
|
showStripOnPress
|
2021-12-04 00:01:42 +05:30
|
|
|
// showTextOnPress
|
|
|
|
// textShiftY={-10}
|
|
|
|
// textShiftX={-5}
|
|
|
|
// textFontSize={18}
|
|
|
|
// textColor={'green'}
|
|
|
|
// stripWidth={1}
|
2021-12-02 17:21:19 +05:30
|
|
|
// stripHeight={200}
|
2021-12-02 18:55:03 +05:30
|
|
|
// stripHeight={200}
|
2021-12-04 00:01:42 +05:30
|
|
|
// stripOpacity={1}
|
|
|
|
// curved
|
|
|
|
// isAnimated
|
|
|
|
// animationDuration={2000}
|
2021-12-02 17:21:19 +05:30
|
|
|
// animationDuration={2000}
|
|
|
|
// dataPointsShape="rectangular"
|
|
|
|
// showGradient
|
2021-08-16 13:41:23 +05:30
|
|
|
color={'rgb(78, 0, 142)'}
|
|
|
|
yAxisColor={'rgb(78, 0, 142)'}
|
|
|
|
xAxisColor={'rgb(78, 0, 142)'}
|
2021-12-02 18:55:03 +05:30
|
|
|
// dataPointsColor={'yellow'}
|
2021-12-04 00:01:42 +05:30
|
|
|
dataPointsWidth={20}
|
|
|
|
dataPointsHeight={20}
|
2021-08-16 13:41:23 +05:30
|
|
|
xAxisThickness={3}
|
|
|
|
yAxisThickness={3}
|
2021-12-04 00:01:42 +05:30
|
|
|
// dataPointsRadius={4}
|
|
|
|
// focusedDataPointRadius={10}
|
2021-08-16 13:41:23 +05:30
|
|
|
yAxisTextStyle={{color: 'rgb(78, 0, 142)'}}
|
|
|
|
startFillColor={'rgb(200, 100, 244)'}
|
|
|
|
startOpacity={0.9}
|
|
|
|
endFillColor={'rgb(255, 255, 255)'}
|
|
|
|
endOpacity={0.2}
|
|
|
|
/>
|
2021-12-04 00:01:42 +05:30
|
|
|
)} */}
|
2021-08-16 13:41:23 +05:30
|
|
|
|
2021-12-04 00:01:42 +05:30
|
|
|
{/* <TouchableOpacity
|
2021-08-16 13:41:23 +05:30
|
|
|
onPress={() => setToggle(!toggle)}
|
|
|
|
style={{marginTop: 100, alignSelf: 'center'}}>
|
|
|
|
<Text>Line Chart</Text>
|
2021-12-04 00:01:42 +05:30
|
|
|
</TouchableOpacity> */}
|
2021-07-30 18:38:12 +05:30
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|