Error in Y axis values, entire values are not shown

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« 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 Peter on 17th December 2012
In my example code the Y-axis values are not shown completely

I get no negative Y values. As you can see I have tried several different settings without any luck.

What am I doing wrong?

Thanks

Example:

<html>
<head>
<title>RGraph test</title>
<body>

<script src="./libraries/RGraph.common.core.js"></script>
<script src="./libraries/RGraph.scatter.js"></script>
<script>
window.onload = function(){
     var canvas = document.getElementById("canvas");
var dataxyR = [[760987, -254],
[770987, -244],
[780987, -247],
[790987, -252],
[800987, -251],
[810987, -252],
[820987, -251],
[830987, -248],
[840987, -247],
[850987, -246],
[860987, -245],
[870987, -244],
[880987, -242],
[1180987, -218],
[1190987, -217],
[1200987, -219],
[1210987, -220],
[1220987, -225],
[1230987, -225],
[1240987, -227],
[1250987, -227],
[1260987, -228],
[1270987, -230],
[1280987, -234],
[1290987, -231],
[1300987, -230],
[1310987, -229],
[1320987, -228],
[1330987, -225],
[1340987, -225],
[1580987, -186],
[1590987, -186],
[1600987, -185],
[1610987, -184],
[1620987, -185],
[1630987, -186],
[1920987, -196],
[1930987, -194],
[1940987, -195],
[1950987, -196],
[1960987, -189],
[1970987, -192],
[1980987, -189],
[1990987, -186],
[2000987, -191],
[2010987, -187],
[2020987, -181],
[2250987, -221],
[2260987, -215],
[2270987, -223],
[2280987, -221],
[2290987, -214],
[2300987, -222],
[2310987, -221],
[2320987, -212],
[2330987, -215],
[2520987, -197],
[2530987, -191],
[2640987, -225],
[2650987, -222],
[2660987, -229],
[2670987, -238],
[2680987, -232],
[2690987, -235],
[2700987, -245],
[2710987, -237],
[2720987, -244
]];
var dataxyL = [[214530, -242],
[224530, -240],
[234530, -241],
[244530, -242],
[254530, -246],
[834530, -258],
[844530, -256],
[854530, -254],
[864530, -253],
[874530, -251],
[884530, -250],
[894530, -247],
[904530, -245],
[914530, -245],
[924530, -245],
[934530, -243],
[944530, -241],
[954530, -238],
[964530, -235],
[974530, -234],
[984530, -234],
[994530, -231],
[1004530, -225],
[1014530, -225],
[1024530, -223],
[1034530, -224],
[1484530, -209],
[1494530, -205],
[1504530, -202],
[1514530, -200],
[1524530, -200],
[1534530, -199],
[1544530, -197],
[1554530, -193],
[1564530, -192],
[1574530, -191],
[1584530, -192],
[1594530, -191],
[1604530, -192],
[1614530, -191],
[1624530, -189],
[1634530, -192],
[2084530, -190],
[2094530, -201],
[2104530, -190],
[2114530, -190],
[2124530, -205],
[2134530, -198],
[2144530, -200],
[2154530, -214],
[2164530, -200],
[2174530, -215
]];
var dataxy = [dataxyR, dataxyL];
var datax = [];
     var datay = [];
     for (var j = 0; j < dataxy.length; j++) {
         for (var i = 0; i < dataxy[j].length; i++) {
      datax.push(dataxy[j][i][0]);
       datay.push(dataxy[j][i][1]);
         }
     }
     var dataMaxX = Math.max.apply(Math, datax);
     var dataMinX = Math.min.apply(Math, datax);
     var dataMaxY = Math.max.apply(Math, datay);
     var dataMinY = Math.min.apply(Math, datay);
var scatter = new RGraph.Scatter('canvas', dataxy);
            //scatter.Set('chart.labels', datay);
            scatter.Set('chart.xscale', true);
            scatter.Set('chart.xscale.units.post', 'um');
            //scatter.Set('chart.units.post', 'um');
            //scatter.Set('chart.noaxes', true);
            scatter.Set('chart.title.yaxis', 'afds');
            scatter.Set('chart.title.yaxis.pos', -150);
            //scatter.Set('chart.yaxispos', 'left');
            scatter.Set('chart.xscale.numlabels', 5);
            scatter.Set('chart.xmax', dataMaxX);
            scatter.Set('chart.xmin', dataMinX);
            scatter.Set('chart.ymax', dataMaxY);
            scatter.Set('chart.ymin', dataMinY);
            scatter.Set('chart.line', true);
            scatter.Set('chart.tickmarks', null);
            scatter.Draw();
};
</script>
<canvas id="canvas" width="800" height="500"></canvas>

</body></html>
Posted by Peter on 18th December 2012
If I shift the Y-axis to the Left side the entire value is not shown either.

scatter.Set('chart.yaxispos', 'right');
Posted by Peter on 18th December 2012
I found a solution...

scatter.Set('chart.gutter.left', 100);

Add a reply




« Back to message list