Gwt FusionCharts简单demo

阅读更多

 

package com.appdev.test.client;

 

import com.google.gwt.core.client.EntryPoint;

import com.smartgwt.client.types.Overflow;

import com.smartgwt.client.widgets.layout.HLayout;

import com.smartgwt.client.widgets.layout.VLayout;

 

/**

*EntryPoint 

*/

public class Chart implements EntryPoint {

private VLayout panel;

 

@Override

public void onModuleLoad() {

// TODO Auto-generated method stub

panel = new VLayout();

panel.setSize("900", "700");

panel.setStyleName("crm-ContextArea");

 

panel.setOverflow(Overflow.AUTO);

 

drawFusionCharts(panel);

 

}

 

private void drawFusionCharts(VLayout panel) {

 

FusionChart chart1 = new FusionChart("FCF_Area2D.swf", "400", "350", "Area2D.xml");

 

FusionChart chart2 = new FusionChart("FCF_StackedBar2D.swf", "400","350", "StBar2D.xml");

FusionChart chart3 = new FusionChart("FCF_Doughnut2D.swf", "400", "350","Doughnut2D.xml");

FusionChart chart4 = new FusionChart("FCF_Funnel.swf", "350", "300","Funnel.xml");

 

HLayout northLayout = new HLayout();

northLayout.setHeight("50%");

northLayout.setBackgroundColor("#FFFFFF");

 

northLayout.addMember(chart1);

northLayout.addMember(chart2);

 

HLayout southLayout = new HLayout();

southLayout.setHeight("50%");

southLayout.setBackgroundColor("#FFFFFF");

 

southLayout.addMember(chart3);

southLayout.addMember(chart4);

 

panel.addMember(northLayout);

panel.addMember(southLayout);

panel.draw();

}

 

}



FusionChart类:

package com.appdev.test.client;

import java.util.HashMap;
import com.smartgwt.client.widgets.plugins.Flashlet;

public class FusionChart extends Flashlet {

private static int count = 0;

private String swfId;

public FusionChart(String src, String width, String height, String dataUrl) {
super();

setCodeBase("http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
setClassID("clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
setPluginsPage("http://www.macromedia.com/go/getflashplayer");
swfId = "fusionChartId_" + count;
++count;

setID(swfId);
setName(swfId);
setSrc("charts/fusioncharts/flash/" + src);
setSize(width, height);

HashMap hashMap = new HashMap();

hashMap.put("id", swfId);
hashMap.put("flashvars", "&id=" + swfId + "&chartWidth=" + width + "&chartHeight=" + height + "®isterWithJS=1"
+ "&debugMode=0" + "&dataURL=" + "charts/fusioncharts/data/" + dataUrl);
setParams(hashMap);

}
}

下载包放于war目录下:(.swf,FusionCharts.js)文件
  • charts.rar (447.8 KB)
  • 下载次数: 93

你可能感兴趣的:(Gwt FusionCharts简单demo)