The title of this post is not right but I cannot edit it or delete it sorry.
When you open a chart inside the center zone of a DockLayoutPanel (inside a RootLayoutPanel), the first time the chart is rendered (possibly during onModuleLoad) the chart does not have the right height/width. The chart take the size of the RootLayoutPanel not the size of the center zone.
When you resize the browser window, the chart resizes correctly. Does anyone knows how to fix this ?
@Override
public void onModuleLoad()
{
RootLayoutPanel rootPanel = RootLayoutPanel.get();
Chart chart = createChart();
chart.setWidth100();
chart.setHeight100();
DockLayoutPanel dock1 = new DockLayoutPanel(Unit.PX);
SimpleLayoutPanel slp1 = new SimpleLayoutPanel();
slp1.getElement().getStyle().setBackgroundColor("blue");
SimpleLayoutPanel slp2 = new SimpleLayoutPanel();
slp2.getElement().getStyle().setBackgroundColor("yellow");
SimpleLayoutPanel slp3 = new SimpleLayoutPanel();
slp3.getElement().getStyle().setBackgroundColor("red");
SimpleLayoutPanel slp4 = new SimpleLayoutPanel();
slp4.getElement().getStyle().setBackgroundColor("green");
dock1.addNorth(slp1, 50);
// dock1.addSouth(slp3, 50);
dock1.addWest(slp2, 50);
// dock1.addEast(slp4, 50);
dock1.add(chart);
rootPanel.add(dock1);
}
The title of this post is not right but I cannot edit it or delete it sorry.
When you open a chart inside the center zone of a DockLayoutPanel (inside a RootLayoutPanel), the first time the chart is rendered (possibly during onModuleLoad) the chart does not have the right height/width. The chart take the size of the RootLayoutPanel not the size of the center zone.
When you resize the browser window, the chart resizes correctly. Does anyone knows how to fix this ?
Github project example : https://github.com/mycom-int/gwthighcharts
Created the same question in stackoverflow http://stackoverflow.com/questions/19807079/gwt-highcharts-auto-resize-width-and-height-in-layout-panel
Last edit: Ronan Quillevere 2013-11-06
The only sloution I found so far is to use a scheduler after the dock is added to rootpanel
Thank you! I've been experiencing the same problem 18 months later.