Chartjs-Chartjs scales.xAxis: Property 'title' does not exist on type '_DeepPartialObject

0👍

I found I could do what I was after by now adding a chart title.

First I add title to the register..

Chart.register(LineController, PointElement, Tooltip, Legend, Title /* <-- add this **/, TimeScale, LinearScale, CategoryScale, LinearScale, LineElement);

Next I add the title to the plugings…

const options: ChartOptions = {
  plugins: {
    legend: {
      display: false,  <---- HIDE THIS
      position: 'bottom',
      labels: {
        padding: 10,            
      }
    },
    title: {
      display: true,     <---- SHOW THIS
      position: 'bottom',
      text: ''
    },        
},

And now I can set the title at runtime…

this.chart.config.options.plugins.title.text = 'hello';

In my case, this is all I am after…

enter image description here

Leave a comment