Skip to content

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

@acats-dkolev

Description

@acats-dkolev

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

Activity

etpinard

etpinard commented on Aug 30, 2017

@etpinard
Contributor

Thanks for the report.

etpinard

etpinard commented on Aug 30, 2017

@etpinard
Contributor

Wait. What browser are you using?

etpinard

etpinard commented on Aug 30, 2017

@etpinard
Contributor

Ha I see, your codepen imports 1.24.1. Confirmed.

acats-dkolev

acats-dkolev commented on Aug 30, 2017

@acats-dkolev
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

alexcjohnson commented on Aug 30, 2017

@alexcjohnson
Collaborator

1-line fix - I'll get it.

self-assigned this
on Aug 30, 2017
alexcjohnson

alexcjohnson commented on Aug 30, 2017

@alexcjohnson
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

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @alexcjohnson@etpinard@acats-dkolev

    Issue actions

      Shape type 'path' SVG causes TypeError: Cannot read property 'append' of undefined · Issue #1974 · plotly/plotly.js