So I know that JQuery is used often with highcharts, but for my purposes I am not using it. I have implemented highcharts into angular using just javascript and now I am trying to populate the series data for the chart using a .json file. For some reason when I try to load the chart within a http.get call (to read the json file), the chart no longer displays. I can't figure out why. Any insight on why this might happen?
http.get('data.json').success(function(data) {
$scope.chartOptions = {
chart: { type: 'line' },
title: { text: 'Fruit Consumption' },
xAxis: { categories: ['Apples', 'Bananas', 'Oranges'] },
yAxis: { title: { text: 'Fruit eaten' } },
series: [
{ name: 'Jane', data: [1, 0, 4] },
{ name: 'John', data: [5, 7, 3] }
]
};
});
app.directive("highcharts", function() {
return {
link: function(scope, element, attrs) {
var options = scope.$eval(attrs.highcharts);
options.chart.renderTo = element[0];
new Highcharts.Chart(options);
}
};
});