Marcus Franzen
Marcus Franzen

Reputation: 868

Highcharts: setting spacing dynamically

I would like to set the spacingRight dynamically after drill down.

Here is the function i am using to switch to the drill down chart:

function setChart(options) {
        chart.series[0].remove(false);
        chart.addSeries({
            type: options.type,
            name: options.name,
            data: options.data,
            color: options.color || 'white'
        }, false);
        chart.xAxis[0].setCategories(options.categories, false);
        chart.options.spacingRight = 35; //not working
        chart.redraw();
    }

Upvotes: 0

Views: 486

Answers (2)

Paweł Fus
Paweł Fus

Reputation: 45079

Possible workaround is to overwrite (you were close!) that options and set dirty box:

    chart.options.chart.spacingRight = 5;
    chart.isDirtyBox = true;
    chart.redraw();

See fiddle: http://jsfiddle.net/3bQne/208/

Upvotes: 1

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

Unfortunately dynamical modification of spacingRight parameter is not available, only when you destroy chart and create new instantion, then you can modify this option. You can request your suggestion in our uservoice system http://highcharts.uservoice.com/

Upvotes: 0

Related Questions