|
@@ -179,52 +179,170 @@ export default {
|
|
|
Plotly.newPlot(`power-curve-plot${this.inds}`, data, layout);
|
|
|
},
|
|
|
//初始化分图
|
|
|
- //初始化分图
|
|
|
initializeEngineCharts() {
|
|
|
const fentuCharts = this.powerCurveData.turbines.filter(
|
|
|
(item) =>
|
|
|
item.enginCode === this.lineMarkerData?.formInfoFieldEngineCode ||
|
|
|
item.enginName === this.lineMarkerData?.formInfoFieldEngineCode
|
|
|
);
|
|
|
- const data = [];
|
|
|
- const layout = {
|
|
|
- title:
|
|
|
- fentuCharts[0].enginName ||
|
|
|
- fentuCharts[0].enginCode + "风机有功功率曲线分析",
|
|
|
- plot_bgcolor: this.config.lableConfig.plot_bgcolor,
|
|
|
- xaxis: this.config.lableConfig.xaxis,
|
|
|
- yaxis: this.config.lableConfig.yaxis,
|
|
|
- legend: this.config.lableConfig.legend,
|
|
|
- };
|
|
|
- this.powerCurveData.turbines.forEach((turbine, index) => {
|
|
|
+ if (fentuCharts[0]?.enginName || fentuCharts[0]?.enginCode) {
|
|
|
+ const highlightedData = [];
|
|
|
+ const nonHighlightedData = [];
|
|
|
+ const layout = {
|
|
|
+ title:
|
|
|
+ fentuCharts[0]?.enginName ||
|
|
|
+ fentuCharts[0]?.enginCode + "风机有功功率曲线分析",
|
|
|
+ plot_bgcolor: this.config.lableConfig.plot_bgcolor,
|
|
|
+ xaxis: this.config.lableConfig.xaxis,
|
|
|
+ yaxis: this.config.lableConfig.yaxis,
|
|
|
+ legend: this.config.lableConfig.legend,
|
|
|
+ };
|
|
|
+ // 先渲染其他的风机数据
|
|
|
+ this.powerCurveData.turbines.forEach((turbine, index) => {
|
|
|
+ const isHighlighted =
|
|
|
+ turbine?.enginCode ===
|
|
|
+ this.lineMarkerData?.formInfoFieldEngineCode ||
|
|
|
+ turbine?.enginName === this.lineMarkerData?.formInfoFieldEngineCode;
|
|
|
+
|
|
|
+ const trace = {
|
|
|
+ x: turbine.xData,
|
|
|
+ y: turbine.yData.map((val) => (val !== null ? val : 0.0)),
|
|
|
+ mode: "lines",
|
|
|
+ name: turbine.enginName,
|
|
|
+ line: {
|
|
|
+ color: isHighlighted ? "#1c77b3" : "#d3d3d3",
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ if (isHighlighted) {
|
|
|
+ highlightedData.push(trace); // 高亮的线条放入 highlighedData
|
|
|
+ } else {
|
|
|
+ nonHighlightedData.push(trace); // 非高亮的线条放入 nonHighlightedData
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 先添加非高亮的风机数据
|
|
|
+ const data = [...nonHighlightedData, ...highlightedData]; // 高亮的风机数据最后添加
|
|
|
+ // 添加合同功率曲线
|
|
|
data.push({
|
|
|
- x: turbine.xData,
|
|
|
- y: turbine.yData.map((val) => (val !== null ? val : 0.0)),
|
|
|
- mode: "lines",
|
|
|
- name: turbine.enginName,
|
|
|
+ x: this.powerCurveData.contractPowerCurve[0].xData,
|
|
|
+ y: this.powerCurveData.contractPowerCurve[0].yData,
|
|
|
+ mode: "lines+markers",
|
|
|
+ name: this.powerCurveData.contractPowerCurve[0].enginName,
|
|
|
line: {
|
|
|
- color:
|
|
|
- turbine?.enginCode ===
|
|
|
- this.lineMarkerData?.formInfoFieldEngineCode ||
|
|
|
- turbine?.enginName ===
|
|
|
- this.lineMarkerData?.formInfoFieldEngineCode
|
|
|
- ? "#1c77b3"
|
|
|
- : "#d3d3d3",
|
|
|
+ color: "red",
|
|
|
},
|
|
|
});
|
|
|
- });
|
|
|
-
|
|
|
- data.push({
|
|
|
- x: this.powerCurveData.contractPowerCurve[0].xData,
|
|
|
- y: this.powerCurveData.contractPowerCurve[0].yData,
|
|
|
- mode: "lines+markers",
|
|
|
- name: this.powerCurveData.contractPowerCurve[0].enginName,
|
|
|
- line: {
|
|
|
- color: "red",
|
|
|
- },
|
|
|
- });
|
|
|
- Plotly.newPlot(`chart-${this.inds}`, data, layout);
|
|
|
+ Plotly.newPlot(`chart-${this.inds}`, data, layout);
|
|
|
+ }
|
|
|
},
|
|
|
+
|
|
|
+ // initializeEngineCharts() {
|
|
|
+ // console.log(this.lineMarkerData, "enginName");
|
|
|
+ // const fentuCharts = this.powerCurveData.turbines.filter(
|
|
|
+ // (item) =>
|
|
|
+ // item.enginCode === this.lineMarkerData?.formInfoFieldEngineCode ||
|
|
|
+ // item.enginName === this.lineMarkerData?.formInfoFieldEngineCode
|
|
|
+ // );
|
|
|
+ // const data = [];
|
|
|
+ // const layout = {
|
|
|
+ // title:
|
|
|
+ // fentuCharts[0]?.enginName ||
|
|
|
+ // fentuCharts[0]?.enginCode + "风机有功功率曲线分析",
|
|
|
+ // plot_bgcolor: this.config.lableConfig.plot_bgcolor,
|
|
|
+ // xaxis: this.config.lableConfig.xaxis,
|
|
|
+ // yaxis: this.config.lableConfig.yaxis,
|
|
|
+ // legend: this.config.lableConfig.legend,
|
|
|
+ // };
|
|
|
+
|
|
|
+ // // 先渲染其他的风机数据
|
|
|
+ // this.powerCurveData.turbines.forEach((turbine, index) => {
|
|
|
+ // const isHighlighted =
|
|
|
+ // turbine?.enginCode === this.lineMarkerData?.formInfoFieldEngineCode ||
|
|
|
+ // turbine?.enginName === this.lineMarkerData?.formInfoFieldEngineCode;
|
|
|
+
|
|
|
+ // // 这里将高亮的风机与其他风机分开
|
|
|
+ // data.push({
|
|
|
+ // x: turbine.xData,
|
|
|
+ // y: turbine.yData.map((val) => (val !== null ? val : 0.0)),
|
|
|
+ // mode: "lines",
|
|
|
+ // name: turbine.enginName,
|
|
|
+ // line: {
|
|
|
+ // color: isHighlighted ? "#1c77b3" : "#d3d3d3", // 高亮的线条使用指定颜色
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+
|
|
|
+ // // 将高亮的风机放在最后,确保它显示在其他线条上面
|
|
|
+ // const highlightedData = data.filter(
|
|
|
+ // (item) => item.line.color === "#1c77b3"
|
|
|
+ // );
|
|
|
+ // const nonHighlightedData = data.filter(
|
|
|
+ // (item) => item.line.color !== "#1c77b3"
|
|
|
+ // );
|
|
|
+
|
|
|
+ // // 把高亮的线条放在数据的最后
|
|
|
+ // data.length = 0;
|
|
|
+ // data.push(...nonHighlightedData, ...highlightedData); // 将非高亮的线条先添加,最后添加高亮线条
|
|
|
+
|
|
|
+ // // 添加合同功率曲线
|
|
|
+ // data.push({
|
|
|
+ // x: this.powerCurveData.contractPowerCurve[0].xData,
|
|
|
+ // y: this.powerCurveData.contractPowerCurve[0].yData,
|
|
|
+ // mode: "lines+markers",
|
|
|
+ // name: this.powerCurveData.contractPowerCurve[0].enginName,
|
|
|
+ // line: {
|
|
|
+ // color: "red",
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+
|
|
|
+ // Plotly.newPlot(`chart-${this.inds}`, data, layout);
|
|
|
+ // },
|
|
|
+
|
|
|
+ // initializeEngineCharts() {
|
|
|
+ // console.log(this.lineMarkerData, "enginName");
|
|
|
+ // const fentuCharts = this.powerCurveData.turbines.filter(
|
|
|
+ // (item) =>
|
|
|
+ // item.enginCode === this.lineMarkerData?.formInfoFieldEngineCode ||
|
|
|
+ // item.enginName === this.lineMarkerData?.formInfoFieldEngineCode
|
|
|
+ // );
|
|
|
+ // const data = [];
|
|
|
+ // const layout = {
|
|
|
+ // title:
|
|
|
+ // fentuCharts[0]?.enginName ||
|
|
|
+ // fentuCharts[0]?.enginCode + "风机有功功率曲线分析",
|
|
|
+ // plot_bgcolor: this.config.lableConfig.plot_bgcolor,
|
|
|
+ // xaxis: this.config.lableConfig.xaxis,
|
|
|
+ // yaxis: this.config.lableConfig.yaxis,
|
|
|
+ // legend: this.config.lableConfig.legend,
|
|
|
+ // };
|
|
|
+ // this.powerCurveData.turbines.forEach((turbine, index) => {
|
|
|
+ // const isHighlighted =
|
|
|
+ // turbine?.enginCode === this.lineMarkerData?.formInfoFieldEngineCode ||
|
|
|
+ // turbine?.enginName === this.lineMarkerData?.formInfoFieldEngineCode;
|
|
|
+
|
|
|
+ // data.push({
|
|
|
+ // x: turbine.xData,
|
|
|
+ // y: turbine.yData.map((val) => (val !== null ? val : 0.0)),
|
|
|
+ // mode: "lines",
|
|
|
+ // name: turbine.enginName,
|
|
|
+ // line: {
|
|
|
+ // color: isHighlighted ? "#1c77b3" : "#d3d3d3", // 如果是高亮的线条,设置为指定颜色
|
|
|
+ // // 使用 layer 属性来控制堆叠顺序
|
|
|
+ // layer: isHighlighted ? "above traces" : "below traces", // 高亮线条显示在其他线条上面
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // data.push({
|
|
|
+ // x: this.powerCurveData.contractPowerCurve[0].xData,
|
|
|
+ // y: this.powerCurveData.contractPowerCurve[0].yData,
|
|
|
+ // mode: "lines+markers",
|
|
|
+ // name: this.powerCurveData.contractPowerCurve[0].enginName,
|
|
|
+ // line: {
|
|
|
+ // color: "red",
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // Plotly.newPlot(`chart-${this.inds}`, data, layout);
|
|
|
+ // },
|
|
|
},
|
|
|
};
|
|
|
</script>
|