Update plot_ph_week.html
Browse files- plot_ph_week.html +38 -89
plot_ph_week.html
CHANGED
@@ -55,108 +55,56 @@
|
|
55 |
</div>
|
56 |
|
57 |
{% if data %}
|
58 |
-
<div class="graph-container">
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
<div class="graph-container">
|
64 |
-
|
65 |
-
<div class="graph" id="ec_chart"></div>
|
66 |
-
</div>
|
67 |
-
|
68 |
-
<div class="graph-container">
|
69 |
-
<!-- График насосов -->
|
70 |
-
<div class="graph" id="pump_chart"></div>
|
71 |
-
</div>
|
72 |
|
73 |
<script>
|
74 |
-
const data = {{ data | tojson }};
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
x: data.dates,
|
79 |
-
y: data.ph,
|
80 |
-
type: "scatter",
|
81 |
-
mode: "lines+markers",
|
82 |
-
name: "pH",
|
83 |
-
line: { color: "blue" },
|
84 |
-
hovertemplate: data.days_of_week.map((day, index) =>
|
85 |
-
`День недели: ${day}<br>pH: %{y}<br>Дата: ${data.dates[index]}`
|
86 |
-
)
|
87 |
-
}], {
|
88 |
-
title: `График pH за ${data.week}-ю неделю`,
|
89 |
-
xaxis: { title: "Дата" },
|
90 |
-
yaxis: {
|
91 |
-
title: "Уровень pH",
|
92 |
-
titlefont: { size: 14 }
|
93 |
-
},
|
94 |
-
hovermode: "closest",
|
95 |
-
showlegend: false
|
96 |
-
});
|
97 |
-
|
98 |
-
Plotly.newPlot("ec_chart", [{
|
99 |
-
x: data.dates,
|
100 |
-
y: data.ec,
|
101 |
-
type: "scatter",
|
102 |
-
mode: "lines+markers",
|
103 |
-
name: "EC",
|
104 |
-
line: { color: "blue" },
|
105 |
-
hovertemplate: data.days_of_week.map((day, index) =>
|
106 |
-
`День недели: ${day}<br>EC: %{y}<br>Дата: ${data.dates[index]}`
|
107 |
-
)
|
108 |
-
}], {
|
109 |
-
title: `График EC за ${data.week}-ю неделю`,
|
110 |
-
xaxis: { title: "Дата" },
|
111 |
-
yaxis: {
|
112 |
-
title: "Уровень EC",
|
113 |
-
titlefont: { size: 14 }
|
114 |
-
},
|
115 |
-
hovermode: "closest",
|
116 |
-
showlegend: false
|
117 |
-
});
|
118 |
-
|
119 |
-
Plotly.newPlot("pump_chart", [
|
120 |
-
{
|
121 |
x: data.dates,
|
122 |
-
y:
|
123 |
type: "scatter",
|
124 |
mode: "lines+markers",
|
125 |
-
name:
|
126 |
-
line: { color:
|
127 |
hovertemplate: data.days_of_week.map((day, index) =>
|
128 |
-
`День недели: ${day}<br
|
129 |
)
|
130 |
-
},
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
`День недели: ${day}<br>Насос C: %{y}сек.<br>Дата: ${data.dates[index]}`
|
151 |
-
)
|
152 |
-
}
|
153 |
], {
|
154 |
title: `График работы насосов за ${data.week}-ю неделю`,
|
155 |
xaxis: { title: "Дата" },
|
156 |
yaxis: { title: "Состояние насосов" },
|
157 |
hovermode: "closest",
|
158 |
-
showlegend:
|
159 |
});
|
|
|
160 |
</script>
|
161 |
|
162 |
{% else %}
|
@@ -177,4 +125,5 @@
|
|
177 |
|
178 |
</body>
|
179 |
|
|
|
180 |
</html>
|
|
|
55 |
</div>
|
56 |
|
57 |
{% if data %}
|
58 |
+
<div class="graph-container"><div class="graph" id="ph_chart"></div></div>
|
59 |
+
<div class="graph-container"><div class="graph" id="ec_chart"></div></div>
|
60 |
+
<div class="graph-container"><div class="graph" id="pump_chart"></div></div>
|
61 |
+
<div class="graph-container"><div class="graph" id="ts_chart"></div></div>
|
62 |
+
<div class="graph-container"><div class="graph" id="ta_chart"></div></div>
|
63 |
+
<div class="graph-container"><div class="graph" id="hdm_chart"></div></div>
|
64 |
+
<div class="graph-container"><div class="graph" id="sven_chart"></div></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
<script>
|
67 |
+
const data = {{ data | tojson }};
|
68 |
+
|
69 |
+
function renderPlot(id, yData, title, yTitle, color) {
|
70 |
+
Plotly.newPlot(id, [{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
x: data.dates,
|
72 |
+
y: yData,
|
73 |
type: "scatter",
|
74 |
mode: "lines+markers",
|
75 |
+
name: title,
|
76 |
+
line: { color: color },
|
77 |
hovertemplate: data.days_of_week.map((day, index) =>
|
78 |
+
`День недели: ${day}<br>${title}: %{y}<br>Дата: ${data.dates[index]}`
|
79 |
)
|
80 |
+
}], {
|
81 |
+
title: `График ${title} за ${data.week}-ю неделю`,
|
82 |
+
xaxis: { title: "Дата" },
|
83 |
+
yaxis: { title: yTitle, titlefont: { size: 14 } },
|
84 |
+
hovermode: "closest",
|
85 |
+
showlegend: false
|
86 |
+
});
|
87 |
+
}
|
88 |
+
|
89 |
+
renderPlot("ph_chart", data.ph, "pH", "Уровень pH", "blue");
|
90 |
+
renderPlot("ec_chart", data.ec, "EC", "Уровень EC", "red");
|
91 |
+
renderPlot("ts_chart", data.tS, "Температура раствора", "Температура (°C)", "purple");
|
92 |
+
renderPlot("ta_chart", data.tA, "Температура воздуха", "Температура (°C)", "orange");
|
93 |
+
renderPlot("hdm_chart", data.hDm, "Влажность воздуха", "Влажность (%)", "green");
|
94 |
+
renderPlot("sven_chart", data.sVen, "Обороты вентилятора", "Обороты", "brown");
|
95 |
+
|
96 |
+
Plotly.newPlot("pump_chart", [
|
97 |
+
{ x: data.dates, y: data.onA, type: "scatter", mode: "lines+markers", name: "Насос A", line: { color: "green" } },
|
98 |
+
{ x: data.dates, y: data.onB, type: "scatter", mode: "lines+markers", name: "Насос B", line: { color: "brown" } },
|
99 |
+
{ x: data.dates, y: data.onC, type: "scatter", mode: "lines+markers", name: "Насос C", line: { color: "orange" } }
|
|
|
|
|
|
|
100 |
], {
|
101 |
title: `График работы насосов за ${data.week}-ю неделю`,
|
102 |
xaxis: { title: "Дата" },
|
103 |
yaxis: { title: "Состояние насосов" },
|
104 |
hovermode: "closest",
|
105 |
+
showlegend: true
|
106 |
});
|
107 |
+
|
108 |
</script>
|
109 |
|
110 |
{% else %}
|
|
|
125 |
|
126 |
</body>
|
127 |
|
128 |
+
|
129 |
</html>
|