i am trying to make a pie chart directive and i use the highcharts one but i also want to add another line of text that sais for example '60%' or so. So far i tried this
app.directive('pieGraph', function($compile) {
return {
restrict: 'C',
scope: {
value: '@',
color: '@'
},
link: function(scope, elem) {
elem.highcharts({
chart: {
type: 'pie',
backgroundColor: null
},
title: {
text: null
},
yAxis: {
title: {
text: 'Total percent market share'
}
},
plotOptions: {
pie: {
shadow: true
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
tooltip: {
enabled: false
},
series: [{
name: '',
data: [
{
name: 'a',
y: parseInt(scope.value, 10),
color: scope.color
},
{
name: 'b',
y: (100 - parseInt(scope.value, 10)),
color: '#ffffff'
}
],
size: '100%',
innerSize: '90%',
dataLabels: {
enabled: false
}
}]
});
var graph = angular.element('<span class="pie-graph-value">{{scope.value}}<sup>%</sup></span>');
$compile(graph)(scope);
elem.append(graph);
}
};
});
but this issue is that the last that i applied, sais only % instead the value and percent symbol. Is there something wrong i did on the compile stuff on the end ?
Thank you in advance, Daniel!