简体   繁体   中英

RGraph: Weird marks on x-axis

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)

屏幕截图

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();
}

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();

将线设置chart.numxticks调整为所需的X刻度线的数量。set('chart.numxticks',n)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM