Highcharts 堆栈组列的正确 x 轴 [英] Proper x-axis for Highcharts stack group column

查看:30
本文介绍了Highcharts 堆栈组列的正确 x 轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个图表,该图表使用 1 个度量和 3 个维度来可视化数据.我把一维放在 x 轴上,一维作为堆栈,一维作为系列列表.

HighCharts 有我用作基础的堆叠分组柱形图.请参阅我的 ,但这不似乎与堆栈一起工作.

有什么提示吗?

解决方案

这可能不是最好的解决方案(所以请继续),但我现在伪造了一个数据序列.

参见

I'm trying to develop a chart that visualizes data using 1 measurement and 3 dimensions. I put one dimension on the x-axis, one as stack and one as list of series.

HighCharts has the stacked-grouped-column chart that I use as basis. See my jsfiddle.

    series: [{
        name: 'John',
        color: '#ff4400',
        data: [5, 3, 4, 7, 2],
        stack: '2014'
    }, {
        name: 'Joe',
        color: '#44ff00',
        data: [3, 4, 4, 2, 5],
        stack: '2014'
    }, {
        name: 'John',
        color: '#ff4400',
        data: [2, 5, 6, 2, 1],
        showInLegend: false,
        stack: '2015'
    }, {
        name: 'Joe',
        data: [3, 0, 4, 4, 3],
        color: '#44ff00',
        showInLegend: false,
        stack: '2015'
    }]

I would like to be able to display the stack name on a second level x-axis. I know of the group-plugin, but that does not seems to work together with stacks.

Any hints?

解决方案

It might not be the best solution (so please keep 'm coming), but I now fake a dataseries.

See jsfiddle update

  xAxis: [{
            categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
        },
               {
            categories: ['2014', '2015', '2014', '2015', '2014', '2015','2014', '2015', '2014', '2015'],
                   opposite: true
        }],        
  series: [{
        name: 'John',
        color: '#ff4400',
        data: [5, 3, 4, 7, 2],
        stack: '2014',

    }, {
        name: 'Joe',
        color: '#44ff00',
        data: [3, 4, 4, 2, 5],
        stack: '2014',

    }, {
        name: 'John',
        color: '#ff4400',
        data: [2, 5, 6, 2, 1],
        showInLegend: false,
        stack: '2015'
    }, {
        name: 'Joe',
        data: [3, 0, 4, 4, 3],
        color: '#44ff00',
        showInLegend: false,
        stack: '2015'
    }, {
        name: '',
        data: [0, 0, 0,0, 0, 0,0, 0, 0,0],
        showInLegend: false,
        stack: '2015',
        xAxis: 1            
    }]

Result:

Update

Fiddled around with fake axis labels: http://jsfiddle.net/b72e0vh4/8/

这篇关于Highcharts 堆栈组列的正确 x 轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆