Ich erstelle ein finanzielles Tortendiagramm mit HighCharts, das die Asset Allocation darstellt. Mein Ziel ist es, ein Diagramm zu erstellen, das die tatsächlichen Zuteilungswerte in jedem Segment darstellt, aber innerhalb jeder Folie wird im Wesentlichen ein zweites Datenlabel angezeigt, das den Zielprozentsatz für verschiedene Investitionsvehikel anzeigt. Es ist wichtig zu beachten, dass die aktuelle Asset-Allokation möglicherweise nicht immer mit dem Zielallokationswert übereinstimmt.HighCharts Tortendiagramm - Text innerhalb jedes Slice hinzufügen
Ich habe alles mit Ausnahme der Target-Etiketten in jeder Folie funktioniert. Siehe das Bild unten für das, was würde ich erreichen möchte:
Hier ist, was ich habe bisher:
var asset_allocation_pie_chart = new Highcharts.Chart({
chart: { renderTo: 'asset_allocation_bottom_left_div' },
title: { text: 'Current Asset Allocation', style: { fontSize: '17px', color: entity_color, fontWeight: 'bold', fontFamily: 'Verdana'} },
subtitle: { text: '(As of ' + effective_date_formatted + ')', style: { fontSize: '15px', color: entity_color, fontFamily: 'Verdana', marginBottom: '10px' }, y: 40 },
tooltip: { pointFormat: '{series.name}: <b>{point.percentage}%</b>', percentageDecimals: 0 },
plotOptions: {
pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, color: '#000000', connectorWidth: 1, connectorColor: '#000000', formatter: function() { return '<b>' + this.point.name + '</b>:<br/> ' + Math.round(this.percentage) + ' %'; } } }
},
series: [{
type: 'pie',
name: 'Asset Allocation',
data: [['Investment Grade Bonds', InvestmentGradeBondPercentage], ['High Yield Bonds', HighYieldBondPercentage], ['Hedged Equity', HedgedEquityPercentage], ['Global Equity', GlobalEquityPercentage], ['Cash', CashPercentage]]
}],
exporting: { enabled: false },
credits: { enabled: false }
});
Ich schlage vor, zu vertraut mit similiar Thema http://stackoverflow.com/questions/13488813/ Highcharts-Pie-Datalabels-innen-und-außen –