[Chartjs]-How to change chartjs ticks orientation to 'slope right'?

0👍

NOTE: The following code applies to only.


Instead of minRotationmaxRotation, by using "rotation", you could rotate the labels of the x-axis – horizontal labels of the chart.

xAxis: {
    categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
    labels: {
      // Set rotation of thex-axis labels to 45°: 
      rotation: 45
    }
  },

This JS fiddlewhich is based on this chart found in the documentation – contains the modification using rotation property.

I’m not sure why in your sample code I couldn’t rotate the labels with rotation property, but, you can modify the code provided here for your purposes.

Leave a comment