|
@@ -2,19 +2,19 @@
|
|
|
<div>
|
|
|
<div class="select-veido">
|
|
|
<el-select
|
|
|
- style="margin-top:10px"
|
|
|
- v-model="currentChartId"
|
|
|
- placeholder="请选择"
|
|
|
- @change="selectParm"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in parmoptions"
|
|
|
- :key="item.id+''"
|
|
|
- :label="item.label"
|
|
|
- :value="item.id"
|
|
|
+ style="margin-top:10px"
|
|
|
+ v-model="currentChartId"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="selectParm"
|
|
|
>
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-option
|
|
|
+ v-for="item in parmoptions"
|
|
|
+ :key="item.id+''"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</div>
|
|
|
<div
|
|
|
ref="testLine"
|
|
@@ -23,6 +23,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
+
|
|
|
<script>
|
|
|
import { mapState } from "vuex";
|
|
|
|
|
@@ -39,9 +40,15 @@ export default {
|
|
|
label: "三相相电流",
|
|
|
},
|
|
|
],
|
|
|
- title:'三相线电压',
|
|
|
- type: ['Uab_after','Ubc_after','Uca_after'],
|
|
|
- unit:'V',
|
|
|
+ id: 89,
|
|
|
+ title: "三相线电压",
|
|
|
+ type: [
|
|
|
+ "xiandianyauab_after",
|
|
|
+ "xiandianyaubc_after",
|
|
|
+ "xiandianyauca_after",
|
|
|
+ ],
|
|
|
+ legend: ["三相线电压Uab", "三相线电压Ubc", "三相线电压Uca"],
|
|
|
+ unit: "V",
|
|
|
currentChartId: 1,
|
|
|
xData: new Array(30).fill("-"),
|
|
|
y1Data: new Array(30).fill("-"),
|
|
@@ -53,36 +60,115 @@ export default {
|
|
|
color: ["#41D6C3", "#FA8072"],
|
|
|
tooltip: {
|
|
|
trigger: "axis",
|
|
|
+ backgroundColor: "transparent",
|
|
|
axisPointer: {
|
|
|
- type: "cross",
|
|
|
- label: {
|
|
|
- backgroundColor: "#6a7985",
|
|
|
+ lineStyle: {
|
|
|
+ color: {
|
|
|
+ type: "linear",
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 0,
|
|
|
+ y2: 1,
|
|
|
+ colorStops: [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "rgba(126,199,255,0)", // 0% 处的颜色
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.5,
|
|
|
+ color: "rgba(126,199,255,1)", // 100% 处的颜色
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "rgba(126,199,255,0)", // 100% 处的颜色
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ global: false, // 缺省为 false
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
- backgroundColor: "#fff",
|
|
|
- padding: 10,
|
|
|
- textStyle: {
|
|
|
- fontSize: 12,
|
|
|
- color: "#152934",
|
|
|
- lineHeight: 24,
|
|
|
- },
|
|
|
- extraCssText:
|
|
|
- "box-shadow: 0 0 3px rgba(0, 0, 0, 0.3); border-radius: 0;",
|
|
|
- formatter: (params) => {
|
|
|
- console.log("params", params);
|
|
|
- var result = `${this.title}:${params[0].data}${this.unit} <br/>`;
|
|
|
- return result;
|
|
|
+ formatter: (p) => {
|
|
|
+ let dom = `<div style="width: 79px;
|
|
|
+ height: 110px;;color:#fff;position: relative;">
|
|
|
+ <svg style="position: absolute;top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%) translateY(-50%);" class="svg" xmlns="http://www.w3.org/2000/svg" width="100"
|
|
|
+ height="111" viewBox="0 0 80 85">
|
|
|
+ <defs>
|
|
|
+ <style>
|
|
|
+ .cls-1 {
|
|
|
+ fill: #07172c;
|
|
|
+ fill-opacity: 0.8;
|
|
|
+ stroke: #a7d8ff;
|
|
|
+ stroke-linejoin: round;
|
|
|
+ stroke-opacity: 0.2;
|
|
|
+ stroke-width: 1px;
|
|
|
+ fill-rule: evenodd;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </defs>
|
|
|
+ <path id="矩形_419" data-name="矩形 419" class="cls-1" d="M266,595h74v50H266V624.046L261,620l5-3.984V595Z"
|
|
|
+ transform="translate(-258.5 -592.5)" />
|
|
|
+ </svg>
|
|
|
+ <div style="padding: 3px 1px 3px 11px;display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ flex-direction: column;position: relative;z-index: 1;">
|
|
|
+ <div
|
|
|
+ style="margin-bottom: 4px;width:100%;display:${
|
|
|
+ p[0] ? "flex" : "none"
|
|
|
+ };justify-content:space-between;align-items:center;">
|
|
|
+ <span style="font-size:11px;color:#7ec7ff;">${
|
|
|
+ p[0] ? p[0].seriesName : ""
|
|
|
+ }</span>
|
|
|
+ <span style="font-size:11px;color:#fff;">${p[0] ? p[0].data : ""}</span>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="width:100%;height:100%;display:${
|
|
|
+ p[1] ? "flex" : "none"
|
|
|
+ };justify-content:space-between;align-items:center;">
|
|
|
+ <span style="font-size:11px;color:#7ec7ff;">${
|
|
|
+ p[1] ? p[1].seriesName : ""
|
|
|
+ }</span>
|
|
|
+ <span style="font-size:11px;color:#fff;">${p[1] ? p[1].data : ""}</span>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ style="width:100%;height:100%;display:${
|
|
|
+ p[1] ? "flex" : "none"
|
|
|
+ };justify-content:space-between;align-items:center;">
|
|
|
+ <span style="font-size:11px;color:#7ec7ff;">${
|
|
|
+ p[2] ? p[2].seriesName : ""
|
|
|
+ }</span>
|
|
|
+ <span style="font-size:11px;color:#fff;">${p[2] ? p[2].data : ""}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>`;
|
|
|
+ return dom;
|
|
|
},
|
|
|
},
|
|
|
+ grid: {
|
|
|
+ top: "5%",
|
|
|
+ left: "10%",
|
|
|
+ right: "10%",
|
|
|
+ bottom: "7%",
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
legend: {
|
|
|
- orient: "vertical",
|
|
|
- x: "left",
|
|
|
- y: "top",
|
|
|
- // data: ["抽气流量", "排气流量"],
|
|
|
+ align: "left",
|
|
|
+ right: "4%",
|
|
|
+ top: "-1%",
|
|
|
+ type: "plain",
|
|
|
textStyle: {
|
|
|
- fontWeight: "normal",
|
|
|
- color: "#fff",
|
|
|
+ color: "#7ec7ff",
|
|
|
+ fontSize: 11,
|
|
|
},
|
|
|
+ // icon:'rect',
|
|
|
+ itemGap: 21,
|
|
|
+ itemWidth: 18,
|
|
|
+ icon:
|
|
|
+ "path://M0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z",
|
|
|
+
|
|
|
+ data: this.legend,
|
|
|
},
|
|
|
yAxis: [
|
|
|
{
|
|
@@ -126,149 +212,162 @@ export default {
|
|
|
],
|
|
|
title: {
|
|
|
text: this.title,
|
|
|
- padding: [5, 230],
|
|
|
+ padding: [5, 170],
|
|
|
textStyle: {
|
|
|
fontWeight: "normal", //标题颜色
|
|
|
color: "#4ADEFE",
|
|
|
+ fontSize: 15,
|
|
|
},
|
|
|
},
|
|
|
|
|
|
series: [
|
|
|
{
|
|
|
- // name: this.title,
|
|
|
+ name: "三相线电压Uab",
|
|
|
type: "line",
|
|
|
- symbol: "none",
|
|
|
- markPoint: {
|
|
|
- label: {
|
|
|
- normal: {
|
|
|
- show: true,
|
|
|
- backgroundColor: "#fff",
|
|
|
- position: "top",
|
|
|
- color: "#5AAAFA",
|
|
|
- borderColor: "rgba(90,170,250,0.3)",
|
|
|
- borderWidth: 1,
|
|
|
- padding: 8,
|
|
|
- formatter: "{b}: {c} ",
|
|
|
- },
|
|
|
+ symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
|
|
|
+ showAllSymbol: true,
|
|
|
+ symbolSize: 0,
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ normal: {
|
|
|
+ width: 2,
|
|
|
+ color: "rgba(255, 102, 102,1)", // 线条颜色
|
|
|
},
|
|
|
- symbol: "circle",
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(90,170,250,0.3)",
|
|
|
- borderWidth: 15,
|
|
|
- },
|
|
|
+ borderColor: "rgba(0,0,0,.4)",
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ color: "rgba(255, 102, 102,1)",
|
|
|
+ borderColor: "#646ace",
|
|
|
+ borderWidth: 2,
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ //区域填充样式
|
|
|
+ normal: {
|
|
|
+ //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。
|
|
|
+ color: new echarts.graphic.LinearGradient(
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "rgba(255, 102, 102,.3)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "rgba(255, 102, 102, 0)",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ shadowColor: "rgba(255, 102, 102, 0.5)", //阴影颜色
|
|
|
+ shadowBlur: 20, //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
|
|
|
},
|
|
|
- symbolSize: 7,
|
|
|
- data: [{ type: "max", name: "Max" }],
|
|
|
},
|
|
|
- lineStyle: { normal: { color: "#41D6C3", width: 1 } },
|
|
|
- // lineStyle: {
|
|
|
- // width: 2,
|
|
|
- // color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: "#9effff",
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 1,
|
|
|
- // color: "#9E87FF",
|
|
|
- // },
|
|
|
- // ]),
|
|
|
- // },
|
|
|
- areaStyle: { normal: { color: "#41D6C3", opacity: 0.5 } },
|
|
|
- connectNulls: true,
|
|
|
data: [],
|
|
|
},
|
|
|
{
|
|
|
- // name: this.title,
|
|
|
+ name: "三相线电压Ubc",
|
|
|
type: "line",
|
|
|
- symbol: "none",
|
|
|
- markPoint: {
|
|
|
- label: {
|
|
|
- normal: {
|
|
|
- show: true,
|
|
|
- backgroundColor: "#fff",
|
|
|
- position: "top",
|
|
|
- color: "#5AAAFA",
|
|
|
- borderColor: "rgba(90,170,250,0.3)",
|
|
|
- borderWidth: 1,
|
|
|
- padding: 8,
|
|
|
- formatter: "{b}: {c} ",
|
|
|
- },
|
|
|
+ symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
|
|
|
+ showAllSymbol: true,
|
|
|
+ symbolSize: 0,
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ normal: {
|
|
|
+ width: 2,
|
|
|
+ color: "rgba(255, 255, 0,1)", // 线条颜色
|
|
|
},
|
|
|
- symbol: "circle",
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(90,170,250,0.3)",
|
|
|
- borderWidth: 15,
|
|
|
- },
|
|
|
+ borderColor: "rgba(0,0,0,.4)",
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ color: "rgba(255, 255, 0,1)",
|
|
|
+ borderColor: "#646ace",
|
|
|
+ borderWidth: 2,
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ //区域填充样式
|
|
|
+ normal: {
|
|
|
+ //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。
|
|
|
+ color: new echarts.graphic.LinearGradient(
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "rgba(255, 255, 0,.3)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "rgba(255, 255, 0, 0)",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ shadowColor: "rgba(255, 255, 0, 0.5)", //阴影颜色
|
|
|
+ shadowBlur: 20, //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
|
|
|
},
|
|
|
- symbolSize: 7,
|
|
|
- data: [{ type: "max", name: "Max" }],
|
|
|
},
|
|
|
- lineStyle: { normal: { color: "#41D6C3", width: 1 } },
|
|
|
- // lineStyle: {
|
|
|
- // width: 2,
|
|
|
- // color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: "#9effff",
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 1,
|
|
|
- // color: "#9E87FF",
|
|
|
- // },
|
|
|
- // ]),
|
|
|
- // },
|
|
|
- areaStyle: { normal: { color: "#41D6C3", opacity: 0.5 } },
|
|
|
- connectNulls: true,
|
|
|
data: [],
|
|
|
},
|
|
|
{
|
|
|
- // name: this.title,
|
|
|
+ name: "三相线电压Uca",
|
|
|
type: "line",
|
|
|
- symbol: "none",
|
|
|
- markPoint: {
|
|
|
- label: {
|
|
|
- normal: {
|
|
|
- show: true,
|
|
|
- backgroundColor: "#fff",
|
|
|
- position: "top",
|
|
|
- color: "#5AAAFA",
|
|
|
- borderColor: "rgba(90,170,250,0.3)",
|
|
|
- borderWidth: 1,
|
|
|
- padding: 8,
|
|
|
- formatter: "{b}: {c} ",
|
|
|
- },
|
|
|
+ symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
|
|
|
+ showAllSymbol: true,
|
|
|
+ symbolSize: 0,
|
|
|
+ smooth: true,
|
|
|
+ lineStyle: {
|
|
|
+ normal: {
|
|
|
+ width: 2,
|
|
|
+ color: "rgba(0, 102, 153,1)", // 线条颜色
|
|
|
},
|
|
|
- symbol: "circle",
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- borderColor: "rgba(90,170,250,0.3)",
|
|
|
- borderWidth: 15,
|
|
|
- },
|
|
|
+ borderColor: "rgba(0,0,0,.4)",
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ color: "rgba(0, 102, 153,1)",
|
|
|
+ borderColor: "#3578e5",
|
|
|
+ borderWidth: 2,
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ //区域填充样式
|
|
|
+ normal: {
|
|
|
+ //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。
|
|
|
+ color: new echarts.graphic.LinearGradient(
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ 1,
|
|
|
+ [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "rgba(0, 102, 153,.3)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "rgba(0, 102, 153, 0)",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ false
|
|
|
+ ),
|
|
|
+ shadowColor: "rgba(0, 102, 153, 0.5)", //阴影颜色
|
|
|
+ shadowBlur: 20, //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
|
|
|
},
|
|
|
- symbolSize: 7,
|
|
|
- data: [{ type: "max", name: "Max" }],
|
|
|
},
|
|
|
- lineStyle: { normal: { color: "#41D6C3", width: 1 } },
|
|
|
- // lineStyle: {
|
|
|
- // width: 2,
|
|
|
- // color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: "#9effff",
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 1,
|
|
|
- // color: "#9E87FF",
|
|
|
- // },
|
|
|
- // ]),
|
|
|
- // },
|
|
|
- areaStyle: { normal: { color: "#41D6C3", opacity: 0.5 } },
|
|
|
- connectNulls: true,
|
|
|
data: [],
|
|
|
- }
|
|
|
+ },
|
|
|
],
|
|
|
},
|
|
|
};
|
|
@@ -287,7 +386,9 @@ export default {
|
|
|
// 关闭以前的websocket
|
|
|
this.websocket.close();
|
|
|
// 开启一个新的
|
|
|
- this.websocket = new WebSocket(`ws://${this.websocketIP}/hbase/ws/belt/62`);
|
|
|
+ this.websocket = new WebSocket(
|
|
|
+ `ws://${this.websocketIP}/hbase/ws/belt/${this.id}`
|
|
|
+ );
|
|
|
this.initWebSocket();
|
|
|
},
|
|
|
// 选择要展示的参数
|
|
@@ -300,29 +401,39 @@ export default {
|
|
|
}
|
|
|
switch (this.currentChartId) {
|
|
|
// 三相线电压
|
|
|
- case '1':
|
|
|
+ case 1:
|
|
|
this.unit = "V";
|
|
|
- this.type = ['Uab_after','Ubc_after','Uca_after'];
|
|
|
- break
|
|
|
- // 三相相电流
|
|
|
- case '2':
|
|
|
+ this.type = [
|
|
|
+ "xiandianyauab_after",
|
|
|
+ "xiandianyaubc_after",
|
|
|
+ "xiandianyauca_after",
|
|
|
+ ];
|
|
|
+ this.legend = ["三相线电压Uab", "三相线电压Ubc", "三相线电压Uca"];
|
|
|
+ break;
|
|
|
+ // 三相相电流
|
|
|
+ case 2:
|
|
|
this.unit = "A";
|
|
|
- this.type = ['Ia','Ib','Ic'];
|
|
|
- break
|
|
|
-
|
|
|
+ this.type = [
|
|
|
+ "xiangdianliuia_after",
|
|
|
+ "xiangdianliuib_after",
|
|
|
+ "xiangdianliuic_after",
|
|
|
+ ];
|
|
|
+ this.legend = ["三相相电流Ia", "三相相电流Ib", "三相相电流Ic"];
|
|
|
+ break;
|
|
|
}
|
|
|
- this.count = 0;
|
|
|
- this.xData = new Array(30).fill("-");
|
|
|
- this.y1Data = new Array(30).fill("-");
|
|
|
+ console.log(this.legend);
|
|
|
+ this.count = 0;
|
|
|
+ this.xData = new Array(30).fill("-");
|
|
|
+ this.y1Data = new Array(30).fill("-");
|
|
|
this.y2Data = new Array(30).fill("-");
|
|
|
this.y3Data = new Array(30).fill("-");
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
addData(data) {
|
|
|
this.websocket;
|
|
|
// 先扩展数组,然后删除多余元素
|
|
|
- console.log("data", data);
|
|
|
+
|
|
|
+ // console.log("data", data);
|
|
|
+ // console.log('this.legend',this.legend);
|
|
|
if (this.count < 30) {
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
this.y1Data[this.count] = data[i][this.type[0]];
|
|
@@ -352,17 +463,17 @@ export default {
|
|
|
],
|
|
|
series: [
|
|
|
{
|
|
|
- name: this.unit,
|
|
|
+ name: this.legend[0],
|
|
|
data: this.y1Data,
|
|
|
},
|
|
|
{
|
|
|
- name: this.unit,
|
|
|
+ name: this.legend[1],
|
|
|
data: this.y2Data,
|
|
|
},
|
|
|
{
|
|
|
- name: this.unit,
|
|
|
+ name: this.legend[2],
|
|
|
data: this.y3Data,
|
|
|
- }
|
|
|
+ },
|
|
|
],
|
|
|
});
|
|
|
// console.log("this.paiqidata", this.paiqidata);
|
|
@@ -405,7 +516,9 @@ export default {
|
|
|
// 先画图
|
|
|
this.myChart = this.$echarts.init(this.$refs.testLine);
|
|
|
this.myChart.setOption(this.option);
|
|
|
- this.websocket = new WebSocket(`ws://${this.websocketIP}/hbase/ws/belt/62`);
|
|
|
+ this.websocket = new WebSocket(
|
|
|
+ `ws://${this.websocketIP}/hbase/ws/belt/${this.id}`
|
|
|
+ );
|
|
|
this.initWebSocket();
|
|
|
},
|
|
|
};
|