0

我正在尝试创建一个堆叠和分组的列高图,但我只希望最后几个 x 值具有多个组/堆栈。第一个 x 值只有一个组/堆栈。

为了解释,我正在绘制历史价值图表,然后比较乐观和保守的预测情景。

这是我的jsFiddle。更好的方法来做到这一点?

 series: [{
            name: 'Thermal',
            data: [5, 3, 4, 5],
            stack: 'conservative',
            color:'blue'
        }, {
            name: 'PV',
            data: [3, 4, 4, 6],
            stack: 'conservative',
            color: 'red'
        }, {
            name: 'Thermal',
            data: [0, 0, 0, 10],
            stack: 'optimistic',
            color: 'blue',
            showInLegend: false
        }, {
            name: 'PV',
            data: [0,0,0, 12],
            stack: 'optimistic',
            color: 'red',
            showInLegend: false
        }]
4

1 回答 1

0

基本上 highcharts 很棒,您可以堆叠条形图并按点为它们提供相关数据。我为我的系列数组传递了以下内容,并附加了传递给工具提示的属性。在此处查看jsFiddle

 series:[
         {name:'Apples', color:'green', data:[{x:0, y:10, year: '2009', scenario: 'historic'}, {x:1, y:11,year: '2010',  scenario: 'historic'} ]}, 
         {name:'Oranges', color:'orange', data:[{x:0, y:2, year: '2009',  scenario:'historic'}, {x:1, y:5, year: '2010', scenario:'historic'}]},
         {name:'Apples',color:'green', data:[{x:1.75, y:12, year:'2011',scenario:'optimistic'}], showInLegend: false },
         {name:'Apples', color:'green',data:[{x:2.25, y:3,year:'2011',  scenario:'conservative'}], showInLegend: false },
         {name:'Oranges',color:'orange',  data:[{x:1.75, y:11, year:'2011',scenario:'optimistic'}], showInLegend: false},
         {name:'Oranges',color:'orange',  data:[{x:2.25, y:6, year:'2011',scenario:'conservative'}], showInLegend: false},
]
于 2013-01-29T01:56:13.433 回答