alonho / angular-plotly

MIT License
41 stars 35 forks source link

Added support of 'plotly-manual-data-update' directive attribute #20

Closed maxaus closed 7 years ago

maxaus commented 7 years ago

In case of huge set of data provided in 'plotly-data' attribute value, using scope deep watcher becomes not really efficient, so my attempt to improve performance a bit was using new 'plotly-manual-data-update' directive attribute, which when set to 'true' causes not using scope watcher for chart data, but update only, when 'tracesUpdated' event is broadcasted from parent scope. So when we update chart data in controller, we can broadcast this event with: $scope.$broadcast('tracesUpdated'); Where $scope is some custom controller scope. And 'plotly' directive will execute:

scope.$on('tracesUpdated', function () {
   onUpdate();
});

on this call.