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

Dash section #38

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Dash section #38

wants to merge 5 commits into from

Conversation

dy
Copy link
Member

@dy dy commented Oct 5, 2018

This PR resolves plotly/plotly.js#2946 and #13. The technique is straight: a segment direction is snapped to one of possible dash pattern directions, by default 8. That gives the following solutions:

3 patterns:
image

4 patterns:
image

5 patterns:
image

6 patterns:
image

7 patterns:
image

8 patterns (default):
image

9 patterns:
image

10 patterns:
image

12 patterns:
image

16 patterns:
image

20 patterns:
image

40 patterns:
image

No snapping:
image

That is still imperfect - pattern is broken at some joins, but that number of broken joins is reduced from every segment to sufficiently different segments.

@dy
Copy link
Member Author

dy commented Oct 5, 2018

Possible corrections:

  • detect best number of sections based on line character (tangent stats?)

  • detect sections phase shift:
    image
    vs
    image

  • exploit symmetry to align opposite direction patterns
    image

  • dash pattern length ←→ to min segment length ←→ thickness limitation?

@etpinard

This comment has been minimized.

@etpinard
Copy link
Member

etpinard commented Oct 9, 2018

@etpinard
Copy link
Member

etpinard commented Oct 9, 2018

cc @alexcjohnson any thoughts on Dima's fix here?

@alexcjohnson
Copy link
Contributor

Very interesting strategy @dy, I like it! I think 8 patterns is a good compromise between join mismatches and dash pattern misalignment. But I'd make sure we have exact horizontal & vertical patterns, since those are very common cases and we don't want to bias viewers into thinking a horizontal line is slightly tilted
tilted lines

@mitja-p
Copy link

mitja-p commented Jan 2, 2020

@dy is there any reason why the conflict has not been solved? This is a good idea and would fix plotly problems with dashed/dotted lines.

@dy
Copy link
Member Author

dy commented Jan 3, 2020

@etpinard @archmoj is that still of any interest? Should me or @archmoj spend some time merging that? Not sure I'll be able to test against all plotly cases.

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

Successfully merging this pull request may close these issues.

webgl dashed lines don't display correctly
4 participants