Resize div dashboard

118 views
Skip to first unread message

Peetzer

unread,
May 11, 2012, 8:02:03 AM5/11/12
to google-visua...@googlegroups.com
Hi, I wonder how the internal resize works.
I know in my application when a resize event occurs. Initially I calculate the width and height on the available parent div and give this as options to my ChartWrapper controls on my dashboard.
 
After resize I call dashboard draw but my controls are not resized (only redrawn). Should I set in my options the width to 100% or should I set the options again based on the new (calculated) size of the parent div?
 
BR,
 
Peter
 
This is how the options look of my ChartWrapper type areaChart,
 

function getChartOptions (chartType, containerId, hAxisLabel, vAxisLabel, format, percentageHeight, percentageWidth) {

var calcedHeight = Math.round((this.parentDiv.clientHeight / 100) * percentageHeight);

var calcedWidth = Math.round((this.parentDiv.clientWidth / 100) * percentageWidth);

return {

'chartType': chartType,

'containerId': containerId,

'options': {

'height': calcedHeight,

'width': calcedWidth,

'series': { 0:{color: '#2b6bae', visibleInLegend: true, pointSize: 3},

1:{color: '#69aa51', visibleInLegend: true, pointSize: 3}},

'title': '',

'vAxis': {

'title': vAxisLabel,

'titleTextStyle': {color: '#666666'} },

'format': '#.##',

'hAxis': {

'gridlines': {'color': 'transparent'},

'slantedText': 'true',

'slantedTextAngle': '90',

'title': hAxisLabel,

'format': format,

'titleTextStyle': {color: '#666666'} },

'legend': {position:'bottom'},

'chartArea': {top: 10, right: 0, bottom: 0}

}};

}

asgallant

unread,
May 11, 2012, 9:25:18 AM5/11/12
to google-visua...@googlegroups.com
If you set widths to a percentage, then the controls and charts should auto-resize when you call the Dashboard#draw() method.

Also, if you are using that code to return the options for a ControlWrapper, then you should be seeing some errors, as the option parameters you return will only work for ChartWrappers.
Reply all
Reply to author
Forward
0 new messages