配置项如下
option = {
title: {
text: '表箱昨日电压曲线',
left: 'center'
},
tooltip: {
trigger: 'axis',
formatter: function(params, ticket) {
var text = "<center><b>" + params[0].name + "</center></b>";
var legendData = option.legend.data;
for (var i = 0; i < legendData.length; i++) {
text = legendData[i];
for (var j = 0; j < params.length; j++) {
if (params[j].seriesName == legendData[i]) {
text = text + ' ' + option.series[params[j].seriesIndex].mc + ' : ' + params[j].data + " V<br/>";
}
}
}
return text;
},
fontSize: 9,
},
color: ["#EC870E", "#50A625", "#00A06B"],
legend: {
top: 25,
data: ['A相电压', 'B相电压', 'C相电压']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'],
},
yAxis: [{
type: 'value',
axisLabel: {
formatter: '{value}'
},
min: 200,
max: 240
}],
dataZoom: [{
type: 'inside',
start: 0,
end: 50
}, {
show: true,
type: 'slider',
y: '90%',
start: 0,
end: 50
}],
series : [
{
name : 'A相电压',
mc : '表箱1',
type : 'line',
smooth : true,
data : [ 223.18, 223.44, 221.62, 222.48, 222.35, 224.56,
223.32, 223.71, 222.77, 221.49, 224.79, 223.70, 221.33,
222.35, 222.09, 224.42, 221.21, 224.76, 224.31, 224.99,
221.54, 222.28, 224.07, 221.87 ]
},
{
name : 'A相电压',
mc : '表箱2',
type : 'line',
smooth : true,
data : [ 216.71, 215.14, 223.03, 214.99, 215.00, 213.21,
216.09, 217.38, 214.79, 218.46, 213.53, 212.81, 222.13,
220.81, 222.62, 222.20, 220.61, 220.03, 218.32, 219.22,
222.58, 220.81, 215.23, 219.47, ]
},
{
name : 'A相电压',
mc : '表箱3',
type : 'line',
smooth : true,
data : [ 236.71, 235.14, 223.03, 234.99, 235.00, 233.23,
236.09, 237.38, 234.79, 238.46, 233.53, 232.81, 222.13,
220.81, 222.62, 222.20, 220.61, 220.03, 238.32, 239.22,
222.58, 220.81, 235.23, 239.47, ]
},
{
name : 'B相电压',
mc : '表箱1',
type : 'line',
smooth : true,
data : [ 215.32, 218.77, 215.74, 217.40, 213.07, 213.19,
218.52, 219.17, 214.48, 217.04, 215.87, 214.27, 216.74,
213.78, 213.25, 213.37, 214.10, 218.43, 214.30, 213.12,
215.07, 215.22, 219.00, 216.89, ]
},
{
name : 'B相电压',
mc : '表箱2',
type : 'line',
smooth : true,
data : [ 220.72, 224.49, 222.29, 224.08, 223.73, 220.81,
220.44, 223.04, 223.93, 224.00, 220.99, 220.79, 221.66,
222.45, 220.48, 221.57, 222.39, 223.37, 222.53, 223.29,
224.31, 220.97, 221.27, 223.26, ]
},
{
name : 'B相电压',
mc : '表箱3',
type : 'line',
smooth : true,
data : [ 230.72, 234.49, 232.29, 234.08, 233.73, 230.81,
230.44, 233.04, 233.93, 234.00, 230.99, 230.79, 231.66,
232.45, 230.48, 231.57, 232.39, 233.37, 232.53, 233.29,
234.31, 230.97, 231.27, 233.26, ]
},
{
name : 'C相电压',
mc : '表箱1',
type : 'line',
smooth : true,
data : [ 224.48, 224.61, 223.55, 224.73, 223.46, 220.45,
222.17, 221.28, 222.23, 222.62, 222.11, 220.87, 223.78,
224.09, 224.62, 223.67, 220.63, 221.61, 224.23, 221.35,
221.56, 224.04, 221.04, 224.50, ]
},
{
name : 'C相电压',
mc : '表箱3',
type : 'line',
smooth : true,
data : [ 231.47, 231.01, 232.18, 232.26, 234.72, 230.21,
231.63, 234.82, 233.88, 234.80, 234.56, 233.14, 233.20,
232.91, 231.51, 233.11, 234.42, 233.17, 230.94, 234.44,
231.36, 234.88, 234.99, 231.47, ]
}]
}