Skip to content
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

Line annotation when specified with borderWidth:1, the final width of line is 2px #903

Open
skopz356 opened this issue Jul 12, 2023 · 2 comments

Comments

@skopz356
Copy link

skopz356 commented Jul 12, 2023

When using line annotation with borderWidth: 1, the final width of the line is 2px.
Step to reproduce:

The width is 2px even when borderWidth is set to 1px.

I would be happy to create a pull request if someone points me to the right direction.

@stockiNail
Copy link
Collaborator

@skopz356 thank you very much for this issue.

To support your issue: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines

To fix, we should check the borderWidth if odd or not and then change the annotation element size calculation as described in the document.
All annotation element sizes are calculated in the resolveElementProperties(chart, options) method of the annotation elements (in src/types).
This will affect also the test cases which should be changed.
Let me know if more info are needed to submit a PR. Otherwise I'll have a look asap.

@stockiNail
Copy link
Collaborator

@skopz356 maybe it can help, you could try to set borderWidth: 0.5. It doesn't solve completely but improve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants