大家好:
想問用fusionchart想畫出2條折線圖
但我卻只能畫一條,第2條就會讓頁面變空白....不然就是A線接B線後面畫下去...
以下是程式碼:
<%
String pro[]={"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月","total"};
double proform[]=new double [13];
double proformt[]=new double [13];
for(int i=0;i<proform.length;i++){proform[i]=i*10;}
for(int i=0;i<proformt.length;i++){proformt[i]=i*10+10;}
%>
<%
String chartXML = "<chart __attributes__>__set__</chart>";
String chartXML1 = "<chart __attributes__>__set__</chart>";
String attributeTemplate = "__key__=\"__value__\" ";
String setXMLTemplate = "<set label=\"__label__\" value=\"__value__\" />";
String setXMLTemplate1 = "<set label=\"__label__\" value=\"__value__\" />";
Map<String, String> dataobj = new HashMap<String, String>();
for(int i=0;i<pro.length;i++){dataobj.put(pro[i] ,Double.toString(proform[i]));}
for(int i=0;i<pro.length;i++){dataobj.put(pro[i] ,Double.toString(proformt[i]));}
ArrayList<String> setList = new ArrayList<String>();
for(int i=0;i<pro.length-1;i++)
{
String tempSetTemplate = setXMLTemplate;
tempSetTemplate = tempSetTemplate.replaceAll("__label__", pro[i]);
tempSetTemplate = tempSetTemplate.replaceAll("__value__", Double.toString(proform[i]));
setList.add(tempSetTemplate);
}
for(int i=0;i<pro.length-1;i++)
{
String tempSetTemplate = setXMLTemplate1;
tempSetTemplate = setXMLTemplate1.replaceAll("__label__", pro[i]);
tempSetTemplate = setXMLTemplate1.replaceAll("__value__", Double.toString(proformt[i]));
setList.add(tempSetTemplate);
}
StringBuilder chartAttributeString = new StringBuilder();
StringBuilder setAttributeString = new StringBuilder();
for(String s: setList)
setAttributeString.append(s);
chartXML = chartXML.replaceAll("__attributes__", chartAttributeString.toString());
chartXML = chartXML.replaceAll("__set__", setAttributeString.toString());
chartXML1 = chartXML1.replaceAll("__attributes__", chartAttributeString.toString());
chartXML1 = chartXML1.replaceAll("__set__", setAttributeString.toString());
FusionCharts1 columnChart= new FusionCharts1(
"line",// chartType pie2d bar2d column2d gantt line pie2d
"chart1",// chartId
"800","500",// chartWidth, chartHeight
"chart",// chartContainer
"xml",// dataFormat
chartXML,//dataSource
chartXML1
);
%>
我都在FusionCharts1中多加一個參數dataSource1了,但為何還是不行呢??