Repository navigation
Feature request: Add annotation(s) into the legend #418
Replies: 3 comments
|
@HuongSakada my personal opinion, that's not possible because legend items are representing a dataset or data of dataset. In this case you would like to have a legend item to a chart element. I guess (but correct me if I'm wrong), you want to have the possibility to show and hide the annotation on demand. |
|
Yes, you are right. If we want to show the legend it must be added in datasets. {
type: 'line',
label: 'The legend label',
backgroundColor: 'red',
data: []
} |
|
If you really want a label in your legend without adding an extra dataset as posted as a solution you can also define your own generateLabels function that returns the label items for all datasets and one extra for your custom informative label |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
For Chartjs, we can create the chart with the legend and can show or hide it by selecting the legend.

Do we have any ways to add the annotation into the legend?
All reactions