jquery - change marginLeft and marginRight from a javascript statment using highcharts -
using highcharts, how can alter chart marginleft , marginright , redraw javascript statement. need re-adjust chart margin in places in code.
http://jsfiddle.net/ovh9dwqc/
i tried like:
test = $('#container').highcharts(); test.margin[4] = 50; test.redraw();
but didn't work.
in general it's not supported, little hacky way it:
//javascript code alter left , right margin test = $('#container').highcharts(); $.each(test.axes, function(i, e) { e.isdirty = true; }); test.margin[1] = 50; test.redraw();
first: it's margin[1], not margin[4]. margins are: 0-top, 1-right, 2-bottom, 3-left. in css.
then need inform highcharts axes needs redrawn, setting of them isdirty
flag true.
we utilize test.xaxis[0].update()
instead test.redraw()
. forcefulness axes reflow.
live demo: http://jsfiddle.net/ovh9dwqc/1/
javascript jquery highcharts
No comments:
Post a Comment