Home Forums Chart Support Dynamic indexLabelOrientation Reply To: Dynamic indexLabelOrientation

#39483

Juan,

You can set indexLabelOrientation property to “vertical” or “horizontal” depending on the number of datapoints and update the chart options. Please find the code snippet below,

if(chart.options.data[0].dataPoints.length > 15)
    chart.options.data[0].indexLabelOrientation = "vertical";
  else
    chart.options.data[0].indexLabelOrientation = "horizontal";
  chart.render();

Please take a look at this JSFiddle for working example.

dynamically change index label orientation


Adithya Menon
Team CanvasJS