pablojim / highcharts-ng

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

Annotation Issue with highcharts-ng #648

Open Ascension324 opened 6 years ago

Ascension324 commented 6 years ago

Link to jsfiddle showing the issue.

http://jsfiddle.net/x7m3y51z/

Expected Behaviour

I have added an "Add Anno" button. When you press this button, an annotation "test2" should appear between "test1" and "test3".

Current Behaviour

Annotation "test1" and "test3" were added directly to $scope.chartConfig, and they show up and the chart. But test2 does not show when the the button is pressed. I have logged $scope.chartConfig into the console, and I can see that "test2" was added to $scope.chartConfig, however it just doesn't show on the chart.

Your Environment

KieranDotCo commented 6 years ago

Try this @Ascension324 --> http://jsfiddle.net/x7m3y51z/4/

Added $scope.chartConfig = angular.copy($scope.chartConfig);

Ascension324 commented 6 years ago

@KieranDotCo Thank you.

I've also found addAnnotation() that added the annotation in the correct location. However with the addAnnotation(), the annotation can not be read back from $scope.chartConfig, because it is added to the actual chart object. And the documentation for addAnnotation() is on the highcharts API page yet. The following link is related to this, some of the readers may find extra information there. https://forum.highcharts.com/highcharts-usage/chart-update-function-and-annotations-t39748/