ExtJS4 pie Chart从struts2获得数据但是不显示chart

木叶下521 2014-01-05 05:37:11
ExtJS4 pie Chart从struts2获得数据但是不显示chart,怎么回事呢?

model:
Ext.define('MyExtJS.model.ChartModel', {
extend : 'Ext.data.Model',
fields : [{
    name : 'id',
mapping : 'id'
},
'options',
'countRate' ]
});

store:
var charStore= Ext.create('Ext.data.JsonStore',{
model : 'MyExtJS.model.ChartModel',
autoLoad: true,
proxy:{ <span></span>type:'ajax',
url:'system/analysis!queryAnalysisBySQId?sqId='+sqId, reader:{
type:'json',
root:'lists',
totalProperty : 'counts'
}
}
});

chart:
var myChart = Ext.create('Ext.window.Window', {
title : '具体统计结果',
layout : 'fit',
autoShow : true,
width:600,
height:400,
items:[{
xtype : 'chart',
store : charStore,
animate : true,//是否启用动画效
legend : {
position : 'bottom' //图例位置
},
shadow : true,
series : [{
type : 'pie',//图表序列类型
field : 'countRate',//对应饼状图角度的字段名
showInLegend : true,//是否显示在图例当中
colorSet : ['#FFFF00','#669900','#FF6699','#66CCCC'],//颜色
label : {
field : 'options',//标签字段名
contrast : true,
color : '#FFFF00',
renderer : function(v){//自定义标签渲染函数
return "["+v+"]";
},
display : 'middle',//标签显现方式
font : '18px "Lucida Grande"'//字体
},
highlight : {
segment : {
margin: 10 //空白区域宽度
},
tips : <span></span> trackMouse : true, //否启用鼠标跟踪
width : 50,
height : 28,
renderer : function(storeItem) {//自定义渲染函
var title = storeItem.get('countRate') + '%';
this.setTitle(title);
}
}
}]
}]
});

数据
我如果把store换成死的:
var dataStore = new Ext.data.Store({
fields:['options', 'countRate'],
data: [
{options :'A', countRate : 10},
{options :'B', countRate : 50},
{options :'C', countRate : 30},
{options :'D', countRate : 20}
]
});
就可以正常显示,怎么回事?
...全文
199 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_20127667 2016-05-11
  • 打赏
  • 举报
回复
怎么解决???
Mybonnie1 2016-01-25
  • 打赏
  • 举报
回复
怎么解决啊,刚碰到这种情况
Iro_ 2015-03-23
  • 打赏
  • 举报
回复
有没有解决,我也遇到这个问题了。。。
  • 打赏
  • 举报
回复
我觉得你找到原因了。。

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧