PDA

View Full Version : Charts not showing up in IE



RJAIN
20 Feb 2009, 7:06 AM
I have a requirement of generating dynamic line charts in my application done in GWT. I have successfully implemented it and it works great on safari, firefox and of course, GWT hosted mode. However, in IE (both 7 & 8), it does not work. It does bring up a flash placeholder but does not display anything.

It would be great if someone could help me with this - else I will have to start looking at building charts from the scratch.

GWT 1.5.3
GWT Ext 2.0.5
Adobe Flash 10
IE 7 & 8

Note: I do see the charts getting rendered if I include the chart panel in Viewport [new Viewport(panel)], but that doesn't solve my purpose as I want the charts to show inside another panel in my application.

Any kind of help will be greatly appreciated.

Thank you.

20 Feb 2009, 7:37 AM
RJAIN, can you please post your code?

RJAIN
20 Feb 2009, 9:11 AM
Yes, appreciate your response.

This is the class generating the line charts:


import com.gwtext.client.data.ArrayReader;
import com.gwtext.client.data.FieldDef;
import com.gwtext.client.data.FloatFieldDef;
import com.gwtext.client.data.MemoryProxy;
import com.gwtext.client.data.RecordDef;
import com.gwtext.client.data.Store;
import com.gwtext.client.data.StringFieldDef;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.chart.yui.LineChart;
import com.gwtext.client.widgets.chart.yui.NumericAxis;
import com.gwtext.client.widgets.chart.yui.SeriesDefY;

public class GraphPanelFactory{
private static GraphPanelFactory graphPanelFactory;

private GraphPanelFactory(){}

public static GraphPanelFactory singleton(){
if(graphPanelFactory == null){
graphPanelFactory = new GraphPanelFactory();
}
return graphPanelFactory;
}

public Panel getViewPanel(Object[][] data, int size) {

Panel vPanel = new Panel();
//vPanel.setLayout(new VerticalLayout(15));

MemoryProxy proxy = new MemoryProxy(data);

FieldDef[] fieldDef = new FieldDef[size + 1];
fieldDef[0] = new StringFieldDef("month");
for (int t = 1; t < size + 1; t++) {
fieldDef[t] = new FloatFieldDef("lab" + (t - 1));
}

SeriesDefY[] yAxis = new SeriesDefY[size];
for (int k = 0; k < size; k++) {
yAxis[k] = new SeriesDefY("Lab" + k, "lab" + k);
}

RecordDef recordDef = new RecordDef(fieldDef);

ArrayReader reader = new ArrayReader(recordDef);
final Store store = new Store(proxy, reader);

store.load();

SeriesDefY[] seriesDef = yAxis;

NumericAxis currencyAxis = new NumericAxis();
currencyAxis.setMinimum(0);
final LineChart chart = new LineChart();
chart.setWMode("transparent");
chart.setStore(store);
chart.setSeries(seriesDef);
chart.setXField("month");
chart.setYAxis(currencyAxis);
chart.setDataTipFunction("getDataTipText");
chart.setExpressInstall("js/yui/assets/expressinstall.swf");
chart.setWidth(500);
chart.setHeight(400);

vPanel.add(chart);

return vPanel;

}

}

And following are the lines of code from the calling class:

...............
resultsHPanel.add(resultValuesVPanel);
resultsHPanel.add(GraphPanelFactory.singleton().getViewPanel(labData, 1))
.................

where resultsHPanel is a HorizontalPanel, which gets added to another VerticalPanel.

Looking forward to hearing from you soon,
Thank you.