Chartjs-Remove spacing between bar in bar graph( react-chart-js)

0👍

I don’t know if this actually works out of the box. There is nothing in the documentation about this use case either.

You could do it with ghost values to extend the chart in general.
This is not really a solution, but it may be an option.

const labels = ["","","January", "February", "March","",""];

export const data = {
  labels,
  datasets: [
    {
      label: "Dataset 1",
      data: labels.map((elem, index) => {
          if (index > 1 && index < 5)
            return faker.datatype.number({ min: 0, max: 1000 })          
        }),
      backgroundColor: "rgba(255, 99, 132, 0.5)",
      barThickness: 50
    }
  ]
};

enter image description here

Leave a comment