I'm using a directive to build some Highcharts and I'm having a problem in a ng-repeat loop when I'm using variables to set the div ID. It seems that Highcharts doesn't recognize the compiled code.
ERROR in Firebug:
Highcharts error #13: www.highcharts.com/errors/13
<div class="ng-binding" id="{{1}}" ng-init="load('lever', lever.id);" charttype="line" chartheight="80" width="120">HTML
<hichart id="{{1}}" ng-init="load('lever',
lever.id);" chartType="line" chartHeight="80" width="120"></hichart> DOESN'T work
<hichart id="1" ng-init="load('lever',
lever.id);"
chartType="line" chartHeight="80" width="120"></hichart> DO work
Actually the code is something like id="{{
lever.id}}", but was simplifying and the {{1}} leads to the same error. In my directive I', using link to apply the highcarts changes after the template has been put.
DIRECTIVE
.directive('hichart', function() {
return {
restrict: 'E',
transclude: true,
controller: ChartCtrl,
template:'<div>{{chartId}}---{{chartData}}</div>',
replace: true,
link: function(scope, element, attrs) {
var chart1 = new Highcharts.Chart({
chart: {
renderTo: '1',
type: attrs.charttype,
animation : false,
height:attrs.chartheight
},
xAxis: {categories: scope.chartCategories },
yAxis:{title:{text:''}},
series:[{data: scope.chartData}],
title:{text:''},
legend:{enabled:false}
});
},
};
})
I have been trying a solution all the whole day and I really appreciate your feedback.