PDA

View Full Version : Chart not visible



Tori
30 Jul 2009, 6:29 AM
Hi,
I'm relatively new to GWT and GXT and try to create a WebApp using the newly integated Charts (GXT). To see how it works, I copied most of the code from one of the samples into a new GWT project and ran it in hosted mode. However, I only see a horizontal line inside the chart box instead of the complete chart. There is no error shown neither in hosted mode nor in web mode; the swfobject.js is found the hosted mode log says.
I use GWT 1.7 and GXT 2.0.1 in Eclipse 3.4 using JDK 1.5.0_11-b03 on a Fedora 10 Linux box.
Please find attached the source code and configuration files; I excluded the GWT and GXT libs from the war directory as well the GXT resources in war/gxt. I start the hosted mode by using the ant build.xml script.
Any hints are very welcome.

Many Thanks, Tori

Tori
31 Jul 2009, 3:59 AM
Hi all,

I attached two screenshots. The first shows the output result whereas the second shows the web server log in hosted mode. The Chart is very simple and should look like the area chart in chart gallery example given on http://extjs.com/examples/pages/charts/gallery.html.

The code I used to create the chart is as follows:
------

package org.gwt.client;

import com.extjs.gxt.charts.client.Chart;
import com.extjs.gxt.charts.client.model.ChartModel;
import com.extjs.gxt.charts.client.model.axis.XAxis;
import com.extjs.gxt.charts.client.model.charts.AreaChart;
import com.extjs.gxt.ui.client.fx.Draggable;
import com.extjs.gxt.ui.client.fx.Resizable;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.google.gwt.user.client.Random;

public class ExampleChart {

private LayoutContainer container;

public ExampleChart() {
this.initUI();
}

public LayoutContainer getUI() {
return this.container;
}

private void initUI() {
this.container = new LayoutContainer();
this.container.setLayout(new FlowLayout(10));
this.container.add(this.getChart());
}

private FieldSet getChart() {
FieldSet fs = new FieldSet();
fs.setHeading("Chart");
fs.setLayout(new FlowLayout());
fs.setHeight(450);
fs.setWidth(1200);

String url = !ChartTest.isExplorer() ? "../../" : "";
url += "../gxt/chart/open-flash-chart.swf";

Chart chart = new Chart(url);
chart.setBorders(true);
chart.setChartModel(this.getChartModel(10));


new Draggable(chart);
new Resizable(chart);

fs.add(chart);//, new FitData(0, 0, 20, 0));

return fs;
}

public ChartModel getChartModel(int segments) {
ChartModel cm = new ChartModel("Growth per Region",
"font-size: 14px; font-family: Verdana;");
cm.setBackgroundColour("#ffffff");
XAxis xa = new XAxis();
xa.setLabels("J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D");
cm.setXAxis(xa);

AreaChart area1 = new AreaChart();
area1.setFillAlpha(0.3f);
area1.setColour("#ff0000");
area1.setFillColour("#ff0000");
for (int n = 0; n < 12; n++) {
if (n % 3 != 0)
area1.addNullValue();
else
area1.addValues(n * Random.nextDouble());
}
cm.addChartConfig(area1);
AreaChart area2 = new AreaChart();
area2.setFillAlpha(0.3f);
area2.setColour("#00aa00");
area2.setFillColour("#00aa00");
int floor = Random.nextInt(3);
double grade = (Random.nextInt(4) + 1) / 10.0;
for (int n = 0; n < 12; n++) {
if (n % 2 != 0)
area2.addNullValue();
else
area2.addValues(n * grade + floor);
}
cm.addChartConfig(area2);
return cm;

}
}
-----
Does anybody have an idea what's wrong with it?
Thanks for any help

Tori

lmivan
26 Aug 2009, 8:37 AM
Hello,

I have the same problem. I'm trying an example app and in hosted moded the pie chart is not displayed. But if I deploy the .war in my tomcat the chart is displayed correctly.

Have you tried to deploy your test application?. I think that there is a problem with the linux internal browser used in hosted mode.

Have you found a solution?.

Thanks and regards, Iván.

tplotzki
6 Jan 2010, 7:18 AM
This issue is a result of GXT using a flash chart, and because mozilla 1.7.12 or 1.7.13 that is distributed with Hosted Mode does not have the flash plugin. To solve this issue:

1) Download the plugin:
http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&P2_Platform=Intel&P3_Browser_Version=Netscape4&P5_Language=English

2) Extract to :
GWT_HOME/mozilla-1.7.XX/plugins

And then you should be good.

-Terrell

G.edwin
13 Aug 2010, 1:05 AM
Hi, I also need some help about that. My charts still invisible in hosted mode, by GWT_HOME what to you mean ?

tplotzki
13 Aug 2010, 6:14 AM
Sorry by GWT_HOME I mean the GWT-Linux directory Hosted Mode is using in it's classpath.