Search code examples
apexcharts

Apexchart: how to rotate labels


I have the following code:

labels: [**<dates dynamically populated here>**],                       
markers: {
    size: 3
},

As I am running out of space, how do I rotate date labels at the bottom of the chart 45 or 90 degrees?

enter image description here


Solution

  • Labels should rotate by default when there is no space, but if you want to have them always rotated (rotateAlways option) or change value you can do it in xaxis https://apexcharts.com/docs/options/xaxis/#rotate

    xaxis: {
      labels: {
        rotate: -45
      }
    }