option:
var dataoptionone = {
title : {
text: '数据存储情况',
subtext: '数据表',
x:'center'
},
tooltip: {
show: true
},
toolbox: {
show: true,
feature: {
dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ['line', 'bar'] },
restore: { show: true },
saveAsImage: { show: true }
}
},
legend: {
orient: 'vertical',
left: 'left',
data: ['表的记录数','表的空间占有量']
},
xAxis: {
type: 'category',
// boundaryGap: false,//加上x轴会是个点
data: []
},
yAxis: {
type: 'value'
},
series : [
{
name:"表的记录数",
type:"bar",
itemStyle:{
normal:{
color:"#1C90DB",
label: {
show: true,
position: 'top',
// formatter: '{c}'
formatter: '{b}\n{c}'
}
}
},
data:[]
}, {
name:"表的空间占有量",
type:"bar",
itemStyle:{
normal:{
color:"#D070D0",
label: {
show: true,
position: 'top',
// formatter: '{c}'
formatter: '{b}\n{c}K'
}
}
},
data:[]
}
]
};
js:代码
//查询表的记录数以及表的空间占有量
$(function(){
//第一个图
var dataStorage_Chart = echarts.init(document.getElementById('dataone'));
var data_x =[];
var data_count_y =[];
var size_y=[];
var tableCount ='${tableCount}';
var tablelimit =;
var tablepage =;
var count =tableCount/;
init();
clearInterval(timer1);
timer1 =setInterval(function() {
data_x =[];
data_count_y =[];
size_y=[];
if(tablepage<count){
tablepage+=;
}else{
tablepage=;
}
init();
}, )
function init(){
$.post("init/findImportTables",{page:tablepage,limit:tablelimit},function(msg){
$.each(msg,function(index,val){
data\_x.push(val.table\_name.insertStrPerIndex(,"\\n"));
data\_count\_y.push(val.data\_count!=null?val.data\_count:);
if(val.size!=null){
var s =val.size.toUpperCase();
if(s.lastIndexOf("M")>){
s =s.substring(,s.length-)\*;
}else if(s.lastIndexOf("K")>){
s =s.substring(,s.length-)\*;
}else{
s=s\*;
}
size\_y.push(s);
}else{
size\_y.push();
}
})
console.log("y:"+size\_y);
dataoptionone.xAxis.data=data\_x;
dataoptionone.series\[\].data=data\_count\_y;
dataoptionone.series\[\].data=size\_y;
dataStorage\_Chart.setOption(dataoptionone);
});
}
})
jsp:
手机扫一扫
移动阅读更方便
你可能感兴趣的文章