Chartjs-Y axis labels are getting cut off on horizontal bar chart in Mobile view + ChartJS v4

0👍

You can set the labels as an array of string or string[].

See doc: https://www.chartjs.org/docs/latest/axes/cartesian/category.html#category-axis-specific-options

In your case:

const data = {
  labels: ["Label 1", ["Very very very", "very long name", "that is cut off"]],
  datasets: [
    {
      axis: "y",
      label: "Count",
      backgroundColor: "#000",
      data: [10, 24],
    },
  ],
};

Leave a comment