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

New Plotly.js update broke ? ''ERROR TypeError: Cannot read property 'map' of undefined'' #30

Closed
Alterock13 opened this issue Dec 31, 2018 · 9 comments

Comments

@Alterock13
Copy link

Alterock13 commented Dec 31, 2018

Hi,

I've been using plotly for quite some time now and everything in my app was working rather fine.
However, since about 12 days ago, my app stopped working without any change in the code.

        Plotly.newPlot(
            this.layout['title'], 
            this.traces, this.layout, 
            this.options);        

or Plotly.update give the same error :

ERROR TypeError: Cannot read property 'map' of undefined
    at Object.r.coerceTraceIndices (plotly-latest.min.js:7)
    at Object.J [as update] (plotly-latest.min.js:7)
    at SafeSubscriber.eval [as _next] (chart.component.ts:93)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:243)
    at SafeSubscriber.next (Subscriber.js:190)
    at Subscriber._next (Subscriber.js:131)
    at Subscriber.next (Subscriber.js:95)
    at AsyncAction.IntervalObservable.dispatch (IntervalObservable.js:80)
    at AsyncAction._execute (AsyncAction.js:119)
    at AsyncAction.execute (AsyncAction.js:94)

I can provide the contents of 'this.layout', 'this.traces' and 'this.options' if necessary.

I've noticed that a few hours before this problem, plotly.js had been updated with version 1.43.0
Is it due to an API change that would cause the angular wrapper to malfunction?

Can anyone tell me if they have had issues with it too since the update?

For now the fix I've made is to specify in head :
<script src="https://cdn.plot.ly/plotly-1.42.5.min.js"></script>
Rather than the latest.

@Alterock13 Alterock13 changed the title New Update broke ? ''ERROR TypeError: Cannot read property 'map' of undefined'' New Plotly.js update broke ? ''ERROR TypeError: Cannot read property 'map' of undefined'' Dec 31, 2018
@bluehazetech
Copy link

Since a new version of plotly.js has caused a breakage, I'm curious to know if this repo is still being maintained. A PR was created 4 days ago, but the last commit was over 3 months ago. Are there plans for angular-plotly.js to keep up with plotly.js releases?

@Alterock13
Copy link
Author

So you confirm that this module is also no longer functioning with the latest plotly.js for you as well?
I'm also curious to know if there are plan to maintain this repo or not.

@bluehazetech
Copy link

So you confirm that this module is also no longer functioning with the latest plotly.js for you as well?
I'm also curious to know if there are plan to maintain this repo or not.

It works for me on version 1.43.1, but only with a barebones configuration (simple data and layout). I don't know if more complex configurations would throw errors, so my concern is based on the regression you've encountered.

@nicolaskruchten
Copy link
Contributor

In principle, no updates are needed to this repo for new versions of plotly.js, as the plotly.js team tries very hard to make every release backwards-compatible. We'll look into what happened in this release specifically that broke things.

In the meantime, we strongly recommend version pinning for production code: if your code worked with plotly.js 1.42.5 and you don't need new features from 1.43.1, then I recommend that your package.json should pin to 1.42.5 :)

@archmoj
Copy link

archmoj commented Jan 3, 2019

I can provide the contents of 'this.layout', 'this.traces' and 'this.options' if necessary.

@Alterock13 Yes. That would be helpful. Thanks.

@Alterock13
Copy link
Author

Alterock13 commented Jan 3, 2019

In the meantime, we strongly recommend version pinning for production code: if your code worked with plotly.js 1.42.5 and you don't need new features from 1.43.1, then I recommend that your package.json should pin to 1.42.5 :)

Well, actually, I did pin it to 1.42.5 but it wasn't enough for my case. I also had to tweak my head section to change from <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> to <script src="https://cdn.plot.ly/plotly-1.42.5.min.js"></script>

I can provide the contents of 'this.layout', 'this.traces' and 'this.options' if necessary.

@Alterock13 Yes. That would be helpful. Thanks.

Sure ! Here they are :
Data

    data= [{
      x: [],
      y: [],
      mode: 'lines+markers',
      connectgaps: true,
      line: {
        color: 'rgb(204, 204, 0)',
        width: 3
      }
    }];

Layout

    layout = {
      title: 'Power',
      showlegend: false,
      xaxis: {
        title: 'Date',
        zeroline: false
      },
      yaxis: {
        title: 'Current [mA]',
        zeroline: false,
        range: [60, 220]
      },
      autosize: true
    };

Options
options = null;
(This one is null for now)

@etpinard
Copy link

etpinard commented Jan 3, 2019

This is probably related to plotly/plotly.js#3276 where we deprecated layout.title as a string and moved to layout.title.text.

@Alterock13 could you try:

        Plotly.newPlot(
            this.layout.title.text, 
            this.traces, this.layout, 
            this.options);    

to see if things work?

@Alterock13
Copy link
Author

This is probably related to plotly/plotly.js#3276 where we deprecated layout.title as a string and moved to layout.title.text.

@Alterock13 could you try:

        Plotly.newPlot(
            this.layout.title.text, 
            this.traces, this.layout, 
            this.options);    

to see if things work?

Hi !

Yup, I had seen that in the changelog when the bug occured and tried but to no success.

@andrefarzat
Copy link
Collaborator

@Alterock13 angular-plotly.js was updated to 0.2.0 to support angular 7.x
Please, update it and check if the issue continues

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

No branches or pull requests

6 participants