Skip to main content

jMaki & GWT TabPanel

3 replies [Last post]
summitx
Offline
Joined: 2008-05-14
Points: 0

Greetings, I am new to jMaki and GWT. I successfully implemented a jMaki example but notice that if I add the chart to a tab that is not the one initially selected I get an exception. Is this by design or am I doing something incorrectly? Thx

public class TestHarnessMainPanel
extends VerticalPanel {

public TestHarnessMainPanel() {
TabPanel tp = new TabPanel();
HorizontalPanel hp = new HorizontalPanel();

String[] labels = {"May", "June", "July", "August"};

// A pie chart only has 1 axis
Axes axes = new Axes(new Axis(labels));

// create an instance of the piechart
final PieChart pc = new PieChart(400, 400, axes, PieChart.GREEN);

double[] points = {250, 35, 435, 15};
DataSet ds = new DataSet("prices", "Some prices", points);
pc.setDataSet(ds);

hp.add(pc);
tp.add(hp, new HTML("Charting Example"));
tp.add(new Label("Content for second tab"), new HTML("Another Tab"));

// this works
tp.selectTab(0);

// this does not work
//tp.selectTab(1);

add(tp);
}
}

Exception thrown when using option 2

Error loading jmaki.widgets.jmaki.charting.pie.Widget : id=jmaki_chart_0
Script: http://localhost/TestHarness/com.ghx.testharness.TestHarness/TestHarness... (line: 158).
Message: Invalid argument.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
summitx
Offline
Joined: 2008-05-14
Points: 0

It seems it works if I hold off on drawing the chart until the tab is selected as noted with the onTabSelected() method. Once drawn I can switch back and forth to other tabs but the initial drawing of the chart has to be done only on a tab that is currently selected.

carlavmott
Offline
Joined: 2005-02-10
Points: 0

Which toolkit are you using? Some of the toolkits will only render if the container where the widget goes is visible at page load. Lazyload set to true will force the widget to load when that container is made visible. This is expected behavior.

Carla

jeanbaptiste
Offline
Joined: 2008-05-02
Points: 0

Hi,

I have the same problem with a triggered displayed window which contains my chart. I obtain the same error.

What is this LazyLoading option ? Where can i handle it ? I don't find it in JavaDoc from jMaki or GWT-Ext which is the toolkit that i use for my window.

Thanks for your answer.