alonho / angular-plotly

MIT License
41 stars 35 forks source link

10 $digest iterations reached #25

Open mcblum opened 7 years ago

mcblum commented 7 years ago

Hello. I'm not sure if this is an issue with angular-plotly, but every time I change the data I get this error:

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [[{"msg":"fn: regularInterceptedExpression","newVal":[{"x":"...","y":"...","type":"bar"}],"oldVal":[{"x":"...","y":"...","type":"bar"}]}],[{"msg":"fn: regularInterceptedExpression","newVal":[{"x":"...","y":"...","type":"bar"}],"oldVal":"..."}],[{"msg":"fn: regularInterceptedExpression","newVal":[{"x":"...","y":"...","type":"bar"}],"oldVal":"..."}],[{"msg":"fn: regularInterceptedExpression","newVal":[{"x":"...","y":"...","type":"bar"}],"oldVal":"..."}],[{"msg":"fn: regularInterceptedExpression","newVal":[{"x":"...","y":"...","type":"bar"}],"oldVal":"..."}]]

The graph does actually update, but it stops the other operations because of the error. Any idea what might be going on?

preraksola commented 6 years ago

I am facing the same issue and I figured that Plotly.redraw(graph) line in onUpdate() is causing it.

function onUpdate () {
    //No data yet, or clearing out old data

    if ( ! scope.plotlyData ) {
        if ( initialized ) {
        Plotly.Plots.purge ( graph );
        graph.innerHTML = '';
    }
    return;
    }

    //If this is the first run with data, initialize
    if ( ! initialized ) {
    initialized = true;
    Plotly.newPlot ( graph, scope.plotlyData, scope.plotlyLayout, scope.plotlyOptions );
    if ( scope.plotlyEvents ) {
        subscribeToEvents ( graph );
    }
    }

    graph.layout = scope.plotlyLayout;
    graph.data   = scope.plotlyData;
    Plotly.redraw ( graph );  //Commenting this line does not give the errors anymore
    Plotly.Plots.resize ( graph );
}                   

@mcblum Were you able to find any other resolution to this?