I have a problem scaling the Line chart values

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by SidekickJohn on 25th January 2013
Hi there,

I want to put some values into a line-diagram. The problem I got is that the average values are around 0-15 or something but there can be exceptions and then the values go up to 540 or so. I have no problem getting these values into the diagram. But once there is one of those high values, the scala of the diagram becomes either to big or, when I limit it to a certain value doesn't show those high values. Right now I 'show' the values that are over the limit just as an info in the tickmarks. (hardcoded only on first few values)

Here is my example code, what would you recommend me to do so that the diagram makes all the values visible (somehow) but is still significant towards the average values?!

<script type="text/javascript">
     //hardcoded Arrays
     var testarr1 = [7,4,527,9,0,0,0,1,5,4,3,1,2,0,2,49,4,3,3,5,6,7,3,0,2,12,6,7,11,2,4,10,1,1,2,8,0,6,2,0,88,0];
     var testarr2 = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,10,0,0,0,0,0,6,0,0,88,0];
     var testarr3 = [63,79,809,133,0,10,1,47,171,125,15,21,15,3,12,676,22,31,32,31,47,33,32,0,32,78,18,31,31,2,15,10,16,16,13,23,0,6,6,0,88,0];
     //Load function when DOM is ready
      function loaded(){
      // draw Graph
     function cf(arr1,arr2,arr3,scala)
         var dline = new RGraph.Line('cvs', arr1, arr2, arr3);
                dline.Set('chart.linewidth', 3);
                dline.Set('chart.hmargin', 10);
                dline.Set('chart.labels', ['2011-33','2011-34','2011-35','2011-36','2011-37','2011-38','2011-39','2011-40','2011-41','2011-42','2011-43','2011-50','2011-51','2012-02','2012-03','2012-04','2012-05','2012-06','2012-07','2012-08','2012-09','2012-10','2012-11','2012-12','2012-13','2012-14','2012-15','2012-16','2012-17','2012-24','2012-27','2012-29','2012-30','2012-31','2012-32','2012-34','2012-36','2012-37','2012-38','2012-41','2012-42','2012-46']);
                dline.Set('chart.tooltips', ['2011-33 <br> 7','2011-34 <br> 4','2011-35 <br> 527','2011-36','2011-37','2011-38','2011-39','2011-40','2011-41','2011-42','2011-43','2011-50','2011-51','2012-02','2012-03','2012-04','2012-05','2012-06','2012-07','2012-08','2012-09','2012-10','2012-11','2012-12','2012-13','2012-14','2012-15','2012-16','2012-17','2012-24','2012-27','2012-29','2012-30','2012-31','2012-32','2012-34','2012-36','2012-37','2012-38','2012-41','2012-42','2012-46']);
                dline.Set('chart.tickmarks', 'circle');
                dline.Set('chart.colors', ['#F3F781','#79B100','#FF4000']);
                dline.Set('chart.ylabels.count', 10);
                dline.Set('chart.gutter.left', 35);
                dline.Set('chart.key', ['Average','Call Min','Call Max']);
         //here is the limitation
         dline.Set('chart.ymax', scala);

If you have any recommendations or some help, I'd be very grateful.
Thanks so far.
Posted by RGraph support on 25th January 2013

You could set the ymax to 15 (for eample) and then set chart.outofbounds to true. Though this will simply show the higher value going off the chart. Another option would be to use a logarithmic scale. Here's some examples of logarithmic scales:


There's some documentation on log scales here:



Richard, RGraph Support
Posted by SidekickJohn on 27th January 2013
Thank you for your quick answer!
I thought of the log option right after I sent in my request. But still I'm experiencing some little issues convertig my data to fit in there.
The part with the out of bounds sounds interessting. I'll simply keep it up and try to figure out what suits me best ;-)

Thanks again!
Posted by SidekickJohn on 5th February 2013
Hello again...

I'm trying to get the log-scales working.
First of all i want to use the Graph.Log(testarr1, 10) function to convert my data into log 10 values. Then i want to put these values into my line diagram, of which I changed the ylabels to 1000, 100, 10.

When I debug this I'm getting the error:
TypeError: RGraph.log is not a function
arrL[i] = RGraph.log(testarr[i], 10);

What am I doing wrong? How do I have to use the .log function exactly?

greets, SidekickJohn
Posted by RGraph support on 5th February 2013

That's because the function is new and it's now even in the beta yet.

Richard, RGraph Support

Add a reply

« Back to message list