JesperLekland / react-native-svg-charts

📈 One library to rule all charts for React Native 📊
MIT License
2.35k stars 403 forks source link

AreaChart with equal values #231

Open akhiljain100 opened 5 years ago

akhiljain100 commented 5 years ago

What is the problem?

The chart doesnt show anything when I give the data as [10,10,10,10] I want it to start with 0 such that it show me a horizontal line at 10, but I get a horizontal line at 0

What platform?

React Native version: 0.55.4 React Native svg version: ^6.3.1

Code to reproduce


<YAxis
          data={ [10,10,10,10] }
          contentInset={ { top: 30, bottom: 3, left: -1, right: -1 }}
          svg={{
                fill: 'black',
                fontSize: 10,                                 
                }}
           min = {0}
           numberOfTicks={ 3 }
           formatLabel={ value =>{ if(value.toString().length == 1){return `  ${Math.round(value)}    `}
                                                                 else{return `  ${Math.round(value)}  `}    }}
/>                               
<AreaChart
           style={{ 
                flex: 1,                                      
                }}
           data={ [10,10,10,10] }
           contentInset={{ top: 30, bottom: -1, left: -1, right: -1 }}
           curve={ shape.curveBasis }
           svg={{ 
                fill: colors.graphFillColor, 
                stroke: colors.marginLightBlue 
                }}
            yMin={0}
            //animate={animateGraphDataChange}                                      
             //start={0} //The value of which the area should start (Tried it)
             >
             <Decorator/>
</AreaChart>
xjuni0r87 commented 5 years ago

hi @akhiljain100 did you find any solution? i've got the same problem

akhiljain100 commented 5 years ago

hi @akhiljain100 did you find any solution? i've got the same problem

Nope, not yet :(

invyctus92 commented 5 years ago

Hello, with props as: curve={shape.curveNatural} yMin={0} yMax={60} works