0

Anyone know why subtitles will not render in react-chartjs-2?

Everything else seems to work fine. The title renders and I can get data to display on the chart. But adding a subtitle does nothing.

Here is my chart options object:

const chartOptions = {
  plugins: {
    legend: {
      display: false,
    },
    title: {
      display: true,
      text: 'Sample Title',
    },
    subtitle: {
      display: true,
      text: 'Sample Subtitle'
    }
  }
}

I am using the following versions: react-chartjs-2 version 4.0.0 and chart.js version 3.7.0

I am wondering if this a version issue between chart.js and react-chartjs-2? I know there used to be version issues in the past. However, I've looked at the docs and it says react-chartjs-2 should work with chart.js version 3. So I am wondering if there could still be a version issue with certain features?

I am totally stumped on this problem. Looked all over google and cannot find any solution. Thanks in advance for any help/suggestions.

Wikkyd
  • 51
  • 2
  • This works fine with `react-chartjs-2` version 3.3.0. Therefore it could be a bug that was introduced with version 4.0.0. – uminder Jan 06 '22 at 04:13
  • Thanks for the reply I will try that. Also which version of chart.js are you using? – Wikkyd Jan 06 '22 at 04:58
  • Yep that fixed it. Downgraded react-chartjs-2 to version 3.3.0 and it work. Thanks so much uminder! – Wikkyd Jan 06 '22 at 05:07

0 Answers0