机房环境监测服务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

function envchart(title, tpcol, datalist) {
var chartDom = document.getElementById('mainchart');
var myChart = echarts.init(chartDom);
var option;
var data = [];
for(i=0;i<datalist.length;i++){
data.push([datalist[i]['rectime'], datalist[i][tpcol]]);
}
option = {
tooltip: {
trigger: 'axis',
position: function (pt) {
return [pt[0], '10%'];
}
},
title: {
left: 'center',
text: title+'统计表',
},
toolbox: {
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
xAxis: {
type: 'time',
boundaryGap: false
},
yAxis: {
type: 'value',
boundaryGap: [0, '100%']
},
dataZoom: [{
type: 'inside',
show:true,
xAxisIndex:[0],//表示x轴折叠
start: 0,
end: 30
}, {
type:"inside",
show:false,
start: 0,
end: 50
}],
series: [
{
name: title,
type: 'line',
smooth: false,
symbol: 'none',
areaStyle: {},
data: data
}
]
};
option && myChart.setOption(option);
}