Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have a highchart(in barchart format) in which I want to group the barcharts with a value(let say columnA), then further breakdown the barcharts with other values under columnA(e.g. columnB and columnC).
But I cant seems to get it right, the xAxis of the barcharts being displayed does not according to what I want. Below are my codes:
JavaScript
LoadHighchart: function () {
            $('#MyContainer').highcharts({
                chart: {
                    zoomType: 'x'
                },
                title: {
                    text: null
                },
                xAxis: {
                    categories: [{
                        name: columnA,
                        categories: [columnB, columnC]
                    //}],
                    crosshair: true
                },
                yAxis: [{
                    title: {
                        text: null
                    }
                }, {
                    title: {
                        text: null
                    },
                    opposite: true
                }],
                plotOptions: {
                    column: {
                        stacking: 'quantity'
                    },
                    spline: {
                        marker: {
                            enabled: true
                        }
                    },
                    series: {
                        cursor: 'pointer',
                        marker: {
                            lineWidth: 1
                        }
                    }
                },
                series: [{
                    type: 'column',
                    name: 'ColA',
                    data: columnA,
                }, {
                    type: 'spline',
                    name: 'ColB',
                    data: columnB,
                }, {
                    type: 'spline',
                    name: 'ColC',
                    data: columnC,
                    yAxis: 1,
                    tooltip: {
                        valueSuffix: '%'
                    }
                }]
            });

        },


What I have tried:

1. Refer to the example from below link but it did not work out as expected.
http://www.highcharts.com/plugin-registry/single/11/Grouped-Categories
Posted
Updated 27-Jun-16 16:08pm
v5
Comments
Karthik_Mahalingam 27-Jun-16 1:58am    
post full code.
Jamie888 27-Jun-16 21:22pm    
Sir, I have updated my codes.
Karthik_Mahalingam 27-Jun-16 21:40pm    
what is ColumnA, ColumnB, COlumnC
Jamie888 27-Jun-16 22:28pm    
columnA, B and C are array var
Karthik_Mahalingam 27-Jun-16 22:40pm    
Number array?

1 solution

check this

JavaScript
var columnA = 'some';
            var columnB = 'BB';
            var columnC = 'CC';

            $('#MyContainer').highcharts({
                chart: {
                    zoomType: 'x',
                    type: "column"
                },
                title: {
                    text: null
                },
                xAxis: {
                    categories: [{
                        name: columnA,
                        categories: [columnB, columnC]
                        }],
                        crosshair: true
        },
            yAxis: [{
                title: {
                    text: null
                }
            }, {
                title: {
                    text: null
                },
                opposite: true
            }],
        plotOptions: {
            column: {
                    stacking: 'quantity'
            },
            spline: {
                    marker: {
                        enabled: true
                    }
            },
            series: {
                    cursor: 'pointer',
                    marker: {
                    lineWidth: 1
                    }
            }
        },
        series: [{
            type: 'column',
            name: 'ColA',
            data: [1,2,3],
         
        }]
        });
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900