Chartjs-Vue2 trying to set chart title

0👍

You are using v2 syntax in v3, the internal plugins like the tooltip, title, legend and decimation have been moved from the options namespace to the options.plugins namespace.

So you need to nest the title options in a plugins object within the options object. Then it will work

0👍

For those like me, who are looking for a solution using vue-chartjs V4.
To show the Title you need to pass the plugin object, for example:

plugins: {
  type: Array,
  default: () => [Title]
}

and then pass into the chartOptions props the title configuration, for example:

chartOptions: {
  responsive: true,
  maintainAspectRatio: false,
  plugins: {
    title: {
      display: true,
      text: "Chart Title",
    },
  },
}

sandBox full example:

Leave a comment