Adding multiple datalabels types on chart
See original GitHub issueHello ! I was wondering if it was possible to use different datalabels types on a graph. Here is what I currently have : I am adding the black datalabels with the plugin but didn’t find a way to display my blue datalabels by also using the plugin so I’m currently using onComplete from chart.js which is not optimal at all.
If a similar feature or workaround is not already available, it would be great to be able to do something like this :
datalabels: [{ // datalabelsType1 },{ // datalabelsType2 }]
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Multiple Labels - chartjs-plugin-datalabels
Use multiple labels configuration to display 3 labels per data, one for the index , one for the label and one for the...
Read more >How to Add Two Data Labels in Excel Chart (with Easy Steps)
In this article, you will find how to add two data labels in excel chart. There are 4 steps in total in this...
Read more >Add or remove data labels in a chart - Microsoft Support
Right-click the data series or data label to display more data for, and then click Format Data Labels. Click Label Options and under...
Read more >How to add data labels from different column in an Excel chart?
1. Right click the data series in the chart, and select Add Data Labels > Add Data Labels from the context menu to...
Read more >How to Add Data Labels within Bars and Total Sum On Top of ...
All the charts are always coded in the latest Chartjs version which is as of this recording Chart JS 3.7.1. What type of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Lenophie @Tajlang @mrVers @redoper1 @omarsedki multiple labels per data element is now implemented in e1347fc28fc8f8d890b33acb1e06011e7fdb54c9. I know it’s been a long time but can some of you test this feature before I release a new version?
chartjs-plugin-datalabels.min.js | documentation | sample
There is no built-in feature that enables multiple labels for a single value, though I agree that could be useful. However, I’m not fan of the
datalabels: []
array approach because it’s a pain to make it mergeable easily, for example if you define multiple labels at the plugin level and want to override options for a specific label at the dataset level:That’s a recurrent issue we have in Chart.js with scale options. Also, it doesn’t work well with default options since the array would override it. So ideally we should support a map of options instead of an array, but in this case, we have no way to differentiate an object of options (multiple labels) from the actual options object (single label), that we still need to support.
One solution could be to introduce a new option named
labels
:Thoughts?