【发布时间】:2025-12-24 12:10:07
【问题描述】:
所以我使用 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]
]
}]
});
});
});
在“数据”下是系列标题,然后是值。我特别想知道使用什么语法来显示像“Firefox”的 45.0 这样的数字。要显示您使用 {series.name} 的标题,所以我猜测它类似于 {series.number} 但文档中没有任何地方指定这一点,所以我不确定它是否可能。任何帮助将不胜感激!
【问题讨论】:
标签: jquery jquery-plugins plugins charts highcharts