Changing the charts Y axis maximum and minimum values distorts the chart

« 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 wrox on 1st September 2015
Hey There,

In one of use case we want to change chart y-max and Y-min value. changing it display chart with wrong plotting.

For Example :
Case : Need to display data more clearly

Data : Want to plot [20.2345,20.5674,20.7892,20.2346]

so we change Y-Max = 21 and Y-Min = 19

but the values displayed being distorted. 20.2345 displayed on chart should be very near to Y-Axis 20 label line but it seems its more then it.

Gaurav Teli

Posted by Richard on 1st September 2015

How about this:

Posted by wrox on 4th September 2015
Hi Richard,

Is there some way to set yMax and yMin automatically according to data ?
Posted by Richard Heyes on 4th September 2015
Hi there,

Not rally. Though I suppose you could do this:

// Say your maximum value in your data is 9
var maximum = 9;
var scale = RGraph.getScale2(obj, {
     max: maximum
var maximum = scale.max;

Like this example:

Then set the ymax option to that value. For ymin you could round your numbers down I guess. Say you have 21.2:

1. Times it by ten - giving you 212
2. Round it to the nearest hundred (for example) giving you 200
3. Divide it by ten.
4. You end up with 20.

Something like that perhaps.


Add a reply

« Back to message list