React-chartjs-2: In Horizontal Bar Chart Example, Not All 7 Records Showing

Created on 28 Mar 2019  路  4Comments  路  Source: reactchartjs/react-chartjs-2

In your own example, the bottom bar is missing.

Scroll down inhttp://jerairrest.github.io/react-chartjs-2/ "Horizontal Bar Example" and notice that there is no bar for July. In my case, I had 10 bars and only the first 5 showed up.

bug

Most helpful comment

it needs to have beginAtZero set in the options, see https://www.chartjs.org/docs/latest/axes/cartesian/linear.html

All 4 comments

it needs to have beginAtZero set in the options, see https://www.chartjs.org/docs/latest/axes/cartesian/linear.html

@pkellner,
As @davie-robertson said, try adding the following option configL

options = {
  scales: {
    xAxes: [{
      beginAtZero: true,
    }]
  }
}

Should anyone else come across this, the above options config is incorrect. The correct options to use is:

{
  scales: {
    xAxes: [{
      ticks: { beginAtZero: true }
    }]
  }
}

The example code will in all likelihood be overhauled as part of the Chart.js 3 release.

Closing this issue for now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jbbae picture jbbae  路  5Comments

DavidSongzw picture DavidSongzw  路  5Comments

Pringels picture Pringels  路  4Comments

flyingpath picture flyingpath  路  5Comments

selimovicz picture selimovicz  路  6Comments