I noticed jqCharts make use of the entire space available in horizontal direction, but do not stretch all the way vertical direction; the chart is usually 250px high. Also, charts don't seem to resize themselves when I resize the browser window.
Why is that ? Do I have to enable that somewhere ? Could not find anything about resizing at all in the documentation...
I have created some kind of crude workaround:
Code:// make jqChart use entire vertical space
$(document).ready(function(){
$('#chart').attr('style', 'height: ' + window.innerHeight + 'px');
});
// resize the chart canvas when the browser window is resized
$(window).resize(function(){
var style_string = 'width: ' + window.innerWidth + 'px; height: ' + window.innerHeight + 'px';
$('#chart > canvas').attr('style', style_string);
});
This basically works, but it seems that instead of (or in addition to) resizing the chart
canvas, the chart
itself should be redrawn, so fonts, labels, axis intervals, etc. are adapted to the new size: When I e.g. resize the browser window from very large to very small, axis labels get so small they are barely legible. When I reload the page then, they're shown ok and also the intervals get updated.
Is there a way to explicitely trigger a chart redraw ?
I tried storing the jqChart object in a global variable to make it available in a resize handler and then call the chart update function with the data the chart already has, but I can't seem to get the data out of a chart:
Code:var data = g_chart.data();
updateChart(data); // <-- doesn't work, data is not a simple array
Is chart auto-resize (and auto-redraw) somewhere on the product roadmap / todo list ?
Is there any workaround I can implement myself ?