Reputation: 43
I´m not able to get access to the chart-object in highchart with the angularjs directive HIGHCHARTS-NG.
var chart = $scope.chartConfig.getHighcharts();
console.log("chart", chart);
Gives me an error: $scope.chartConfig.getHighcharts is not a function.
When I
console.log("chart", chartConfig);
the object offers me the getHighcharts()-function.
When I say
var chart = $scope.chartConfig
console.log("chart", chart);
it´s not offering the getHighCharts-function anymore!
I really need to get access to that chart-object.
Thanks
Upvotes: 1
Views: 2886
Reputation: 1322
I will suggest to use the highcharts libraries how they are. Because in this case this is not an official pluggin, and the problem is that in a near future it might not be compatible anymore.
Anyway, to get the chart object you can try:
<highchart id="chart1" config="chartConfig"></highchart>
you can use func option;
$scope.chartConfig = {
...,
func: function(chart){
//play with chart
}
}
which is a reference to the callback function when it creates the highchart object:
var x = new Highcharts(options, func);
using jQuery
var chart = $("#chart1").highcharts();
I hope it helps.
Regards, Luis
Upvotes: 2