prakashkadakol
prakashkadakol

Reputation: 1237

Highchart 2.1.5 stacked bar chart

Do we have support for stacked bar chart in 2.1.5 version,I do not see below piece of code works with 2.1.5 version is there any alternate way to draw stacked bar chart for 2.1.5 version.below is code for the same which works with latest version and 2.1.9 version but not with 2.1.5 version

<html>
<head>
<script src="highchart.js"></script>
</head>
<body>
<div id="container" style="min-width: 100px; max-width: 200px; height: 50px; margin: 0 auto"></div>
<script>
chart = new Highcharts.Chart({
       chart: {
            type: 'bar',
            renderTo: 'container'
        },
        xAxis: {
            tickColor: '#FFFFFF',
            tickWidth: 1,
            categories: [''],
            labels:{
                        enabled: false
                },
            visible:false
        },
        title:{
            text:''
        },
        yAxis: {
             title: {
                text: ''
             },
             labels:{
                    enabled: false
             },
             visible:false
        },
        exporting: { enabled: false },
        legend:{
            enabled: false
        },
        plotOptions: {
            series: {
                stacking: 'normal',
                borderWidth:0
            }
        },
        tooltip: {
                enabled: false
        },
        colors:['#999999', '#8BF30D', '#FF0000'],
        series: [
        {
            name: '',
            data: [1]
        }, {
            name: '',
            data: [2]
        },{
            name: '',
            data: [1]
        }]
});
</script>
</body>
</html>

Upvotes: 0

Views: 79

Answers (1)

morganfree
morganfree

Reputation: 12472

Yes, it is supported. However, you need to be careful which jQuery version you use, becasue older Highcharts version rely on it.

Highcharts 2.1.5 works well with jQuery 1.6.1

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/2.1.5/highcharts.js"></script>

example: https://jsfiddle.net/kfumqvrz/

When you use jQuery 1.7.1, the bars do not appear until the browser window is resized - so Highcharts does not work well with that jQuery version.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/2.1.5/highcharts.js"></script>

example: https://jsfiddle.net/kfumqvrz/1/

Highcharts 2.1.9 works well with jQuery 1.7.1

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/2.1.9/highcharts.js"></script>

example: https://jsfiddle.net/kfumqvrz/2/

Upvotes: 1

Related Questions