react-native-pathjs-charts icon indicating copy to clipboard operation
react-native-pathjs-charts copied to clipboard

showing error when i give all values as 0

Open vmamatha opened this issue 7 years ago • 11 comments

This package is working well when atleast one positive value but when i pass all values as 0 then it showing below error. error

vmamatha avatar Aug 18 '17 06:08 vmamatha

Tried 0 values with Scatterplot, Smoothline, and Stockline and while they produce undesirable graphs (basically showing a small portion of x and y gridlines if you have that option enabled showing a tiny inverted t-like shape) they do not produce the same error as above. Radar is similar to Scatterplot/Smoothline/Stockline in not producing anything useful (but then I'm not sure it should produce something other than what it does). Pie produces a whole pie as expected. Bar produces just a label. Tree is not applicable as I'm not sure how one represents "all values as 0" since it expects strings. I've tried all of the chart types and couldn't produce an error. Do you have some example code/configuration that reproduces the behavior?

marzolfb avatar Sep 10 '17 05:09 marzolfb

hi @marzolfb, Thank you for the reply. Actually I am using Bar charts in that we are passing updated values from a API. For below data it is showing an error. data = [ [{ "v": 0, "name": "monday" }, { "v": 0, "name": "tuesday" }], [{ "v": 0, "name": "wednessday" }, { "v": 0, "name": "thursday" }], [{ "v": 0, "name": "friday" }, { "v": 0, "name": "saturday" }] ]

vmamatha avatar Sep 11 '17 05:09 vmamatha

0 value graph showing the same error for me as well. this is a base case isnt it?

jayesbe avatar Sep 11 '17 19:09 jayesbe

@marzolfb take the bar graph example here and replace all the values in the data array to 0.

jayesbe avatar Sep 11 '17 19:09 jayesbe

Looks like it might be the paths.js lib.

jayesbe avatar Sep 11 '17 19:09 jayesbe

I'm running into this issue too

JoeScho avatar Oct 23 '17 11:10 JoeScho

I resolved this by setting the graphOptions.axisY.max value, only issue is this won't work if you don't know what the maximum is..

JoeScho avatar Oct 23 '17 11:10 JoeScho

I'm running into this issue too

thiswhy avatar Oct 24 '17 07:10 thiswhy

Do you have any idea to reslove this problem?

thiswhy avatar Oct 24 '17 07:10 thiswhy

thanks @JoeScho ,for each all value first,if all value is zero ,then make max equles 1.else make max equles null.perfect!

thiswhy avatar Oct 24 '17 07:10 thiswhy

For some reason that still actually displayed a warning for me.. To resolve that I passed some demo data if there was nothing stored.

JoeScho avatar Oct 24 '17 11:10 JoeScho