vijaybhaskar123 / ecgraph

Automatically exported from code.google.com/p/ecgraph
0 stars 0 forks source link

When using percent Y range on histogram is fixed to 100 #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use histogram
2. Set items as IsPercent
3. Range is fixed to 100

What is the expected output? 

It would be better if the range can be set externally or determined 
automatically using the max(yvalue)

What version of the product are you using? On what operating system?
iOS 5.1

Please provide any additional information below.

I changed ECGraph.m this way to make that happen, not sure it is the best, but 
it works better:

    ECGraphItem *item = [items objectAtIndex:0];
    if (item.isPercentage) {
-       int max = 100;
+        
+        int max = 0;
+        
+        for (int i = 0; i < [items count]; ++i) 
+        {
+            ECGraphItem *item = [items objectAtIndex:i];
+            max = item.yValue > max ? item.yValue : max;
+        }
+        
+        max += 10;
+        

Original issue reported on code.google.com by mdi...@gmail.com on 21 Apr 2012 at 5:04