<el-row :gutter="20">
<el-col :span="8" v-for="item in orderlist" :key="item.id">
<div>零件号:{{item.lingjianhao}}</div>
<div>模具编号:{{item.muju}}</div>
<div>模型架号:{{item.muxing}}</div>
<div>浇注开始:{{item.kaishi}}</div>
<div>浇注结束:{{item.jieshu}}</div>
<div class="chartsheight orderChart" ></div>
</el-col>
</el-row>
// 遍历出多Y 轴折线图
draworderline(){
var echarts = require("echarts");
var colors = ['#5793f3', '#d14a61', '#675bba'];
var orderChart = document.getElementsByClassName('orderChart'); // 对应地使用ByClassName
for(var i = 0;i < orderChart.length;i++ ){ // 通过for循环,在相同class的dom内绘制元素
var myChart = echarts.init(orderChart[i]);
let Ydata=[];
// 遍历多Y轴
for (let n = 0, l = this.orderlist[i].legenddata.length; n < l; n++) {
Ydata.push({
type: 'value',
name: this.orderlist[i].legenddata[n],
axisLine: {
lineStyle: {
color: colors[n]
}
},
offset: (Ydata.length + 1) <= 2 ? 0 : (Math.ceil((Ydata.length + 1) / 2) - 1) * 40,
axisLabel: {
formatter: function(value) {
return value
}
// formatter: '{value} ml'
}
})
}
myChart.setOption({
color: colors,
tooltip: {
trigger: 'axis',
axisPointer: {type: 'cross'}
},
grid: {
right: '20%'
},
legend: {
data: this.orderlist[i].legenddata,
// data:['蒸发量','降水量','平均温度']
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: this.orderlist[i].xAxisdata,
// data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
}
],
yAxis: Ydata,
// yAxis: [
// {
// type: 'value',
// name: '蒸发量',
// axisLine: {
// lineStyle: {
// color: colors[0]
// }
// },
// axisLabel: {
// formatter: '{value} ml'
// }
// },
// {
// type: 'value',
// name: '降水量',
// offset: 60,
// axisLine: {
// lineStyle: {
// color: colors[1]
// }
// },
// axisLabel: {
// formatter: '{value} ml'
// }
// },
// {
// type: 'value',
// name: '平均温度',
// axisLine: {
// lineStyle: {
// color: colors[2]
// }
// },
// axisLabel: {
// formatter: '{value} °C'
// }
// }
// ],
series:this.orderlist[i].yAxisdata,
// series: [
// {
// name:'蒸发量',
// type:'line',
// data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
// },
// {
// name:'降水量',
// type:'line',
// yAxisIndex: 1,
// data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
// },
// {
// name:'平均温度',
// type:'line',
// yAxisIndex: 2,
// data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
// }
// ]
},true)
}
},
// 顺序折线图
orderlist:[
{
lingjianhao:'奔驰左前座椅',
muju:'BZQ1',
muxing:'89',
kaishi:'2023-07-17 22:03:50.000',
jieshu:'2023-07-20 22:03:50.000',
legenddata:['蒸发量','降水量','平均温度'],
xAxisdata: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
yAxisdata:[
{
name:'蒸发量',
type:'line',
yAxisIndex: 0,
data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
name:'降水量',
type:'line',
yAxisIndex: 1,
data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
},
{
name:'平均温度',
type:'line',
yAxisIndex: 2,
data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
]
},
{
lingjianhao:'奔驰左前座椅',
muju:'BZQ1',
muxing:'89',
kaishi:'2023-07-17 22:03:50.000',
jieshu:'2023-07-20 22:03:50.000',
legenddata:['温度','湿度','速度'],
xAxisdata: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
yAxisdata:[
{
name:'温度',
type:'line',
yAxisIndex: 0,
data:[122.0, 4.9, 7.0, 23.2, 25.6, 76.7, 35.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
name:'湿度',
type:'line',
yAxisIndex: 1,
data:[102.6, 5.9, 9.0, 26.4, 28.7, 70.7, 75.6, 182.2, 48.7, 18.8, 6.0, 2.3]
},
{
name:'速度',
type:'line',
yAxisIndex: 2,
data:[200.0, 2.2, 3.3, 4.5, 6.3, 10.2, 120.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
]
},
{
lingjianhao:'奔驰左前座椅',
muju:'BZQ1',
muxing:'89',
kaishi:'2023-07-17 22:03:50.000',
jieshu:'2023-07-20 22:03:50.000',
legenddata:['电流','电压','压力'],
xAxisdata: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
yAxisdata:[
{
name:'电流',
type:'line',
yAxisIndex: 0,
data:[2.0, 4.9, 7.0, 123.2, 25.6, 76.7, 135.6, 162.2, 32.6, 120.0, 60.4, 3.3]
},
{
name:'电压',
type:'line',
yAxisIndex: 1,
data:[2.6, 5.9, 9.0, 426.4, 238.7, 70.7, 175.6, 182.2, 48.7, 88.8, 6.0, 2.3]
},
{
name:'压力',
type:'line',
yAxisIndex: 2,
data:[2.0, 290.2, 3.3, 4.5, 6.3, 240.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
}
]
},