PDA

View Full Version : Chart Not rendered in IE



wujekleon
10 Sep 2009, 6:43 AM
Hi all,

I'm now makeing a POC on GXT Charts. I copied most of the code from one of the samples into my GWT project.

If I open the page in FireFox it shows up and looks as expected, but when I ran it in hosted mode (IE is my host mode browser) or directly in IE the chart does not show up :(. Instead of the chart I see a frame with the size of the chart, which contains two frames.

Frames contain following messages:


Open Flash Chart IO ERROR Loading test data Error #2032
This is the URL that I tried to open:../../data-files/shape.txt


I use GWT 1.7 and GXT 2.0.1 in Eclipse 3.4 using JDK 1.5.0_11-b03 on a Windows Vista.

Here is the HTML I use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Web Application Starter Project</title>
<script language="javascript" src="swfobject.js"></script>
<link type="text/css" rel="stylesheet" href="formEdit.css">
<link rel="stylesheet" type="text/css" href="resources/css/gxt-all.css" />
</head>
<body>
<div id="stats"></div>
<script type="text/javascript" language="javascript"
src="statistics/statistics.nocache.js"></script>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
style="position: absolute; width: 0; height: 0; border: 0" />
</html>Here is the nethod which adds the chart to the layoutcontainer;



private static final String URL = "open-flash-chart.swf";

protected void createMatrixChart(LayoutContainer lc, MatrixStatistic matrixStatistic) {
ChartModel cm = new ChartModel("Sales by Region",
"font-size: 14px; font-family: Verdana; text-align: center;");
cm.setBackgroundColour("#fffff5");
Legend lg = new Legend(Position.RIGHT, true);
lg.setPadding(10);
cm.setLegend(lg);

PieChart pie = new PieChart();
pie.setAlpha(0.5f);
pie.setNoLabels(true);
pie.setTooltip("#label# $#val#M<br>#percent#");
pie.setColours("#ff0000", "#00aa00", "#0000ff", "#ff9900", "#ff00ff");
pie.addSlices(new PieChart.Slice(100, "AU", "Australia"));
pie.addSlices(new PieChart.Slice(200, "US", "USA"));
pie.addSlices(new PieChart.Slice(150, "JP", "Japan"));
pie.addSlices(new PieChart.Slice(120, "DE", "Germany"));
pie.addSlices(new PieChart.Slice(60, "UK", "United Kingdom"));

cm.addChartConfig(pie);
final Chart chart = new Chart(URL);
chart.setBorders(true);
chart.setChartModel(cm);
chart.setWidth(SIZE);
chart.setHeight(SIZE);
lc.add(chart);
lc.layout();
}Needed files are in correct locations (or maybe I am wrong):



swfobject.js - is in the same dir as html file. Although it should not make a big difference, I tried to locate 'swfobject.js' in resources/chart/ :-?.
open-flash-chart.swf - is in the same dir (I tried different locations I also tried to pass exact URLS e.g. 'http://localhost:8080/open-flash-chart.swf')


I know it can work under IE, cause when I deploy samples.war on my tomcat, charts work correctly in all browsers.

Hope someone has hit the same wall as I did and it is solvable :((

Thanks
Mathew

hsulos
18 Dec 2009, 10:40 PM
I have the same exact problem, can someone help please?

szafir
11 Jan 2010, 10:46 AM
Same problem as above in IE 8, GWT 1.7, Gxt 2.0.1

ronbreizh
26 Mar 2010, 2:28 AM
does someone have a solution for this problem ?
Thanks

szafir
26 Mar 2010, 5:48 AM
Upgrding to GXT 2.0.1 solves that problem

szafir
26 Mar 2010, 5:49 AM
Sorry I mean GXT 2.1

hsulos
5 Apr 2010, 12:45 PM
I am already on GXT 2.1 and still have the same issue on IE.

Gildas
8 Apr 2010, 6:27 AM
Hi !

I had the same problem: it work ok with FF but not with IE : JavaScript error.

The solution is to completely recreate the chart when you want to display it, and not only change the data model:


public void dataChange(ChartModel model){
layoutContainer.removeAll();
layoutContainer.setLayout(new FitLayout());

Chart chart = new Chart(url);
chart.setHeight(250); // important for IE... not work with layoutContainer.setHeight(250);
chart.setBorders(true);
chart.setChartModel(model);

layoutContainer.add(chart);

this.layout(true);
}

( GWT 2.0.3 GXT 2.1.1 )

Gildas

sven
8 Apr 2010, 6:30 AM
Can someone please provide a fully working testcase that implements EntryPoint and is failling?

hsulos
9 Apr 2010, 10:07 AM
Thanks Gildas, your solution works great!

semper
28 May 2010, 1:40 PM
Have the same problem. When I finally made IE to just load the swf, it says:

Open Flash Chart
IO ERROR
Loading test data
Error #2032

This is the URL that I tried to open:../../data-files/shape.txt

And there really is request to the txt file which returns 404. However, in every other browser there seems to be NO request to .txt at all, and everything is working.

Here is the example of code:


view.getHistogramByBlockingsButton().addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent event) {
untoggleAllButtons();
view.getHistogramByBlockingsButton().toggle(true);

String url = GXT.isIE ? "../../" : "";
url += "ext/chart/open-flash-chart.swf";

Chart chart = new Chart(url);
chart.setBorders(false);
chart.setHeight(325);

ChartModel cm = new ChartModel();
cm.setBackgroundColour(WHITE);

XAxis xa = new XAxis();
// SMS (шт) MMS (шт)
xa.setLabels("Активные номера", "Заблокированные номера");
xa.setStroke(0);
xa.setOffset(true);
xa.setColour(GRAY);
xa.setGridColour(WHITE);
cm.setXAxis(xa);

YAxis ya = new YAxis();
ya.setSteps(16);
ya.setMax(100);
ya.setColour(GRAY);
ya.setGridColour(LIGHT_GRAY);
cm.setYAxis(ya);

FilledBarChart bchart = new FilledBarChart();
bchart.setTooltip("#val# шт.");
bchart.addBars(new BarChart.Bar(Random.nextInt(10) + 80, COLOR2));
bchart.addBars(new BarChart.Bar(Random.nextInt(20) + 10, COLOR1));
cm.addChartConfig(bchart);

chart.setChartModel(cm);

// gather stuff
LayoutContainer chartPanel = view.buildChartPanel();

chartPanel.add(new Text("<h2 style='font-size:15px;padding:5px'>Stats</h2>"));
chartPanel.add(chart);

chartPanel.setHeight(360);
view.setPresentation(chartPanel);
view.getWindow().sync(true);
}
});

Jogilein
9 May 2011, 1:16 AM
Hi,

just wanted to add that I had the same problem with GWT 2.0.3 and GXT 2.2.1. The solution was also the same, remove the chart from the panel and add a new one! Do not forget to call layout() afterwards ;)

dhruv88esh
19 May 2011, 11:22 PM
Thanks Gildas..

chart.setHeight(250); works great !!!

Now, charts are working in firefox also..

arbi
22 Sep 2013, 9:38 AM
Got it sorted out as well, thanks.

arbi
22 Sep 2013, 9:45 AM
Anyone got this one?