diff --git a/src/views/SewingBift/content/top.vue b/src/views/SewingBift/content/top.vue index b85dffe..da8a748 100644 --- a/src/views/SewingBift/content/top.vue +++ b/src/views/SewingBift/content/top.vue @@ -83,15 +83,29 @@ let SewingTime = reactive({ }, grid: { left: "3%", - right: "4%", + right: "10%", bottom: "3%", containLabel: true, }, - xAxis: { - type: "value", - - // boundaryGap: [0, 0.01] - }, + xAxis: [ + { + type: "value", + name: "缝纫时间", + axisLabel: { + formatter: "{value}", + }, + }, + { + type: "value", + name: "用电量", + // min: 0, + // max: 100, + // interval: 20, + axisLabel: { + formatter: "{value}", + }, + }, + ], yAxis: { type: "category", name: "min", @@ -124,6 +138,27 @@ let SewingTime = reactive({ }, }, }, + { + name: '用电量', + type: "bar", + XAxisIndex: 1, + tooltip: { + valueFormatter: function (value) { + return value; + }, + }, + data: [], + label: { + normal: { + show: true, + position: "right", + textStyle: { + color: "rgb(255,255,255,0.9)", + }, + }, + }, + }, + ], }, }); @@ -184,12 +219,16 @@ watch( (newVal, oldVal) => { let y = []; let x = []; + let z = [] newVal.forEach((res) => { y.push(res.name); x.push(res.workTime); + //省略两位小数 + z.push((res.runTime/10).toFixed(2)) }); SewingTime.option.yAxis.data = y; SewingTime.option.series[0].data = x; + SewingTime.option.series[1].data = z; chartref.value.changeData(SewingTime.option); }, { deep: true, flush: "post" }