Question

I've got these weird marks on my RGraph x-axis. Any idea what's causing it?

Here is a screenshot (I marked the unwanted marks with red arrows)

screenshot

Here is my JavaScript code that prints the line.

function PrintLine(labels, tooltips, data, color, legend) {
  var line = new RGraph.Line(CANVAS_ID, data);

  line.Set('chart.labels', labels);
  line.Set('chart.background.grid.hlines', false);
  line.Set('chart.background.grid.autofit.numvlines', labels.length-1);
  if(legend[0].length > 0) {
    line.Set('chart.colors', legend[0]);
    line.Set('chart.key', legend[1]);
    line.Set('chart.key.position', 'gutter');
    line.Set('chart.key.position.gutter.boxed', false);
    line.Set('chart.key.position.x', 400);
  }

  line.Set('chart.tooltips', tooltips);
  line.Set('chart.shadow', true);
  line.Set('chart.ylabels', false);
  line.Draw();
}
Was it helpful?

Solution

It looks as though you may have a previous chart staying around - which you can get rid of by clearing the ObjectRegistry:

RGraph.ObjectRegistry.Clear();

OTHER TIPS

Adjust the line settings chart.numxticks to the number of X tickmarks you want .set('chart.numxticks',n)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top