ymax Line chart displacement bug

Share RGraph:   Share or Like RGraph on Facebook!

« 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 Kacper on 28th December 2013
Setting ymax value on line graph displaces plot position or its scale is incorrect:

Without setting 'ymax': i.imgur.com/TsHoi9B.png
With 'ymax' value set : i.imgur.com/UNRuS7S.png

Please note misplaced integer values on second screenshot.

Repro:

<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="scripts/RGraph.common.core.js" ></script>
<script type="text/javascript" src="scripts/RGraph.line.js" ></script>
</head>
<body onload="init()">
<center>
<canvas id="cvs" width="600" height="400">[No canvas support]</canvas>
</center>
<script>
  window.onload = function ()
  {
   var line = new RGraph.Line('cvs', [0,2,1,5,2]);
   line.Set('ymax', 6)
   line.Draw();
  }
</script>
</body></html>
Posted by RGraph support on 28th December 2013
Hi there,

It looks like it's due to rounding - try setting scale.decimals to 1 or 2.




Richard
Posted by Kacper on 29th December 2013
Ok, thats it, but how to acheive proper integer scale? I want my grid lines without decimal places. I want to plot a curve with some additional space from the top, so it won't be drawn on the plot border. To do this I set ymax to max curve value + 1. Is there a different proper way to do it?
Posted by Kacper on 29th December 2013
Ok, I've done it with
line.Set('numyticks', 5)
.Set('background.grid.autofit.numhlines',5).Set('ymax', 15)
.Set('chart.ylabels.specific', [15,12,9,6,3,0]);

but I think proper grid lines and labels should be automatically set by default

Kacper
Posted by RGraph support on 29th December 2013
Hi there,

There's no vertical margin - it would affect the scale adversely. There's only the hmargin property for a horizontal margin.



Richard

Add a reply




« Back to message list