Skip to content Skip to sidebar Skip to footer

Highcharts: To Rotate The Chart 90 Degree But Also Redraw It

I'm trying to create a button that allows me to turn the chart from portrait orientation to landscape. So what I did is to add a class to the chart when button is clicked. transfo

Solution 1:

Not sure, if I understood you properly, but are you trying to change the chart orientation on a button click? I am not familiar with highcharts, but having a quick look at their API, something like this should be enough:

// ...var hc = Highcharts.chart('container', { /* your options */ });
// ...
$('#goFS').click(function () {
    var w = 400;
    var h = 800;
    hc.update({
        chart: {
            height: h,
            width: w,
            inverted: true
        }
    });
});

Instead of hardcoded sizes, you could probably read and use the size of the container or the window, depending on your goal.

Post a Comment for "Highcharts: To Rotate The Chart 90 Degree But Also Redraw It"