https://github.com/angular/angular/issues/10788
如图所示,您可以看到收取的费用和应付费用的百分比%我想给用户选项,如下拉列表,他们可以选择%或数字。当事件更改时,它将以%和数字显示。已经对我们可以看到的悬停事件进行了更改。 这是我的代码
var totalAmount = parseFloat(parseData[0][0].total_amount);
var paidAmount = parseFloat(parseData[0][0].paid_amount);
var dueAmount = totalAmount - paidAmount;
$("#chart-container,#chart-container2").removeClass('hide')
var slicedData = {
name: 'Fees Collected',
y: paidAmount,
sliced: true,
selected: true
}
var array = [slicedData,['Fees Due',dueAmount]];
drawChart(array);
function drawChart(chartData){
$('html,body').animate({scrollTop: ($("#chart-container2").offset().top)-250},'slow');
chart1 = new Highcharts.Chart({
chart: {
renderTo: 'chart-container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Fee Chart'
},
tooltip: {
formatter:function(){
return '<b>'+ (this.key) +' : '+ this.y +' </b>';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 2) +' %';
}
}
}
},
series: [{
type: 'pie',
name: 'Fee Ratio',
data: chartData
}]
});
}