Zomato / DR-charts

Apache License 2.0
95 stars 36 forks source link

Negative value #12

Open oromis300 opened 7 years ago

oromis300 commented 7 years ago

Hi, first thanks for your work. I use a line graph and i can have negative value. On the first image you can see my graphe is good but the label on the left for negative value in not good. The lowest value is set on the 0 line. And i can't click on the negative point. screen shot 2016-11-18 at 16 29 27 I try to inverse the value to see what it's do and the graphe is totaly broken. So can we use negative value for Y position? And if yes how i do this? screen shot 2016-11-18 at 16 34 19

jon-mey commented 7 years ago

I had the same issue and fixed it by storing the smallest value (as variable negativeOffset) in the dataset as an offset if the value was < 0. I did the following changes in MultiLineGraphView.m:

In createYAxisLine (below calculation of minY): if (minY < 0) { negativeOffset = 0 - minY; }

And every line that had y = [[lineData.yAxisArray objectAtIndex:someIndex] floatValue] * stepY;

I replaced with y = ([[lineData.yAxisArray objectAtIndex:someIndex] floatValue] + negativeOffset) * stepY;

dhirenthirani commented 7 years ago

Hey guys, This issue will be fixed soon. Sorry for replying late. Thanks for the solution.