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. |
Beta Was this translation helpful? Give feedback.
-
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: []
} |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
For Chartjs, we can create the chart with the legend and can show or hide it by selecting the legend.
![Screen Shot 2021-01-20 at 3 26 58 PM](https://user-images.githubusercontent.com/22464193/105148046-8011a880-5b34-11eb-8ea9-c14cce95cee1.png)
Do we have any ways to add the annotation into the legend?
Beta Was this translation helpful? Give feedback.
All reactions