Skip to content Skip to sidebar Skip to footer

Dynamically Modifying The HighChart Layout Options

I can't find way to update marginTop value of already created chart. Check out my example: http://jsfiddle.net/TZaEV/4/ var btn = $('#btn'); btn.click(function(){ // do changes })

Solution 1:

var btn = $('#btn');
btn.click(function(){
    chart.optionsMarginTop += 20;
    chart.isDirtyBox = true; // this makes your chart redraw
    chart.redraw();
});

Demo


Solution 2:

This one worked for me:

const chart = $("#container").highcharts();
chart.options.chart.marginTop = 100;
chart.isDirtyBox = true;
chart.redraw();

Solution 3:

How about using Chart.update() function?

chart.update({
  chart: {
    marginTop: 30
  }
});

API Reference:
http://api.highcharts.com/highcharts/Chart.update http://api.highcharts.com/highcharts/chart.marginTop

Example:
http://jsfiddle.net/neo0xb2w/


Post a Comment for "Dynamically Modifying The HighChart Layout Options"