pablojim / highcharts-ng

AngularJS directive for Highcharts
MIT License
1.73k stars 463 forks source link

How to dynanically change chart to percentage change? #640

Closed donli1210 closed 6 years ago

donli1210 commented 6 years ago

Please see this fiddle

If I put the following settings in the $scope.chartConfig, it is working

plotOptions: {
  series: {
          compare: 'percent'
   }
}

If I put it to a function and change it dynamically

$scope.changePercentage = function() {
      $scope.chartConfig.plotOptions.series.compare = 'percent';
      $scope.chartConfig = angular.copy($scope.chartConfig);
    };

It is not working. Any suggestions? Thanks!

pablojim commented 6 years ago

There was an error in your jsfiddle- check the console of your jsfiddle for details. See here for an alternative approach.

http://jsfiddle.net/upjb6rLh/

donli1210 commented 6 years ago

Thanks!