-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable clip for each annotation #874
Comments
@zk118 the only way currently to unclip the chart area is to set This topic was already raised with @kurkle (I haven't found in which issue or PR) and there were some doubts if to implement it or not. @kurkle I remember you had some concerns about that. Instead, if it' ok for you, we could try to put it in version 3 but I'd wait for PR #838 review before starting any implementation. EDIT: "Unfortunately no workaround." is not true. You can use before and after draw hooks of version 2.2.1 |
Currently, I have to do that as a workaround:
Would be nice if implemented ! |
@zk118 I make a mistake writing you that there is not any workaround. If you are using version >= 2.2.0 of the plugin, there are 2 new hooks ( You can simply add the hooks, unclipping and clipping the chart area. See following example: plugins: {
annotation: {
annotations: {
lbl1: {
type: 'label',
xValue: 1.5,
yValue: 19.5,
content: ['This is a huge', 'label to show and', 'unclip is needed'],
beforeDraw: ({chart}) => Chart.helpers.unclipArea(chart.ctx),
afterDraw: ({chart}) => Chart.helpers.clipArea(chart.ctx, chart.chartArea),
}
}
}
}, See codepen: https://codepen.io/stockinail/pen/mdGNLOM The first label is shown even if it is out of chart area. The second one is cut. |
Thanks, I will try it ! |
Apologize but having many other things to do it, I forgot it even if I have implemented the PR to enable those hooks :(. |
Looking forward to trying these hooks in the following versions, but I don't think they will suit my needs as I have annotations that are always displayed outside of the chartArea and other annotations that I have to clip and I think the |
The concept is that you unclip and clip before and after drawing of each single element. |
Oh I see, will work then ! |
Feature Proposal
Would it be possible to have the clip property per annotation so we can control it independently ?
What would be a workaround for this ?
Thanks in advance.
Possible Implementation
No response
The text was updated successfully, but these errors were encountered: