在线等~请教echarts柱状图怎么显示数值
告白气球 2016-11-07 11:42:11 这是我的jsp页面
<script type="text/javascript">
//这里的内容会在文档加载完毕时执行
mini.parse();
$(function(){
$.ajax({
url:"../servlet/ServletTransmit?action=GSPXJA",//要请求的服务器url
//这是一个对象,表示请求的参数,两个参数:method=ajax&val=xxx,服务器可以通过request.getParameter()来获取
//data:{method:"ajaxTest",val:value},
//data:{email:value}, //这里的email对应表单中的name="email",也是发送url中的email=value(GET方式)
async:true, //是否为异步请求
cache:false, //是否缓存结果
type:"get", //请求方式为POST
dataType:"json", //服务器返回的数据是什么类型
success:function(result){ //这个方法会在服务器执行成功是被调用 ,参数result就是服务器返回的值(现在是json类型)
var xAxis="\[";
// var legend="[\'新收\',\'旧存\',\'已结\']";
var legend="[\'新收\',\'已结\']";
var data="[";
for(var i=0;i xAxis+="\'"+result[i].bmmc+"\',";
}
legend=mini.decode(legend);
for(var i=0;i data+="\{name:'"+legend[i]+"',type:'bar',";
var temp="\[";
for(var j=0;j if(legend[i]=="新收")
temp+=result[j].xs+",";
// else if(legend[i]=="旧存")
// temp+=result[j].jc+",";
else if(legend[i]=="已结")
temp+=result[j].yj+",";
}
temp=temp.substring(0, temp.length-1)+"\]";
data+="data:"+temp+"},";
}
xAxis=xAxis.substring(0, xAxis.length-1)+"\]";
data=data.substring(0, data.length-1)+"\]";
// alert(data);
LoadingChart("2016年1月1日至各审判业务部门收结案数情况",legend,mini.decode(xAxis),mini.decode(data),"div1","1");
}
})
});
</script>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
这是我的 js
mini.parse();
function LoadingChart(text,legend,xAxis,series,div,type){
var xValue="";
var yValue="";
if(type=="1"){
xValue=[{"data":xAxis,"boundaryGap" : [ '80%', '80%' ],"axisLabel" : {"show":true,"rotate": 30,"interval": '0'},"type":'category'}];
yValue={"type" : 'value'};
}
else{
yValue=[{"data":xAxis,"boundaryGap" : [ '80%', '80%' ],"axisLabel" : {"show":true,"rotate": 30,"interval": '0'},"type":'category'}];
xValue=[{"type" : 'value'}];
}
var json =
{
"animationDuration":3500,
"title" :
{
"text" : text,
"x" : 'center',
"textStyle":
{
"fontSize":'24px',
"color":'#34A1D6',
"fontFamily":'宋体'
}
},
"color":['#0a6db3','#fb7c00','#D97A80','#2EC8CA','#FEB980','#cd5c5c','#ffa500','#40e0d0','#1e90ff','#ff6347','#7b68ee','#00fa9a','#ffd700','#6b8e23','#ff00ff','#3cb371','#b8860b','#30e0e0'],
"backgroundColor":'#E7F3FF',
"tooltip" : {
"trigger": 'axis',
"textStyle":
{
"fontSize":15,
"fontFamily":'宋体'
}
},
"calculable" : true,
"legend" :
{
"show" : (legend.length > 1 ? true : false),
"orient" : 'horizontal',
"x" : 'center',
"y":'30',
"data" : legend,
"itemWidth": 14,
"itemHeight":10,
"padding":3,
"itemGap":3,
"textStyle":
{
"fontSize":"16px",
"fontFamily":'宋体'
}
},
"toolbox":
{
"show" : true,
"x":'right',
"y":'top',
"itemSize":14,
"itemGap":5,
"feature" :
{
"dataView" :
{
"show" : true,
"readOnly": true,
},
"saveAsImage" :
{
"show" : true
}
}
},
"xAxis" :xValue,
"yAxis" : yValue,
"series" : series,
"series" : { itemStyle: { normal: {label : {show: true, position: 'top'}}}}
};
var myChart = echarts.init(document.getElementById(div));
myChart.setOption(json);
}
求大神帮忙,小女子万分感激