Hi,
I have a GChart that is inside of a Tab. SmartGWT 2.4, gchart client 2.6.
To get it to work at all, I did this:
where HeardChart is my chart (extends GChart) with a default size of 640x480.
What I want to do now is to have it automatically fill the entire tab. My first attempt to do this was to addResizeHandler() to the canvas and listen for events, and attempt to do a chart.setSize() based on the x, y of the event. The javadocs warn that this x, y might no tbe valid under certain circumstances, but no matter what, the size I get back is crazy, bigger than the actual screen.
My first thought was don't try to resize the chart if the canvas is dirty or the tab is not active.
Things are still behaving in crazy ways, though.
Anybody have any experience with this? Do I need to somehow put the chart inside of a gwt container rather than a smartgwt.client one, and sort of "wrap" the whole thing ?
--Chris
I have a GChart that is inside of a Tab. SmartGWT 2.4, gchart client 2.6.
To get it to work at all, I did this:
Code:
public class HeardTab extends Tab { final HeardHistChart chart = new HeardHistChart(); public HeardTab() { super("Heard"); this.addTabDeselectedHandler(new TabDeselectedHandler() { @Override public void onTabDeselected(TabDeselectedEvent event) { chart.setVisible(false); } }); this.addTabSelectedHandler(new TabSelectedHandler() { @Override public void onTabSelected(TabSelectedEvent event) { chart.setVisible(true); if (!chart.hasData()) { chart.getData(); } } }); final Canvas c = new Canvas(); c.addChild(chart); setPane(c); } }
What I want to do now is to have it automatically fill the entire tab. My first attempt to do this was to addResizeHandler() to the canvas and listen for events, and attempt to do a chart.setSize() based on the x, y of the event. The javadocs warn that this x, y might no tbe valid under certain circumstances, but no matter what, the size I get back is crazy, bigger than the actual screen.
My first thought was don't try to resize the chart if the canvas is dirty or the tab is not active.
Things are still behaving in crazy ways, though.
Anybody have any experience with this? Do I need to somehow put the chart inside of a gwt container rather than a smartgwt.client one, and sort of "wrap" the whole thing ?
--Chris