gpt4 book ai didi

javascript - 对 highcharts 中的类别中的后代数据进行排序

转载 作者:行者123 更新时间:2023-12-03 07:20:08 28 4
gpt4 key购买 nike

我想使用 highcharts 对类别内的数据进行排序。我尝试了所有数据类型,但没有一个对我有用。这是可能的?我的愿望是(图片来自 Paint):

click to see my expected result

原始代码(来自http://jsfiddle.net/BKLrA/2/):

$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Performance for the last week'
},
xAxis: {
type: 'category',
categories: ['Mon', 'Tue', 'Wed']
},
yAxis: {
min: 0,
title: {
text: '# of devices'
}
},
tooltip: {
enabled: false
},
series: [{
name: 'Green',
data: [
{
x: 0,
name: 'Mon',
y: 100
},
{
x: 1,
name: 'Tue',
y: 400
},
{
x: 2,
name: 'Wed',
y: 350
}
],
color: 'green'

}, {
name: 'Yellow',
data: [
//{
// name: 'Mon',
// y: 100
//},
{
x: 1,
name: 'Tue',
y: 140
},
{
x: 2,
name: 'Wed',
y: 170
}
],
color: 'yellow'
}]
});
});

最佳答案

您可以将堆叠系列与克隆系列一起使用 linkedTo (允许图例单击隐藏/显示)到主要系列。基本上每个系列都必须有与堆栈一样多的 linkedTo 系列。

示例:http://jsfiddle.net/ju0p683j/

关于javascript - 对 highcharts 中的类别中的后代数据进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36243426/

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