I have a div element in gsp win which I am rendering a template containing highchart code.
<div class="panel-body pan-bod col-md-12" id="container1">
<g:render template="${resource(dir:'folder', file:'growthYTDBar')}"></g:render>
</div>
Following is the highchart code in template:
<script>
var zip= ${zip};
var zipcount=${zipcount};
$(function () {
$('#container1').highcharts({
chart: {
type: 'column'
events:{
load: chart.redraw();}
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: zip,
crosshair: true
},
yAxis: {
min: 0,
title: {
text: ''
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} </b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: [{
name: '',
data: zipcount
}]
});
});
</script>
When I load the main page (from where the template is being rendered) the highchart graph overflows. Upon a single-click/resizing/any activity on the page, it falls back to size. This probably is an issue with redraw. The chart is not able to redraw itself completely, so can it be called manually? That too on document.ready of the main page? Any other help?