Skip to content

shapes on category axis are redrawn incorrectly after zoom #1720

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

Closed
cldougl opened this issue May 24, 2017 · 4 comments · Fixed by #1748
Closed

shapes on category axis are redrawn incorrectly after zoom #1720

cldougl opened this issue May 24, 2017 · 4 comments · Fixed by #1748
Assignees
Labels
bug something broken

Comments

@cldougl
Copy link
Member

cldougl commented May 24, 2017

example: https://codepen.io/plotly/pen/79661cd85e9e51054039b89d096b0c9a

after zoom/relayout the vertical line is drawn as a rectangle or if type='line' is specified the vertical line becomes diagonal.

@etpinard
Copy link
Contributor

This is a regression from 1.24.0.

Here's working example with 1.23.1:
https://codepen.io/etpinard/pen/vmqEJg?editors=0010

@etpinard
Copy link
Contributor

I suspect PR #1403

@etpinard etpinard self-assigned this May 29, 2017
@etpinard
Copy link
Contributor

Ok, well this is a pretty big problem after all. Annotations, shapes and layout image on type: 'category' axes are all broken after zoom, pan or any axis-range relayout calls at the moment.

Diagnostic: in Axes.coercePosition we attempt to use ax._categories to convert string category positions to category indices. Note that, ax._categories isn't filled (nor relinked) at that point in Plots.supplyDefaults. To go around that, annotations, shapes and images defaults are called a second time during Plotly.doCalcdata if type: 'category' axes are detected. At this point ax_.categories is set, but Plots.doCalcdata isn't called on all updates (e.g. not on pan/zoom) whereas Plotly.supplyDefaults leading to bad coordinates values in fullLayout propagating to the draw methods after pan/zoom interactions.

Before PR #1403, annotations and shape used to redo their defaults in their drawOne respective methods. We could revert to doing something like that, but we can do better I think.

In component-category-axes-relayout-attempt, I propose removing logic involving ax._categories from Axes.coercePosition (as ax._categories can't be relied upon at the defaults step) and instead redefining what r (short for ranges) axes conversions methods means for category axes.

@alexcjohnson what do you think before I go any further?

etpinard referenced this issue May 30, 2017
- category d2r shouldn't add new categories
@sb0007
Copy link

sb0007 commented Sep 16, 2019

shapes are still broken on category axis... is this yet to be fixed?

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

Successfully merging a pull request may close this issue.

3 participants