I'm trying to add an annotated time line to a disclosure panel but I
get the following error:
[ERROR] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (Error):
number: 0
description:
at
com.google.gwt.visualization.client.visualizations.Visualization.draw
(Native Method)
at
com.google.gwt.visualization.client.visualizations.Visualization.onLoad
(Visualization.java:116)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:264)
at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:
165)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:259)
at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:
165)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:259)
at com.google.gwt.user.client.ui.Panel.doAttachChildren(Panel.java:
165)
at com.google.gwt.user.client.ui.Widget.onAttach(Widget.java:259)
at com.google.gwt.user.client.ui.Composite.onAttach(Composite.java:
102)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:393)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:119)
at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:
86)
at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:
80)
at edu.sccoos.gwt.piers.client.PiersGWT$1.run(PiersGWT.java:76)
at com.google.gwt.ajaxloader.client.ExceptionHelper.runProtected
(ExceptionHelper.java:36)
Here is my code:
package edu.sccoos.gwt.piers.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.visualization.client.AbstractDataTable;
import com.google.gwt.visualization.client.DataTable;
import
com.google.gwt.visualization.client.AbstractDataTable.ColumnType;
import com.google.gwt.visualization.client.VisualizationUtils;
import
com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine;
import
com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine.AnnotatedLegendPosition;
import
com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine.Options;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class PiersGWT implements EntryPoint {
/**
* The message displayed to the user when the server cannot be
reached or
* returns an error.
*/
private static final String SERVER_ERROR = "An error occurred while "
+ "attempting to contact the server. Please check your
network "
+ "connection and try again.";
/**
* This is the entry point method.
*/
public void onModuleLoad() {
Runnable onLoadCallback = new Runnable(){
public void run(){
final DisclosurePanel viewPlots = new
DisclosurePanel("Click to
view plots");
final VerticalPanel plotPanels = new
VerticalPanel();
final ListBox metsList = new ListBox();
metsList.addItem("Water Temperature","1");
metsList.addItem("Chlorophyll","2");
metsList.addItem("Water Pressure","3");
plotPanels.add(metsList);
final AnnotatedTimeLine myplot = new
AnnotatedTimeLine(createTable
(), createOptions(), "400","300");
plotPanels.add(myplot);
viewPlots.setAnimationEnabled(true);
viewPlots.setContent(plotPanels);
// Add the nameField and sendButton to the
RootPanel
// Use RootPanel.get() to get the entire body
element
RootPanel.get("waterform").add(viewPlots);
}
};
// Load the visualization api, passing the onLoadCallback to be
called
// when loading is done
VisualizationUtils.loadVisualizationApi(onLoadCallback,
AnnotatedTimeLine.PACKAGE);
//VisualizationUtils.loadVisualizationApi(onLoadCallback,
PieChart.PACKAGE);
}
private AbstractDataTable createTable(){
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING,"Iterator");
data.addColumn(ColumnType.NUMBER, "degrees");
data.addRows(2);
data.setValue(0,0,"1");
data.setValue(0,1,10);
data.setValue(1,0,"2");
data.setValue(1,1,15);
return data;
}
private Options createOptions(){
Options options = Options.create();
options.setAllowHtml(true);
//options.setLegendPosition(AnnotatedLegendPosition.NEW_ROW);
return options;
}
}
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<link type="text/css" rel="stylesheet" href="PiersGWT.css">
<title>Web Application Starter Project</title>
<script type="text/javascript" language="javascript" src="piersgwt/
piersgwt.nocache.js"></script>
</head>
<body>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position:absolute;width:0;height:0;border:0"></iframe>
<h1>Piers Test</h1>
<div class="rightData">
<div id="waterform" class="plots">
<div id="chart_met_1" class="plot" />
<div id="chart_met_2" class="plot" />
<div id="chart_met_3" class="plot" />
</div>
</div>
</body>
</html>
Upon debugging, it seems that the issue is with RootPanel.get
("waterform").add(viewPlots), however, i have not been able to figure
out why it's erroring out.
If I use the PieChart it works fine, just not with the annotated time
line.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---