52,797
社区成员
发帖
与我相关
我的任务
分享
function refreshServer()
{
var serverIds = $("#serverIds").val();
if(serverIds.length<=0)return;
$.ajax({
type : "get",
url:"monitor/refreshServerInfo",
cache : false,
async : true,
data:{serverIds:serverIds},
success : function(data) {
var serverStatus = JSON.parse(data);
$.each(serverStatus,function(index,info){
addEcharts("cpu_"+info.serverId,$("#gauge_"+info.serverId));
});
},
error:function()
{
$.messager.alert("错误","服务器异常,请重新刷新页面!","error");
if(time1!=null)
clearInterval(time1);
}
});
}
function addEcharts(guaId,obj)
{
require.config({
paths: {
echarts: 'js/core/echarts-2.2.7/build/dist'
}
});
// 使用
require(
[
'echarts',
'echarts/chart/bar' // 使用柱状图就加载bar模块,按需加载
],
function (ec) {
// 基于准备好的dom,初始化echarts图表
var myChart = ec.init(document.getElementById(guaId));
var option = {
tooltip: {
show: true
},
legend: {
data:['销量']
},
xAxis : [
{
type : 'category',
data : ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
"name":"销量",
"type":"bar",
"data":[5, 20, 40, 10, 10, 20]
}
]
};
// 为echarts对象加载数据
myChart.setOption(option);
}
);
}