initlt() {
this.chartsL_t = this.$echarts.init(this.$refs.chartsl_t);
this.optionlt = {
tooltip: {
trigger: "axis",
},
legend: {
data: ["温度1", "温度2"],
textStyle: {
color: "#ffffff",
},
},
grid: {
left: "1%",
right: "1%",
bottom: "1%",
top: "20%",
containLabel: true,
},
xAxis: {
type: "category",
data: this.ltx,
axisLabel: {
interval: 0,
rotate: 40,
},
scale: false,
axisLine: {
lineStyle: {
color: "rgba(234, 233, 233, 1)",
},
},
axisTick: {
show: false,
},
},
yAxis: [
{
type: "value",
show: true,
name: "温度(℃)",
min: -10,
max: 40,
interval: 10,
splitLine: {
show: true,
lineStyle: {
color: "rgba(234, 233, 233, 1)",
},
},
nameTextStyle: {
color: "#ccc",
align: "right",
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(234, 233, 233, 1)",
},
},
axisTick: {
show: false,
},
axisLabel: {
formatter: "{value}",
},
},
{
type: "value",
show: true,
name: "湿度(%)",
min: 0,
max: 100,
interval: 20,
splitLine: {
show: true,
lineStyle: {
color: "rgba(234, 233, 233, 1)",
},
},
nameTextStyle: {
color: "rgba(234, 233, 233, 1)",
align: "left",
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(234, 233, 233, 1)",
},
},
axisTick: {
show: false,
},
axisLabel: {
formatter: "{value}",
},
},
],
series: [
{
name: "湿度",
type: "line",
stack: "Total",
data: this.ltw1,
smooth: true,
showSymbol: false,
itemStyle: {
color: "#da4061",
},
},
{
name: "温度",
data: this.ltw2,
type: "line",
smooth: true,
showSymbol: false,
itemStyle: {
color: "#1bc1f0",
},
},
],
};
this.chartsL_t.setOption(this.optionlt);
},
|