X axis customisation

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 Pravin on 18th March 2013
Hi,
On my Line chart, the x-axis has 288 points (one corrosponding to a 5 minute interval for 24 hours). Some of the corrosponding y-axis values could be null. How do I show horizontal grid lines corrosponding to each hour only? How to show the horizontal grid line only for 1st, 2nd, 3rd ... 23rd hour and still plot a line chart for the intermediate x-axis point?
Posted by RGraph support on 19th March 2013
Hi there,

You can control the density of the grid lines with chart.background.grid.autofi.numvlines and chart.background.grid.autofi.numhlines. There's no option to turn off specific lines though.



Richard, RGraph support
RGraph - HTML5 and Javascript charts
www.rgraph.net
Posted by Dan on 23rd March 2013
Perhaps you can use the mod (remainder) formula to grab only the 12th record for the X axis labels?

I used this formula for my csv rows to capture only the 20th record for my X axis labels. My csv files have hundreds of rows and I use one of the columns for my X axis labels. The rest of the columns are data points for my chart lines.

here is my formula for my graph which takes the time values from column 10.

   for (var i=1; i<(rows.length-1); ++i) {
    if (i % 20 == 1 ) {
     var cells_time = rows[i].split(/,/);
     timeline.push(cells_time[10]);
    }
   
   var cells = rows[i].split(/,/);
   
          data0.push(Number(cells[1]));
       data1.push(Number(cells[19]));
       data2.push(Number(cells[20]));
       data3.push(Number(cells[21]));
       data4.push(Number(cells[25]));
       data5.push(Number(cells[26]));
   }


I hope this helps. Cheers!
Posted by Dan on 23rd March 2013
You can also customize the vertical grid lines to match the labels by using the formula Richard provided above:

line1.Set('chart.background.grid.autofit.numvlines', (i/12)-1);



The total "i" count divided by your mod amount minus 1.

Add a reply




« Back to message list