highcharts-ng
highcharts-ng copied to clipboard
Annotation Issue with highcharts-ng
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
- Version of highcharts-ng used: current version
- Browser Name and version: Chrome 65.0.3325.181
- Operating System and version (desktop or mobile): Windows 1709
Try this @Ascension324 --> http://jsfiddle.net/x7m3y51z/4/
Added
$scope.chartConfig = angular.copy($scope.chartConfig);
@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/