function search_Top()
{
$("#Tchart > * ").remove();
//重新绘图
getData();
}
function getData(){
var sd = sd_date.getSubmitValue();
var ed = ed_date.getSubmitValue();
var income=$("#income").val();
var keyword = $("#keyword").val();
var top = $("#top").val();
$.post("/rest/tcustomerStat/data/tcustomerToChart", { s_cdate: sd, e_cdate: ed ,income:income ,keyword:keyword, top: top },
function(result){
loadChart(eval("(" + result + ")"));//字符串转js对象
});
}
function loadChart(dd){
var dataStore = new Ext.data.JsonStore({
fields:['partyb', 'ccount', 'growing'],
data: dd
});
Ext.create('Ext.panel.Panel', {
title : '员工年龄分布图',
width : '100%',
height : 400,
renderTo: 'Tchart',
layout : 'fit',
items : [{
xtype : 'chart',
store : dataStore,
animate : true,//是否启用动画效果
legend : {
position : 'bottom' //图例位置
},
shadow : true,
series : [{
type : 'pie',//图表序列类型
field : 'ccount',//对应饼状图角度的字段名
showInLegend : false,//是否显示在图例当中 -----------
label : {
field : 'partyb',//标签字段名
contrast : true,
color : '#FFFF00',
renderer : function(v){//自定义标签渲染函数
return v;
},
display : 'middle',//标签显现方式
font : '0px "Lucida Grande"'//字体
},
highlight : {
segment : {
margin: 6 //空白区域宽度
}
},
tips : {
trackMouse : true, //是否启用鼠标跟踪
width : 168,
height : 30,
renderer : function(storeItem) {//自定义渲染函数
var title = storeItem.get('partyb') + ':'+ (storeItem.get('growing')*100).toFixed(3)+"%";
this.setTitle(title);
}
}
}]
}]
});
}