echarts表格数据填充
This commit is contained in:
parent
f14a2c2682
commit
a932162058
|
@ -144,8 +144,8 @@ export default {
|
||||||
type:'month_s',
|
type:'month_s',
|
||||||
page:0
|
page:0
|
||||||
},
|
},
|
||||||
factoryData: { 'coal_consume': 100, 'elec_consume': 100, 'water_consume': 100, 'cair_consume': 100 },
|
factoryData: {},
|
||||||
sectionData: { 'elec_consume_unit': 0, 'total_production': 0, 'run_rate': 100, 'coal_consume_unit': 0 },
|
sectionData: {},
|
||||||
initialAlpha: -Math.PI / 0.89,
|
initialAlpha: -Math.PI / 0.89,
|
||||||
initialBeta: Math.PI / 3.3,
|
initialBeta: Math.PI / 3.3,
|
||||||
initialRadius: 18,
|
initialRadius: 18,
|
||||||
|
@ -199,11 +199,11 @@ export default {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: this.xAxisData
|
data: []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
grid: { // 让图表占满容器
|
grid: { // 让图表占满容器
|
||||||
top: "5%",
|
top: "10%",
|
||||||
left: "12%",
|
left: "12%",
|
||||||
right: "0px",
|
right: "0px",
|
||||||
bottom: "15%"
|
bottom: "15%"
|
||||||
|
@ -212,7 +212,7 @@ export default {
|
||||||
year_start:0,
|
year_start:0,
|
||||||
end_time:'',
|
end_time:'',
|
||||||
start_time:'',
|
start_time:'',
|
||||||
xAxisData:[],
|
xAxisData:['一月', '二月', '三月', '四月', '五月', '六月'],
|
||||||
arrMonth:[],
|
arrMonth:[],
|
||||||
legendData:['电石渣','原料磨','煤磨','回转窑','水泥磨','水泥包装'],
|
legendData:['电石渣','原料磨','煤磨','回转窑','水泥磨','水泥包装'],
|
||||||
chart1Option: {},
|
chart1Option: {},
|
||||||
|
@ -298,16 +298,23 @@ export default {
|
||||||
//监听是否连接成功
|
//监听是否连接成功
|
||||||
this.ws.onopen = ()=> {
|
this.ws.onopen = ()=> {
|
||||||
// debugger;
|
// debugger;
|
||||||
console.log("socket连接成功");
|
// console.log("socket连接成功");
|
||||||
setTimeout(()=>{
|
// setTimeout(()=>{
|
||||||
that.ws.send(JSON.stringify({'type': 'chat', 'msg': '你好admin', 'to': 'admin'}))
|
// that.ws.send(JSON.stringify({'type': 'chat', 'msg': '你好admin', 'to': 'admin'}))
|
||||||
},5000)
|
// },5000)
|
||||||
}
|
}
|
||||||
|
|
||||||
//接听服务器发回的信息并处理展示
|
//接听服务器发回的信息并处理展示
|
||||||
this.ws.onmessage = (msg)=>{
|
this.ws.onmessage = (msg)=>{
|
||||||
let data = JSON.parse(msg.data)
|
let data = JSON.parse(msg.data)
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
if(data.type=='event'){
|
||||||
|
|
||||||
|
}if(data.type=='ticket'){
|
||||||
|
|
||||||
|
}if(data.type=='chat'){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -370,6 +377,8 @@ export default {
|
||||||
that.seriesData2=seriesData2;
|
that.seriesData2=seriesData2;
|
||||||
that.seriesData3=seriesData3;
|
that.seriesData3=seriesData3;
|
||||||
that.seriesData3_2=seriesData3_2;
|
that.seriesData3_2=seriesData3_2;
|
||||||
|
debugger;
|
||||||
|
|
||||||
that.initCharts();
|
that.initCharts();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -401,14 +410,15 @@ export default {
|
||||||
},
|
},
|
||||||
initCharts() {
|
initCharts() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
function deepCopy(obj) {
|
||||||
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
}
|
||||||
// 初始化所有表格
|
// 初始化所有表格
|
||||||
let data11 = that.seriesData1;
|
that.basicOption.xAxis.data = that.xAxisData;
|
||||||
that.chart1Option = Object.assign({}, that.basicOption)
|
that.chart1Option = deepCopy(that.basicOption)
|
||||||
that.chart1Option.xAxis.data = that.xAxisData;
|
|
||||||
that.chart1Option.series = [
|
that.chart1Option.series = [
|
||||||
{
|
{
|
||||||
name: 'Forest',
|
name: '电耗',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: 15,
|
barWidth: 15,
|
||||||
label: {
|
label: {
|
||||||
|
@ -421,16 +431,16 @@ export default {
|
||||||
data: that.seriesData1
|
data: that.seriesData1
|
||||||
}]
|
}]
|
||||||
that.setChart('chart1',that.chart1Option);
|
that.setChart('chart1',that.chart1Option);
|
||||||
this.chart2Option = Object.assign({}, this.basicOption)
|
this.chart2Option = deepCopy(that.basicOption)
|
||||||
this.chart2Option.series[0].type = 'line';
|
this.chart2Option.series[0].type = 'line';
|
||||||
this.chart2Option.series[0].data = that.seriesData2;
|
this.chart2Option.series[0].data = that.seriesData2;
|
||||||
this.setChart('chart2', this.chart2Option);
|
this.setChart('chart2', this.chart2Option);
|
||||||
this.chart3Option = Object.assign({}, this.basicOption)
|
this.chart3Option =deepCopy(that.basicOption)
|
||||||
that.chart3Option.xAxis.data = that.xAxisData;
|
|
||||||
this.chart3Option.series = [
|
this.chart3Option.series = [
|
||||||
{
|
{
|
||||||
name: 'Forest',
|
name: '工业水',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
|
barWidth: 15,
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: 'top'
|
position: 'top'
|
||||||
|
@ -441,8 +451,9 @@ export default {
|
||||||
data: that.seriesData3
|
data: that.seriesData3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Steppe',
|
name: '压缩空气',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
|
barWidth: 15,
|
||||||
emphasis: {
|
emphasis: {
|
||||||
focus: 'series'
|
focus: 'series'
|
||||||
},
|
},
|
||||||
|
@ -452,19 +463,22 @@ export default {
|
||||||
},
|
},
|
||||||
initCharts1() {
|
initCharts1() {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.chart4Option = Object.assign({}, this.basicOption)
|
function deepCopy(obj) {
|
||||||
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
}
|
||||||
|
that.basicOption.xAxis.data = that.xAxisData;
|
||||||
|
this.chart4Option = deepCopy(that.basicOption)
|
||||||
this.chart4Option.series[0].type = 'line';
|
this.chart4Option.series[0].type = 'line';
|
||||||
this.chart4Option.series[0].data = that.seriesData4;
|
this.chart4Option.series[0].data = that.seriesData4;
|
||||||
this.setChart('chart4', this.chart4Option);
|
this.setChart('chart4', this.chart4Option);
|
||||||
this.chart5Option = Object.assign({}, this.basicOption)
|
this.chart5Option = deepCopy(that.basicOption)
|
||||||
this.chart5Option.series[0].type = 'line';
|
this.chart5Option.series[0].type = 'line';
|
||||||
this.chart5Option.series[0].data = that.seriesData5;
|
this.chart5Option.series[0].data = that.seriesData5;
|
||||||
this.setChart('chart5', this.chart5Option);
|
this.setChart('chart5', this.chart5Option);
|
||||||
this.chart6Option = Object.assign({}, this.basicOption)
|
this.chart6Option = deepCopy(that.basicOption)
|
||||||
this.chart6Option.series[0].type = 'line';
|
this.chart6Option.series[0].type = 'line';
|
||||||
this.chart6Option.series[0].data = that.seriesData6;
|
this.chart6Option.series[0].data = that.seriesData6;
|
||||||
this.setChart('chart6', this.chart6Option);
|
this.setChart('chart6', this.chart6Option);
|
||||||
|
|
||||||
},
|
},
|
||||||
addListener() {
|
addListener() {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
Loading…
Reference in New Issue