Highcharts Demo

author(s): Torstein Hønsi

by Torstein Hønsi

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>

<div id="container"></div>

<button id="2d">
2d
</button>

<button id="3d">
3d
</button>

CSS

#container {
    height: 400px; 
    min-width: 310px; 
    max-width: 800px;
    margin: 0 auto;
}

button {
    font-size: 2em
}

JavaScript

var chart = Highcharts.chart('container', {
    chart: {
        type: 'column',
        margin: 75,
        options3d: {
            enabled: true,
            alpha: 15,
            beta: 15,
            depth: 50
        }
    },
    plotOptions: {
        column: {
            depth: 25
        }
    },
    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]
});

document.getElementById('2d').addEventListener('click', function () {
	chart.update({
    	chart: {
        	options3d: {
            	enabled: false
            }
        }
    })
});
document.getElementById('3d').addEventListener('click', function () {
	chart.update({
    	chart: {
        	options3d: {
            	enabled: true
            }
        }
    })
});