Skip to content

Shape type 'path' SVG causes TypeError: Cannot read property 'append' of undefined #1974

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
acats-dkolev opened this issue Aug 29, 2017 · 6 comments · Fixed by #1975
Closed
Assignees
Labels
bug something broken

Comments

@acats-dkolev
Copy link

acats-dkolev commented Aug 29, 2017

Upgrading Plotly.js from v.1.24 to v.1.30 resulted in
Failed: TypeError: Cannot read property 'append' of undefined
at drawShape (plotly.js:120051)
when SVG type 'path' Shape is used

To reproduce use the plotly-1.24.0.min.js library - the SVG shape shows.
Switch to plotly-1.30.0.min.js - TypeError: Cannot read property 'append' of undefined is thrown

https://codepen.io/dkolev8/pen/VzVywM

I found out that the last Plotly.js version that works with this SVG shape is v.1.24.1
Looks like the breaking changes are introduced in v.1.24.2

@etpinard
Copy link
Contributor

Thanks for the report.

@etpinard
Copy link
Contributor

Wait. What browser are you using?

@etpinard
Copy link
Contributor

Ha I see, your codepen imports 1.24.1. Confirmed.

@etpinard etpinard added the bug something broken label Aug 30, 2017
@acats-dkolev
Copy link
Author

Browser chrome://version/ report:
Google Chrome | 60.0.3112.101 (Official Build) (64-bit) (cohort: Stable)

Similar error in Firefox 55.0.3 (32-bit) TypeError: shapeLayer is undefined
Thanks

@alexcjohnson
Copy link
Collaborator

1-line fix - I'll get it.

@alexcjohnson alexcjohnson self-assigned this Aug 30, 2017
@alexcjohnson
Copy link
Collaborator

The issue is not with the type of shape, it's adding a shape to an overlaying axis. Thanks for the report!

Side note @acats-dkolev - I notice you're using milliseconds for the path coordinates. That will work, but it's fragile - it will shift if you change timezones. Better is to use date strings like you do in the rect, the only complication is that if there's a time part you need to separate with an underscore instead of a space, like:
path: "M 2016-09-30_12:34:56.78 1.524 H 2016-10-14 V 1.303 Z"

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