chartjs-plugin-datalabels icon indicating copy to clipboard operation
chartjs-plugin-datalabels copied to clipboard

Datalabels suffix with different styling

Open madsh93 opened this issue 1 year ago • 1 comments

Hi

I want to end up with a result like this: CleanShot 2022-08-23 at 09 08 15

Using:

anchor: 'end',
align: 'top'

And then to add the suffix I can use the formatter

formatter: (value, ctx) => {
  const label = ctx.chart.data.labels[ctx.dataIndex] + '  kr./år'
}

Great. So far so good. Here is where I run in to trouble. How do I style the suffix differently?

Creating multiple labels, makes styling possible, but it makes it difficult/impossible to center the label correctly.

Do you have any tips?

madsh93 avatar Aug 23 '22 07:08 madsh93

I have a similar usecase and haven't found a solution. Would love to have support for this.

johnzzon avatar Feb 21 '24 19:02 johnzzon