|
@@ -1,7 +1,7 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2024-09-11 14:32:12
|
|
|
- * @LastEditTime: 2025-07-14 10:21:14
|
|
|
+ * @LastEditTime: 2025-07-14 13:49:33
|
|
|
* @LastEditors: bogon
|
|
|
* @Description: In User Settings Edit
|
|
|
* @FilePath: /performance-test/src/views/performance/components/chartsCom/powerMarkers2DCharts.vue
|
|
@@ -275,6 +275,7 @@ export default {
|
|
|
"%{y} <br>" +
|
|
|
`时间: %{customdata}<extra></extra>`, // 在 hover 中显示格式化后的时间
|
|
|
customdata: data.colorbar || data.color, // 将格式化后的时间存入 customdata
|
|
|
+ timedata: data.timeData,
|
|
|
};
|
|
|
}
|
|
|
if (lineData) {
|
|
@@ -430,13 +431,13 @@ export default {
|
|
|
const pointIndex = data.points[0].pointIndex;
|
|
|
const xClick = data.points[0].x;
|
|
|
const yClick = data.points[0].y;
|
|
|
- // console.log(data.points[0], "data.points[0]");
|
|
|
+
|
|
|
// 将点击的点添加到选中的点数组
|
|
|
this.selectedPoints.push({
|
|
|
x: xClick, // 点击点的 x 坐标
|
|
|
y: yClick, // 点击点的 y 坐标
|
|
|
index: pointIndex, // 点击点的索引
|
|
|
- time: data.points[0].timeData, // 点击点的时间信息
|
|
|
+ time: data.points[0]?.data?.timedata[data.points[0].pointIndex], // 点击点的时间信息
|
|
|
});
|
|
|
|
|
|
// 初始化颜色和大小数组
|
|
@@ -462,20 +463,17 @@ export default {
|
|
|
|
|
|
// 用于跟踪已添加的 (x, y) 组合
|
|
|
const addedPoints = {};
|
|
|
-
|
|
|
// 遍历图表数据中的所有点,检查是否在多边形内
|
|
|
gd.data[0].x.forEach((xVal, i) => {
|
|
|
const yVal = gd.data[0].y[i];
|
|
|
if (inPolygon(xVal, yVal, xv, yv)) {
|
|
|
const pointKey = `${xVal}-${yVal}`;
|
|
|
if (!addedPoints[pointKey]) {
|
|
|
- // console.log(gd.data[0], "gd.data[0]");
|
|
|
this.selectedPoints.push({
|
|
|
x: gd.data[0].x[i],
|
|
|
y: gd.data[0].y[i],
|
|
|
- time: gd.data[0].text[i],
|
|
|
+ time: gd.data[0].timedata[i],
|
|
|
});
|
|
|
-
|
|
|
newColors[i] = "red"; // 高亮选择的点
|
|
|
newSize[i] = 10; // 设置点的大小
|
|
|
addedPoints[pointKey] = true;
|
|
@@ -490,30 +488,6 @@ export default {
|
|
|
newSize[point.index] = 10;
|
|
|
});
|
|
|
|
|
|
- // 使用 Plotly.restyle 更新颜色和大小
|
|
|
- // Plotly.restyle(gd, {
|
|
|
- // "marker.color": [newColors],
|
|
|
- // "marker.size": [newSize],
|
|
|
- // });
|
|
|
-
|
|
|
- // // 确保选中的点在最上面
|
|
|
- // const scatterTrace = gd.data[0]; // 原来的散点数据
|
|
|
- // const selectedTrace = {
|
|
|
- // x: this.selectedPoints.map((p) => p.x),
|
|
|
- // y: this.selectedPoints.map((p) => p.y),
|
|
|
- // mode: "markers",
|
|
|
- // type: "scattergl",
|
|
|
- // marker: {
|
|
|
- // color: "red", // 选中点颜色
|
|
|
- // size: 10,
|
|
|
- // },
|
|
|
- // };
|
|
|
-
|
|
|
- // // 合并数据,并保证选中点在最后
|
|
|
- // const updatedTraces = [scatterTrace, selectedTrace]; // 选中的点 `selectedTrace` 放在最后
|
|
|
-
|
|
|
- // // 更新图表
|
|
|
- // Plotly.react(gd, updatedTraces, gd.layout);
|
|
|
Plotly.addTraces(gd, {
|
|
|
x: this.selectedPoints.map((p) => p.x),
|
|
|
y: this.selectedPoints.map((p) => p.y),
|
|
@@ -553,18 +527,25 @@ export default {
|
|
|
const paramValueTypes = await axios.get("/ETLapi/sysConf/getByType", {
|
|
|
params: { type: "en_cn_mapping" },
|
|
|
});
|
|
|
- // console.log(paramValueTypes, "paramValueTypes");
|
|
|
+ console.log(paramValueTypes, "paramValueTypes");
|
|
|
const headers = [this.chartData.xaixs, this.chartData.yaixs];
|
|
|
const csvRows = [headers]; // 保存标头
|
|
|
// 使用 Set 或 Map 去重
|
|
|
const uniquePoints = [];
|
|
|
-
|
|
|
this.selectedPoints.forEach((point) => {
|
|
|
if (!uniquePoints.some((p) => p.x === point.x && p.y === point.y)) {
|
|
|
uniquePoints.push(point);
|
|
|
}
|
|
|
});
|
|
|
+ const newTimedata = uniquePoints.map((item) => item.time);
|
|
|
+ console.log(newTimedata, "newTimedata");
|
|
|
console.log(uniquePoints, "uniquePoints");
|
|
|
+ await axios.post("/ETLapi/dataTransfer/getWindTurbineAndTimestamps", {
|
|
|
+ timestamps: [...newTimedata],
|
|
|
+ transferType: "", //分析数据源类型
|
|
|
+ windFarmCode: "", //风场编号
|
|
|
+ windTurbineNumber: "", //风机编号
|
|
|
+ });
|
|
|
// // 将去重后的点加入 CSV 数据
|
|
|
// uniquePoints.forEach((point) => {
|
|
|
// csvRows.push(`${point.x},${point.y}`);
|