6
我使用表示資產分配的HighCharts創建財務餅圖。我的目標是創建一個圖表,表示每個切片中的實際分配值,但每張切片內將顯示基本上顯示各種投資工具的目標百分比的第二個數據標籤。重要的是要注意,目前的資產配置可能並不總是與目標分配值相匹配。HighCharts餅圖 - 在每個切片內添加文本
我已經得到了一切工作,除了每張幻燈片中的目標標籤。見下面的圖片是我想做到:
這裏是我迄今:
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 }
});
我建議熟悉,有着相近的主題http://stackoverflow.com/questions/13488813/ highcharts餡餅 - datalabels - 內 - 和外 – 2013-03-08 11:24:43