how can i plot stacked columns and a single column in highcharts together?(multi Stacked)

StackOverflow https://stackoverflow.com/questions/21688575

  •  09-10-2022
  •  | 
  •  

質問

my data is something like below.

i want to show them in one single chart in highcharts.

category [jack jane julie john]

i have 3 series of grades like this:

homework  [2 1 2 3]

midterm   [5 4 6 6]

final exam[10 9 11 10]

i want them to be stacked. and their ages:

ages      [18 22 17 24]

my problem is i know how to stack and know how to plot columns but not they together.

役に立ちましたか?

解決

You can set different stacking groups:

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },

        xAxis: {
            categories: ['jack', 'jane', 'julie', 'john']
        },
        yAxis: [{
            title: {
                text: 'Grades'
            }
        }, {
            title: {
                text: 'Age'
            },
            opposite: true
        }],

        plotOptions: {
            column: {
                stacking: 'normal'
            }
        },

        series: [
        // first stack 
        {
            data: [2, 1, 2, 3],
            stack: 0,
            yAxis: 0
        }, {
            data: [5, 4, 6, 6],
            stack: 0,
            yAxis: 0
        }, {
            data: [10, 9, 11, 10],
            stack: 0,
            yAxis: 0
        },
        // second stack 
        {
            data: [18, 22, 17, 24],
            stack: 1,
            yAxis: 1
        }]
    });
});

http://jsfiddle.net/bhSrh/

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top