所以我使用 jQuery 插件“Highcharts”制作了这个饼图,它返回给我的是输入它的总数的百分比。我还想做的是专门显示传递给插件的数字。这是否可能以及如何通过登录系统阻止我拥有的内容,但此链接指向我正在使用的确切演示:
http://www.highcharts.com/demo/pie-legend
如果您查看源代码,您将看到插件的以下内容:
$(function () {
var chart;
$(document).ready(function () {
// Build the chart
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market shares at a specific website, 2010'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage}%</b>',
percentageDecimals: 1
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
['Firefox', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
sliced: true,
selected: true
},
['Safari', 8.5],
['Opera', 6.2],
['Others', 0.7]
]
}]
});
});
});
Under "data" there is the series title and then the value. I specifically want to know what syntax to use to display the numbers like "Firefox"'s 45.0. To display the title you use {series.name} so I am guessing its something like {series.number} but there isn't anywhere in the documentation that specifies this so I am not sure if its even possible. Any help would be appreciated!