0

My data format is this for bar graph: [img1][1]

The graph I'm getting is this: [img2][2]

I want separate blocks for separate dates. What am I doing wrong here?

Implemented using <Bar data={data} options={options} />

where data is what is shown in picture 1 and options is:

      scales: {
        yAxes: [{
          display: true,
          ticks: {
            beginAtZero: true
          }
        }],
        xAxes: [{
          display: true,
          ticks: {
            beginAtZero: true
          }
        }]
      },
      legend: {
        display: false
      }
   }; ```

  [1]: https://i.stack.imgur.com/vqggX.png
  [2]: https://i.stack.imgur.com/E6HUZ.png

1 Answers1

0

This is because your labels array is a nested array so chart.js sees it as a multi line array. If you change it to a single flat array it will work just fine

LeeLenalee
  • 27,463
  • 6
  • 45
  • 69