angular-chart.js icon indicating copy to clipboard operation
angular-chart.js copied to clipboard

Weird behaviour when updated from Broadcast

Open felixfrtz opened this issue 7 years ago • 1 comments

Hey,

I am trying to implement a chart updating dynamically based on actions done by the user, which are registered in an angular factory and then data is send via broadcast to the controller holding the chart properties.

The problem I have is that it is not working properly. I created a JS Fiddle demonstrating what I am trying to do. Basically I want the chart to update from the factory just as it updates when done through the controller.

As it can be seen in the inspector, when trying to update from factory, I am getting

Uncaught TypeError: Cannot read property '_view' of undefined.

In my application I am getting a different error, though it seems to be related and I think if I can figure out the fiddle above, it can be solved. Also see this question describing the problem from my applications point of view.

felixfrtz avatar Jun 13 '17 11:06 felixfrtz

I noticed that there is a problem with addData function, because it is setting another level to the data array. The broadcasted data array is actually in the expected format. I tested it in your jsfiddle and works fine.

fikoborquez avatar Jun 27 '17 23:06 fikoborquez