Highcharts redraw diagrams
Typically, highcharts graphics are automatically redrawn when the browser window is changed, but sometimes you need to forcefully redraw graph.
Intuition suggests you need to use .redraw()
method, but, alas, it probably will not work (as it happended with me). For example, I had to redraw diagram after minimizing of left menu bar. When the menu collapses or unfolds, then width of div changes, and it need to automatically adjust the graphics to new width.
To redraw the highcharts diagrams, use .reflow()
method:
$('..close').on('click.chart', function () { // add click event on minimize menu button
var $sb_chart = $('.sb_chart');
$.each($sb_chart, function () { // if there are several graphics
var chart = $(this).highcharts();
chart.reflow();
});
})
Rate this article
5 from 5 (total 1 rating)
You can send feedback, suggestions or comments on this article using this form:
After clicking the "Send" button, your message will be delivered to me on the mail.
Artem Maltsev
Web-developer, having the knowlenge of programming language - Python, framework - Django, content management system - Django CMS, platform of e-commerce site - Django Shop and many other applications, using this technologies.
The right to use content on this page https://vivazzi.pro/it/redraw-highcharts/:
Permission is granted to copy an content with its author and reference to the original without using the parameter rel="nofollow"
in tag <a>
. Usage:
Author of Article: Artem Maltsev
Link to article: <a href="https://vivazzi.pro/it/redraw-highcharts/">https://vivazzi.pro/it/redraw-highcharts/</a>
More: Terms of site usage
Comments: 0