|
|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2025-07-24 17:30:10
|
|
|
- * @LastEditTime: 2025-07-30 17:02:41
|
|
|
+ * @LastEditTime: 2025-08-18 09:42:29
|
|
|
* @LastEditors: bogon
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: /performance-test/src/views/performance/components/chartsCom/LineAndScatter.vue
|
|
|
@@ -46,7 +46,7 @@
|
|
|
v-loading="loading"
|
|
|
:id="`bar-chart${index}`"
|
|
|
:ref="`bar-chart${index}`"
|
|
|
- style="width: 100%; height: 400px"
|
|
|
+ style="width: 100%; height: 500px"
|
|
|
>
|
|
|
<el-empty v-if="isError" description="请求失败"></el-empty>
|
|
|
</div>
|
|
|
@@ -60,6 +60,8 @@ import axios from "axios";
|
|
|
import { colorSchemes } from "@/views/overview/js/colors.js";
|
|
|
import { myMixin } from "@/mixins/chartRequestMixin"; // 假设你需要的 mixin
|
|
|
import { mapState } from "vuex";
|
|
|
+import yaw_error3 from "./json/yaw_error3.json";
|
|
|
+
|
|
|
export default {
|
|
|
props: {
|
|
|
fileAddr: {
|
|
|
@@ -115,12 +117,13 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
- if (this.fileAddr) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.color1 = this.colorSchemes[0].colors;
|
|
|
- this.getData();
|
|
|
- });
|
|
|
- }
|
|
|
+ this.getData();
|
|
|
+ // if (this.fileAddr) {
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.color1 = this.colorSchemes[0].colors;
|
|
|
+ // this.getData();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取数据
|
|
|
@@ -145,6 +148,14 @@ export default {
|
|
|
this.isError = true;
|
|
|
this.loading = false;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.chartData = yaw_error3;
|
|
|
+ // 使用 nextTick 来确保 DOM 渲染完成后绘制图表
|
|
|
+ nextTick(() => {
|
|
|
+ this.drawChart();
|
|
|
+ });
|
|
|
+ this.isError = false;
|
|
|
+ this.loading = false;
|
|
|
}
|
|
|
},
|
|
|
// 绘制图表
|
|
|
@@ -180,6 +191,7 @@ export default {
|
|
|
// size: 12,
|
|
|
symbol: index === 0 ? "circle" : index === 1 ? "x" : "etc.", // 也可以是 "circle", "diamond", "x", etc.
|
|
|
},
|
|
|
+
|
|
|
hovertemplate:
|
|
|
`${this.chartData.xaixs}:` +
|
|
|
` %{x} <br> ` +
|
|
|
@@ -187,7 +199,7 @@ export default {
|
|
|
"%{y} <br>",
|
|
|
};
|
|
|
// ✅ 设置 y2 绑定逻辑
|
|
|
- if (index === 3) {
|
|
|
+ if (index === 1 || index === 2) {
|
|
|
chartConfig.yaxis = "y2";
|
|
|
}
|
|
|
if (this.chartType === "line") {
|
|
|
@@ -209,6 +221,13 @@ export default {
|
|
|
weight: "bold",
|
|
|
},
|
|
|
},
|
|
|
+ legend: {
|
|
|
+ orientation: "h",
|
|
|
+ x: 0.5,
|
|
|
+ y: -0.3,
|
|
|
+ xanchor: "center",
|
|
|
+ yanchor: "top",
|
|
|
+ },
|
|
|
xaxis: {
|
|
|
title: this.chartData.xaixs || "X轴", // 横坐标标题
|
|
|
gridcolor: "rgb(255,255,255)",
|
|
|
@@ -248,13 +267,11 @@ export default {
|
|
|
position: 1, // 调整右侧轴的位置
|
|
|
showline: true,
|
|
|
linecolor: "#1A295D", // 设置右侧轴线颜色
|
|
|
+ automargin: true,
|
|
|
},
|
|
|
- margin: {
|
|
|
- l: 50,
|
|
|
- r: 50,
|
|
|
- t: 50,
|
|
|
- b: 50,
|
|
|
- },
|
|
|
+ // margin: {
|
|
|
+ // r: 150,
|
|
|
+ // },
|
|
|
plot_bgcolor: "#e5ecf6",
|
|
|
gridcolor: "#fff",
|
|
|
bgcolor: "#e5ecf6", // 设置背景颜色
|