多系列没有问题,但单系列显示不出来,估计是后台代码某个地方错误,没看出来,求各位帅哥美女指教! public String getColumnSummaryData(){ try { //chartItem 里面放的是参数格式设置,如y轴最大值等 JSONObject chartItem = ChartData.getChartItem(); JSONArray dataArray = new JSONArray(); List<TrialCountSummaryInfo> list = trialCountService.findAmountCount(countSelectInfo, isPie); int accountType = countSelectInfo.getAccountType(); if(list != null){ int colorCount = 0; for(TrialCountSummaryInfo tc :list){ JSONObject data = new JSONObject(); if(accountType == 8){ //值 data.put("value", tc.gethTime()); }else{ data.put("value", tc.getCount()); } data.put("label", tc.getName()); //重复使用颜色 if(colorCount >= ChartData.colors.length){ colorCount = 0; } data.put("color", ChartData.colors[colorCount]); dataArray.put(data); StringBuffer sb = new StringBuffer(); sb.append("{"chart":"); sb.append(chartItem.toString()); sb.append(","data":"); sb.append(dataArray.toString()); sb.append("}"); result.getData().put("chartData", sb.toString()); result.setResult("ok"); } } 前台主要代码: myColumnChart = new FusionCharts("../js/FusionCharts/MSColumn3D.swf", "myChartId", "100%", "100%","0","1"); myColumnChart.configure( "ChartNoDataText", "请选择条件进行统计"); myColumnChart.configure( "InvalidXMLText", "数据无效"); myColumnChart.configure( "ParsingDataText", "正在加载数据,请稍候"); JSON成功后 success:function(response){ var res = eval(""("" + response + "")""); if(res.result == "ok"){ var data = eval(""("" + res.data.chartData + "")""); myColumnChart.setJSONData(data); $(""#columnMask"").hide(); $(""#searchBtn"").btnUI(""enable"",""smallBtn""); $(""#exportBtn"").btnUI(""enable"",""smallBtn""); } |
|
50分 |
这个只能靠自己找了,我以前都是把生成的json数据打出来,先看json数据有问题吗,没有的话再跟相同图形且能够正常显示的json数据比,就容易看出来了
|
50分 |
前台打个断点,看看后台返回的数据是否为自己想要的格式
|