gpt4 book ai didi

jquery - 如何在 HighCharts 中显示图例

转载 作者:行者123 更新时间:2023-12-02 15:17:10 32 4
gpt4 key购买 nike

我正在使用 Hightcharts ,我尝试显示图表的图例,但我不知道为什么不显示它。

  function multipleCharts(current_data) {
var seriesOptions = [],
type = ['jobs_running', 'jobs_pending'];
for (var j = 0; j < current_data.length; j++) {
var project = current_data[j]['name'];
for (var i = 0; i < type.length; i++) {
seriesOptions.push({
name: project + ' ' + type[i],
data: current_data[j][type[i]]
});
}
}
$('#containerChart').highcharts('StockChart', {

tooltip: {
formatter: function(){
s = '';
$.each(this.points, function(){
s += '<br/>' + '<span style="color:'+ this.series.color +'; text-transform: uppercase;">' + this.series.name + ':' + '</span>'+ ' ' + Highcharts.numberFormat(this.y,0) + ' jobs';
});
return s;
},
},
legend: {
labelFormatter: function() {
serie_name = '';
$.each(this.series, function(){
serie_name += this.series.name + '<br/>';
});
return serie_name;
},
},
rangeSelector: {
buttonTheme: { // styles for the buttons
fill: 'none',
stroke: 'none',
'stroke-width': 0,
r: 8,
style: {
color: '#f47321',
fontWeight: 'bold'
},
states: {
hover: {
},
select: {
fill: '#f47321',
style: {
color: 'white'
}
}
// disabled: { ... }
}
},
inputBoxBorderColor: '#005030',
inputBoxWidth: 120,
inputBoxHeight: 18,
inputStyle: {
color: '#005030',
fontWeight: 'bold'
},
labelStyle: {
color: '#005030',
fontWeight: 'bold'
},
selected: 0
},
series: seriesOptions
});
}

即使我尝试过这样的事情,也很简单,而且没有显示任何东西

legend: {
title: {
text: 'hola',
style: {
fontStyle: 'italic'
}
},

},

任何想法!提前致谢

最佳答案

在图例中设置启用为真。

legend: {
enabled: true
},

关于jquery - 如何在 HighCharts 中显示图例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39622202/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com