You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As suggested by @etimberghere a good solution would be for the library to expose label position data via a public API. This would make it possible for event handlers to get the data they need without having to duplicate the internal calculations.
I was able to hack together a solution for what I need by replicating parts of the core code:
drawPointLabels() would make use of the labelText, while event handlers would be more likely to be interested in the boundingBox data, but they would be calculated together so consistent with each other.
If accepted it would provide a step towards support for label event handlers, and a similar solution could be applied to other scale types.
Before I start just wanted to check if that patch would be likely to be considered for integration?
The text was updated successfully, but these errors were encountered:
Would love to have this general feature for all chart types. Had to hack my own solution to detect click on horizontalBar labels by passing a fake event object to getElementAtEvent() with an altered clientY value.
A common request for the radar chart type is the ability to locate the labels in order to interact (hover, click, etc). For example:
#5344
#3049
https://stackoverflow.com/questions/50470784/make-chart-js-radar-labels-clickable
https://stackoverflow.com/questions/37028924/how-to-add-onclick-event-on-labels-in-chart-js-v2-0
As suggested by @etimberg here a good solution would be for the library to expose label position data via a public API. This would make it possible for event handlers to get the data they need without having to duplicate the internal calculations.
I was able to hack together a solution for what I need by replicating parts of the core code:
https://jsfiddle.net/simoncoggins/7r08uLk9/
But worry about having to maintain it as chartjs moves forward. Therefore I’m considering writing a patch to:
The idea would be to provide an object something like this:
drawPointLabels() would make use of the labelText, while event handlers would be more likely to be interested in the boundingBox data, but they would be calculated together so consistent with each other.
If accepted it would provide a step towards support for label event handlers, and a similar solution could be applied to other scale types.
Before I start just wanted to check if that patch would be likely to be considered for integration?
The text was updated successfully, but these errors were encountered: