驾驶舱对接
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-13 14:08:51
|
||||
* @LastEditTime: 2024-05-14 08:46:07
|
||||
* @LastEditTime: 2024-05-17 09:37:01
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@@ -12,7 +12,7 @@
|
||||
<!-- <span v-for="item in legend" :key="item.label" class="legend-item"
|
||||
:style="{ fontSize: isFullscreen ? '0.58vw' : '0.54vw' }">{{ item.label }}</span> -->
|
||||
</div>
|
||||
<div ref="gasChart" :style="{ height: '100%',width: width}"></div>
|
||||
<div ref="gasChart" :style="{ height: '95%',width: width}"></div>
|
||||
</chart-container>
|
||||
</template>
|
||||
|
||||
@@ -33,22 +33,22 @@ export default {
|
||||
type: Number,
|
||||
default: 38,
|
||||
},
|
||||
legend: {
|
||||
type: Array,
|
||||
required: false,
|
||||
},
|
||||
// legend: {
|
||||
// type: Array,
|
||||
// required: false,
|
||||
// },
|
||||
xAxis: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
series: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
in: {
|
||||
type: String,
|
||||
default: "",
|
||||
required: false,
|
||||
},
|
||||
// in: {
|
||||
// type: String,
|
||||
// default: "",
|
||||
// },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -57,8 +57,8 @@ export default {
|
||||
actualOptions: null,
|
||||
options: {
|
||||
grid: {
|
||||
left: "1%",
|
||||
right: "4%",
|
||||
left: "3%",
|
||||
right: "2%",
|
||||
bottom: "3%",
|
||||
top: "15%",
|
||||
containLabel: true,
|
||||
@@ -140,38 +140,38 @@ export default {
|
||||
},
|
||||
data: [], // this.series[0].data,
|
||||
},
|
||||
{
|
||||
name: "", // this.series[1].name,
|
||||
type: "bar",
|
||||
barWidth: 12,
|
||||
// tooltip: {
|
||||
// valueFormatter: function (value) {
|
||||
// return value + " ml";
|
||||
// },
|
||||
// },
|
||||
itemStyle: {
|
||||
borderRadius: [10, 10, 0, 0],
|
||||
color: {
|
||||
type: "linear",
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 0,
|
||||
color: "#57abf8", // 0% 处的颜色
|
||||
},
|
||||
{
|
||||
offset: 1,
|
||||
color: "#364BFE66", // 100% 处的颜色
|
||||
},
|
||||
],
|
||||
global: false, // 缺省为 false
|
||||
},
|
||||
},
|
||||
data: [], // this.series[1].data,
|
||||
},
|
||||
// {
|
||||
// name: "", // this.series[1].name,
|
||||
// type: "bar",
|
||||
// barWidth: 12,
|
||||
// // tooltip: {
|
||||
// // valueFormatter: function (value) {
|
||||
// // return value + " ml";
|
||||
// // },
|
||||
// // },
|
||||
// itemStyle: {
|
||||
// borderRadius: [10, 10, 0, 0],
|
||||
// color: {
|
||||
// type: "linear",
|
||||
// x: 0,
|
||||
// y: 0,
|
||||
// x2: 0,
|
||||
// y2: 1,
|
||||
// colorStops: [
|
||||
// {
|
||||
// offset: 0,
|
||||
// color: "#57abf8", // 0% 处的颜色
|
||||
// },
|
||||
// {
|
||||
// offset: 1,
|
||||
// color: "#364BFE66", // 100% 处的颜色
|
||||
// },
|
||||
// ],
|
||||
// global: false, // 缺省为 false
|
||||
// },
|
||||
// },
|
||||
// data: [], // this.series[1].data,
|
||||
// },
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -185,39 +185,44 @@ export default {
|
||||
isOpen(val) {
|
||||
// console.log(val)
|
||||
if (val === true) {
|
||||
console.log('ryf')
|
||||
this.width = '99%'
|
||||
this.width = 97 + '%'
|
||||
this.canvasReset()
|
||||
|
||||
console.log(this.width)
|
||||
} else {
|
||||
console.log('ryf')
|
||||
this.watch = 100 + '%'
|
||||
this.canvasReset()
|
||||
}
|
||||
},
|
||||
/** 全屏状态切换时,对柱子粗细和字体大小进行相应调整 */
|
||||
isFullscreen(val) {
|
||||
if (val === true && this.isOpen === true) {
|
||||
this.width = '99%'
|
||||
if (val === false && this.isOpen === true) {
|
||||
this.width = 97 + '%'
|
||||
this.canvasReset()
|
||||
} else if (val === false && this.isOpen === false) {
|
||||
this.watch = 100 + '%'
|
||||
this.canvasReset()
|
||||
}
|
||||
this.actualOptions.series.map((item) => {
|
||||
item.barWidth = val ? 18 : 12;
|
||||
});
|
||||
this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
|
||||
this.initOptions(this.actualOptions);
|
||||
// this.actualOptions.series.map((item) => {
|
||||
// item.barWidth = val ? 18 : 12;
|
||||
// });
|
||||
// this.actualOptions.xAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.axisLabel.fontSize = val ? 18 : 12;
|
||||
// this.actualOptions.yAxis.nameTextStyle.fontSize = val ? 18 : 12;
|
||||
this.initChart(this.actualOptions);
|
||||
},
|
||||
series(val) {
|
||||
if (!val) {
|
||||
this.initOptions(this.options);
|
||||
this.initChart(this.options);
|
||||
return;
|
||||
}
|
||||
const actualOptions = JSON.parse(JSON.stringify(this.options));
|
||||
console.log('actualOptions', this.options)
|
||||
actualOptions.series[0].data = val[0].data;
|
||||
actualOptions.series[0].name = val[0].name;
|
||||
actualOptions.series[1].data = val?.[1]?.data || [];
|
||||
actualOptions.series[1].name = val?.[1]?.name || "";
|
||||
actualOptions.series[0].data = val;
|
||||
// actualOptions.series[0].name = val[0].name;
|
||||
// actualOptions.series[1].data = val?.[1]?.data || [];
|
||||
// actualOptions.series[1].name = val?.[1]?.name || "";
|
||||
this.actualOptions = actualOptions;
|
||||
this.initChart(actualOptions);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user