五、单序列XML形式
举例:
baseFont: 图表的字体
baseFontSize: 图表的字号
caption: 标题
subcaption: 子标题
yAxisMinValue: y轴的最小值
yAxisMaxValue: y轴的最大值
hovercapbg: 当鼠标悬停时显示的背景色
hovercapborder: 当鼠标悬停时边框色
formatNumber(0/1):是否用逗号分隔(1--用逗号分隔,0--不用)
formatNumberScale(0/1): 是否添加K、M到数字(1--添加,0--不添加)
decimalPrecision: 小数的位数
showValues(0/1): 是否显示数值
numdivlines: 水平网格线的条数
numVdivlines: 垂直网络线显示的条数
showNames(0/1): 是否显示x轴的每个数据的名称
rotateNames(0/1): 是否旋转x轴的每个数据的名称
rotateYAxisName(0/1):是否显示y轴的名称
showAlternateHGridColor(0/1): 是否显示交替的网格颜色
name: x轴的每个数据的名称
value: 值
有几种图可以使用单序列的XML格式的数据
(1)Pie图
FCF_Pie2D.swf FCF_Pie3D.swf
(2)Area图
FCF_Area2D.swf
(3)Bar图
FCF_Bar2D.swf
(4)Column图
FCF_Column2D.swf FCF_Column3D.swf
(5)Line图
FCF_Line.swf
(6)Doughnut图
FCF_Doughnut2D.swf
六、多序列XML形式
举例:
name:种类名
seriesname:序列的名称
有几种图可以使用多序列的XML格式的数据
(1)Area图
FCF_MSArea2D.swf
(2)Bar图
FCF_MSBar2D.swf
(3)Column图
FCF_MSColumn2D.swf FCF_MSColumn3D.swf
(4)Line图
FCF_MSLine.swf
(5)Stacked图
FCF_StackedArea2D.swf
FCF_StackedBar2D.swf
FCF_StackedColumn2D.swf FCF_StackedColumn3D.swf
七、产生上述XML的类
public class FusionChartsXMLGenerator { public static final int BOOLEAN_TRUE = 0; public static final int BOOLEAN_FALSE = 1; private static Logger LOGGER = LoggerFactory.getLogger(FusionChartsXMLGenerator.class); private static FusionChartsXMLGenerator singleton = new FusionChartsXMLGenerator(); public static FusionChartsXMLGenerator getInstance() { return singleton; } private FusionChartsXMLGenerator() {} private String[] colors = {"AFD8F8", "F6BD0F", "8BBA00", "FF8E46", "008E8E", "D64646", "8E468E", "588526", "B3AA00", "008ED6", "9D080D", "A186BE"}; /** * data形式为: * "" category1,category2,category3...-------->这是第一行 * type1 value1,value2,value3,... * type2 value1,value2,value3,... * ...... */ public String getMultiDSXML(List> data, String caption, String subCaption, String xAxisName, String yAxisName, int showNames,int showValues, int decimalPrecision, int rotateNames) { double max = -Double.MAX_VALUE, min = Double.MAX_VALUE; for (int i = 1; i < data.size(); i++) { List row = (List)data.get(i); for (int j = 1; j < row.size(); j++) { String val = (String)row.get(j); if (val != null && val.length() > 0) { double v = Double.parseDouble(val); if (v > max) { max = v; } if (v < min) { min = v; } } } } if (max == -Double.MAX_VALUE) { max = 0; } if (min == Double.MAX_VALUE) { min = 0; } if (min == max && min == 0) { min = 0; max = 100; } max = Math.abs(max / 10) + max; min = min - Math.abs(min / 10); int valCnt = ((List)data.get(0)).size() - 1; if (valCnt > 30) { showNames = 0; showValues = 0; } StringBuffer strXml = new StringBuffer(); strXml.append("
"); strXml.append(" "); String str = strXml.toString(); LOGGER.info("=============/n" + str + "/n==============/n"); return str; } /** * 数据格式为: * name value * name value * ...... */ public String getSingleDSXML(List"); List headerRow = (List)data.get(0); for (int i = 1; i < headerRow.size(); i++) { strXml.append(" "); for (int i = 1; i < data.size(); i++) { List row = (List)data.get(i); String name = (String)row.get(0); String color = colors[(i - 1) % 12]; strXml.append(""); } strXml.append(" "); for (int j = 1; j < row.size(); j++) { strXml.append(" "); } strXml.append(""); } strXml.append(" > data, String caption, String subCaption, String xAxisName, String yAxisName, int showNames,int showValues, int decimalPrecision, int rotateNames) { double max = -Double.MAX_VALUE, min = Double.MAX_VALUE; for (int i = 0; i < data.size(); i++) { List
row = data.get(i); double value = Double.parseDouble(row.get(1)); if (value > max) { max = value; } if (value < min) { min = value; } } if (max == -Double.MAX_VALUE) { max = 0; } if (min == Double.MAX_VALUE) { min = 0; } if (min == max && min == 0) { min = 0; max = 100; } max = Math.abs(max / 10) + max; min = min - Math.abs(min / 10); int valCnt = data.size() - 1; if (valCnt > 30) { showNames = 0; showValues = 0; } StringBuffer strXml = new StringBuffer(); strXml.append(" "); for (int i = 0; i < data.size(); i++) { List "); String str = strXml.toString(); LOGGER.info("=============/n" + str + "/n==============/n"); return str; } }row = data.get(i); String label = row.get(0); String value = row.get(1); String color = colors[i % 12]; strXml.append(" "); } strXml.append("