|
@@ -257,7 +257,52 @@ export default {
|
|
|
}
|
|
|
|
|
|
// 绘制图表
|
|
|
- Plotly.newPlot(`power-curve-plot${this.inds}`, data, layout);
|
|
|
+ Plotly.newPlot(`power-curve-plot${this.inds}`, data, layout, {
|
|
|
+ modeBarButtonsToRemove: [
|
|
|
+ "lasso2d", // 移除不需要的工具按钮
|
|
|
+ // 移除不需要的工具按钮
|
|
|
+ "lasso2d",
|
|
|
+ "sendDataToCloud",
|
|
|
+ "resetCameraLastSave3d",
|
|
|
+ "resetCameraDefault3d",
|
|
|
+ "resetCameraLastSave",
|
|
|
+ "sendDataToCloud",
|
|
|
+ "zoom2d", // 缩放按钮
|
|
|
+ "zoom3d",
|
|
|
+ "plotlylogo2D",
|
|
|
+ "plotlylogo3D",
|
|
|
+ ],
|
|
|
+ displaylogo: false,
|
|
|
+ }).then(function (gd) {
|
|
|
+ // 获取工具栏按钮
|
|
|
+ const toolbar = gd.querySelector(".modebar");
|
|
|
+ const buttons = toolbar.querySelectorAll(".modebar-btn");
|
|
|
+
|
|
|
+ // 定义一个映射对象,方便修改按钮提示
|
|
|
+ const titleMap = {
|
|
|
+ "Download plot as a png": "保存图片",
|
|
|
+ Autoscale: "缩放",
|
|
|
+ Pan: "平移",
|
|
|
+ "Zoom out": "放大",
|
|
|
+ "Zoom in": "缩小",
|
|
|
+ "Box Select": "选择框操作",
|
|
|
+ "Lasso Select": "套索选择操作",
|
|
|
+ "Reset axes": "重置操作",
|
|
|
+ "Reset camera to default": "重置相机视角",
|
|
|
+ "Turntable rotation": "转台式旋转",
|
|
|
+ "Orbital rotation": "轨道式旋转",
|
|
|
+ };
|
|
|
+
|
|
|
+ // 遍历所有按钮,修改它们的 title
|
|
|
+ buttons.forEach(function (button) {
|
|
|
+ const dataTitle = button.getAttribute("data-title");
|
|
|
+
|
|
|
+ // 如果标题匹配,修改属性值
|
|
|
+ if (titleMap[dataTitle]) {
|
|
|
+ button.setAttribute("data-title", titleMap[dataTitle]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
//初始化分图
|
|
@@ -351,7 +396,52 @@ export default {
|
|
|
`风速: %{x} m/s<br>合同功率: %{y} kW<br>` +
|
|
|
`${this.powerCurveData.contractPowerCurve[0].enginName}<extra></extra>`, // 设置 hovertemplate
|
|
|
});
|
|
|
- Plotly.newPlot(`chart-${this.inds}`, data, layout);
|
|
|
+ Plotly.newPlot(`chart-${this.inds}`, data, layout, {
|
|
|
+ modeBarButtonsToRemove: [
|
|
|
+ "lasso2d", // 移除不需要的工具按钮
|
|
|
+ // 移除不需要的工具按钮
|
|
|
+ "lasso2d",
|
|
|
+ "sendDataToCloud",
|
|
|
+ "resetCameraLastSave3d",
|
|
|
+ "resetCameraDefault3d",
|
|
|
+ "resetCameraLastSave",
|
|
|
+ "sendDataToCloud",
|
|
|
+ "zoom2d", // 缩放按钮
|
|
|
+ "zoom3d",
|
|
|
+ "plotlylogo2D",
|
|
|
+ "plotlylogo3D",
|
|
|
+ ],
|
|
|
+ displaylogo: false,
|
|
|
+ }).then(function (gd) {
|
|
|
+ // 获取工具栏按钮
|
|
|
+ const toolbar = gd.querySelector(".modebar");
|
|
|
+ const buttons = toolbar.querySelectorAll(".modebar-btn");
|
|
|
+
|
|
|
+ // 定义一个映射对象,方便修改按钮提示
|
|
|
+ const titleMap = {
|
|
|
+ "Download plot as a png": "保存图片",
|
|
|
+ Autoscale: "缩放",
|
|
|
+ Pan: "平移",
|
|
|
+ "Zoom out": "放大",
|
|
|
+ "Zoom in": "缩小",
|
|
|
+ "Box Select": "选择框操作",
|
|
|
+ "Lasso Select": "套索选择操作",
|
|
|
+ "Reset axes": "重置操作",
|
|
|
+ "Reset camera to default": "重置相机视角",
|
|
|
+ "Turntable rotation": "转台式旋转",
|
|
|
+ "Orbital rotation": "轨道式旋转",
|
|
|
+ };
|
|
|
+
|
|
|
+ // 遍历所有按钮,修改它们的 title
|
|
|
+ buttons.forEach(function (button) {
|
|
|
+ const dataTitle = button.getAttribute("data-title");
|
|
|
+
|
|
|
+ // 如果标题匹配,修改属性值
|
|
|
+ if (titleMap[dataTitle]) {
|
|
|
+ button.setAttribute("data-title", titleMap[dataTitle]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
// 切换图表类型
|