http://blog.youkuaiyun.com/arjick/article/details/6702268
这篇文章主要教大家如何实用SunshineCharts 的仪表盘。
注意:大小固定为200*250
仪表盘数据xml:
<?xml version="1.0" encoding="UTF-8"?>
<data title="123" autoRefreshPolicy="on" autoRefreshTime="180" debug="off"
backGroudColor="0xffffff" value="50" />
data
debug:是否开启调试模式
showDataTips:饼图是否显示快速提示
legend:是否显示图例:
autoRefreshPolicy:是否启动自动刷新
labelPosition:块石提示位置
title:标题
showAllDataTips:是否显示所有提示
clickType:点击饼图效果
backGroudColor:底色
value:仪表盘
HTML嵌入模式(大小固定为200*250):
html源代码
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="200" height="250" id="dashboardChart">
<param name="movie" value="SunshineCharts.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name="flashvars"
value="type=dashboardChart&dataUrl=xml/DashboardChartXml.xml&cleanCache=off" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash"
data="SunshineCharts.swf" width="200" height="250">
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name="flashvars"
value="type=type=dashboardChart&dataUrl=xml/DashboardChartXml.xml&cleanCache=off" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe
Flash Player version 10.0.0 or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer"> <img
src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash Player" /> </a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</body>
Tag嵌入代码:
暂时无
JAVA代码:
package com.shine.framework.Charts.cofferCharts.DashboardChart;
public class DashboardChartsExample {
public static void main(String[] args) {
DashboardChartsHelper da=new DashboardChartsHelper();
da.setTitle("neichun");
da.setAutoRefreshPolicy("on");
da.setAutoRefreshTime("180");
da.setDebug("off");
da.setBackGroudColor("0xffffff");
da.setValue("80");
System.out.println(da.getDataXml());
// <?xml version="1.0" encoding="UTF-8"?>
// <data title="123" autoRefreshPolicy="on" autoRefreshTime="180" debug="off"
// backGroudColor="0xffffff" value="50" />
}
}
package com.shine.framework.Charts.cofferCharts.DashboardChart;
import java.util.ArrayList;
import java.util.List;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import com.shine.framework.Charts.cofferCharts.ColumnsCharts.Colunms;
import com.shine.framework.core.util.XmlUitl;
public class DashboardChartsHelper {
private String title = "";
private String autoRefreshPolicy = "on";
private String autoRefreshTime = "180";
private String debug = "off";
private String backGroudColor = "0xffffff";
private String value="";
/**
* 输出xml数据
*
* @return
*/
public String getDataXml() {
Document document = DocumentHelper.createDocument();
Element dataElement = document.addElement("data");
dataElement.addAttribute("title", title);
dataElement.addAttribute("autoRefreshPolicy", autoRefreshPolicy);
dataElement.addAttribute("autoRefreshTime", autoRefreshTime);
dataElement.addAttribute("debug", debug);
dataElement.addAttribute("backGroudColor", backGroudColor);
dataElement.addAttribute("value",value);
return XmlUitl.doc2String(document);
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAutoRefreshPolicy() {
return autoRefreshPolicy;
}
public void setAutoRefreshPolicy(String autoRefreshPolicy) {
this.autoRefreshPolicy = autoRefreshPolicy;
}
public String getAutoRefreshTime() {
return autoRefreshTime;
}
public void setAutoRefreshTime(String autoRefreshTime) {
this.autoRefreshTime = autoRefreshTime;
}
public String getDebug() {
return debug;
}
public void setDebug(String debug) {
this.debug = debug;
}
public String getBackGroudColor() {
return backGroudColor;
}
public void setBackGroudColor(String backGroudColor) {
this.backGroudColor = backGroudColor;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
效果图: