Ich versuche, einem Highcharts-Kreisdiagramm ein benutzerdefiniertes Etikett hinzuzufügen. Das Etikett wird (eventuell) mittig, unten ausgerichtet und einige HTML-Daten anzeigen. Das Problem ist, dass das Label nicht im Diagramm angezeigt wird und versucht, den Renderer zu verwenden. Ich bin ziemlich neu in Highcharts, was mache ich falsch?Etikett kann nicht an Highchart-Kreisdiagramm angehängt werden
$('#div_graph_0_1').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
credits: {
enabled: false
},
title: {
text: 'NEW VISITORS'
},
subtitle:{
text: pieSubtitleTotal,
style: { color: '#f07600' }
},
tooltip: {
pointFormat: '{point.y}'
},
plotOptions: {
pie: {
states: {
hover: {
halo: {
size: 9,
attributes: {
fill: '#f07600'}
}
}
},
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
connectorWidth: 0,
enabled: true,
format: '{point.y}',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
},
}
},
series: [{
name: 'New',
colorByPoint: true,
data: [{
name: 'Repeat',
y: subtitleTotal,
color: '#fff',
borderColor: '#f07600',
borderWidth: 2
}, {
name: 'New',
color: '#f07600',
borderColor: '#f07600',
y: pieTotalVisitors,
sliced: true,
selected: true
}]
}],
navigation: {
buttonOptions: {
enabled: false
}
},
function(chart) { // on complete
chart.renderer.text('This text is <span style="color: red">styled</span> and <a href="http://example.com">linked</a>', 0, 0)
.css({
color: '#4572A7',
fontSize: '16px'
})
.add();
}
});
Sie haben den Syntaxfehler, behoben Demo: http://jsfiddle.net/68bcoLqf/ –