Can custom annotations be made? #936
-
I want to custom an annotation like above, this image must be generated based on data so I can't use an image, is there any way to do it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@stockiNail help me |
Beta Was this translation helpful? Give feedback.
-
@anhln1998 there is not any support for custom annotation. This was evaluated a couple of years ago but was discarded. To do what you are showing, I would implement a label annotation setting a canvas as content (https://www.chartjs.org/chartjs-plugin-annotation/latest/samples/label/canvas.html). Otherwise, if too complex, I would implement a specific ChartJS plugin to do that. |
Beta Was this translation helpful? Give feedback.
@anhln1998 there is not any support for custom annotation. This was evaluated a couple of years ago but was discarded.
To do what you are showing, I would implement a label annotation setting a canvas as content (https://www.chartjs.org/chartjs-plugin-annotation/latest/samples/label/canvas.html).
The label annotation could have text, image or canvas content.
You could create a a canvas (pay attention to the dimension), you can draw the shape you want and you can set it to the label annotation (content option).
There are other specific option to act on canvas (like width, height).
Otherwise, if too complex, I would implement a specific ChartJS plugin to do that.
Hopefully this could help you.