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

View File

@ -1,6 +1,6 @@
{ {
"name": "react-native-gifted-charts", "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.", "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", "main": "src/index.tsx",
"files": [ "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
? sectionItems.value ? sectionItems.value
: hideOrigin
? ''
: '0' : '0'
: sectionItems.value : sectionItems.value
? sectionItems.value.toString().split('.')[0] ? sectionItems.value.toString().split('.')[0]
: hideOrigin
? ''
: '0'} : '0'}
</Text> </Text>
) : null} ) : null}