Fixed issue with hiideOrigin

This commit is contained in:
Abhinandan Kushwaha 2022-01-12 19:09:17 +05:30
parent cf81422f9c
commit eacadd2643
3 changed files with 44 additions and 32 deletions

58
App.js
View File

@ -6,34 +6,34 @@ import {BarChart, LineChart} from './src';
const App = () => {
const [toggle, setToggle] = useState(true);
useEffect(() => {
setTimeout(() => {
setCurrentData(latestData5);
}, 1100 + 100 + 310);
setTimeout(() => {
setCurrentData(latestData2);
}, 1100 + 300 + 620);
// useEffect(() => {
// setTimeout(() => {
// setCurrentData(latestData5);
// }, 1100 + 100 + 310);
// setTimeout(() => {
// setCurrentData(latestData2);
// }, 1100 + 300 + 620);
setTimeout(() => {
setCurrentData(latestData5);
}, 1100 + 500 + 930);
// setTimeout(() => {
// setCurrentData(latestData5);
// }, 1100 + 500 + 930);
setTimeout(() => {
setCurrentData(latestData3);
}, 1100 + 1000 + 1240);
// setTimeout(() => {
// setCurrentData(latestData3);
// }, 1100 + 1000 + 1240);
setTimeout(() => {
setCurrentData(latestData4);
}, 1100 + 1500 + 1550);
// setTimeout(() => {
// setCurrentData(latestData4);
// }, 1100 + 1500 + 1550);
setTimeout(() => {
setCurrentData(latestData5);
}, 6000);
// setTimeout(() => {
// setCurrentData(latestData5);
// }, 6000);
setTimeout(() => {
setCurrentData(latestData);
}, 7000);
}, []);
// setTimeout(() => {
// setCurrentData(latestData);
// }, 7000);
// }, []);
const dPoint = () => {
return (
<View
@ -485,6 +485,11 @@ const App = () => {
</View>
);
};
const ndd = [
{label: 'Jan', value: 30},
{label: 'Feb', value: 10},
{label: 'Mar', value: 20},
];
const [data, setData] = useState([
{value: 15, label: 'Jan'},
{
@ -533,9 +538,10 @@ const App = () => {
style={{
marginVertical: 100,
paddingVertical: 50,
backgroundColor: '#414141',
// backgroundColor: '#414141',
}}>
<LineChart
<BarChart hideOrigin data={ndd} yAxisLabelTexts={['0', '£10', '£20']} />
{/* <LineChart
isAnimated
thickness={3}
color="#07BAD1"
@ -562,7 +568,7 @@ const App = () => {
xAxisColor="lightgray"
dataPointsHeight={20}
dataPointsWidth={20}
/>
/> */}
</View>
{/* <TouchableOpacity

View File

@ -1,6 +1,6 @@
{
"name": "react-native-gifted-charts",
"version": "0.2.5",
"version": "0.2.6",
"description": "The most complete library for Bar, Line, Area, Pie and Donut charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
"main": "src/index.tsx",
"files": [

View File

@ -561,16 +561,22 @@ export const BarChart = (props: PropTypes) => {
],
},
]}>
{showFractionalValues
{hideOrigin
? index === horizSections.length - 1
? ''
: showFractionalValues
? sectionItems.value
? sectionItems.value
: '0'
: sectionItems.value
? sectionItems.value.toString().split('.')[0]
: '0'
: showFractionalValues
? sectionItems.value
? sectionItems.value
: hideOrigin
? ''
: '0'
: sectionItems.value
? sectionItems.value.toString().split('.')[0]
: hideOrigin
? ''
: '0'}
</Text>
) : null}