Sun, 24 Feb 2019 23:26:51 +0100
Added view archives by name
172 | 1 | /***************************************************************************** |
2 | * Copyright (C) 2019 | |
3 | * | |
4 | * Michiel Broek <mbroek at mbse dot eu> | |
5 | * | |
6 | * This file is part of BMS | |
7 | * | |
8 | * This is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the | |
10 | * Free Software Foundation; either version 2, or (at your option) any | |
11 | * later version. | |
12 | * | |
13 | * Brewery Managment System is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
21 | *****************************************************************************/ | |
22 | ||
23 | ||
24 | $(document).ready(function () { | |
25 | ||
26 | $("#jqxLoader").jqxLoader({ | |
27 | width: 250, | |
28 | height: 150, | |
29 | isModal: true, | |
30 | text: "Opmaken grafiek ...", | |
31 | theme: theme | |
32 | }); | |
33 | $('#jqxLoader').jqxLoader('open'); | |
34 | ||
35 | function getExportServer() { | |
36 | return "https://www.jqwidgets.com/export_server/export.php"; | |
37 | } | |
38 | ||
39 | var sourceA = { | |
40 | datatype: "json", | |
41 | datafields: [ | |
42 | { name: "date", type: "date", format: "yyyy-MM-dd HH:mm" }, | |
43 | { name: "air", type: "float" }, | |
44 | { name: "beer", type: "float" }, | |
194
d202777ebae5
Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents:
193
diff
changeset
|
45 | { name: "chiller", type: "float" }, |
d202777ebae5
Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents:
193
diff
changeset
|
46 | { name: "room", type: "float" }, |
172 | 47 | { name: "tlo", type: "float" }, |
48 | { name: "thi", type: "float" }, | |
49 | { name: "heater", type: "int" }, | |
50 | { name: "cooler", type: "int" }, | |
194
d202777ebae5
Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents:
193
diff
changeset
|
51 | { name: "event", type: "string" } |
172 | 52 | ], |
194
d202777ebae5
Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents:
193
diff
changeset
|
53 | url: 'getfermentlog.php?code=' + my_code + '&name=' + my_name |
172 | 54 | }; |
55 | var dataAdapter = new $.jqx.dataAdapter(sourceA, { | |
56 | autoBind: true, | |
57 | async: false, | |
58 | loadComplete: function () { | |
59 | $('#jqxLoader').jqxLoader('close'); | |
60 | }, | |
61 | loadError: function (jqXHR, status, error) { | |
62 | } | |
63 | }); | |
64 | ||
65 | var settings = { | |
66 | title: my_code + ' "' + my_name + '"', | |
67 | description: "", | |
68 | source: dataAdapter, | |
69 | xAxis: { | |
70 | dataField: 'date', | |
71 | type: 'date', | |
72 | formatFunction: function (value) { | |
73 | return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear(); | |
74 | }, | |
75 | toolTipFormatFunction: function (value) { | |
76 | var h = value.getHours(); | |
77 | var m = value.getMinutes(); | |
78 | return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear() | |
79 | + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m); | |
80 | }, | |
81 | textRotationAngle: 45, | |
82 | howGridLines: false, | |
83 | rangeSelector: { | |
84 | size: 90, | |
85 | dataField: 'beer', | |
86 | serieType: 'line', | |
87 | gridLines: {visible: false}, | |
88 | } | |
89 | }, | |
90 | colorScheme: 'scheme01', | |
91 | seriesGroups: [ | |
92 | { | |
193 | 93 | type: "area", |
172 | 94 | valueAxis: { |
95 | minValue: 0, | |
96 | maxValue: 100, | |
97 | displayValueAxis: false, | |
98 | description: "Heat/Cool %" | |
99 | }, | |
100 | series: [ | |
180
a5aa3502310c
Updated README. Getfermenter and getnode scripts return 0 and 1 instead of false and true for boolean values. Global variable my_uuid added. Moved the javascript out of mon_fermenter.php. Added log chart view button in the fermenter monitor.
Michiel Broek <mbroek@mbse.eu>
parents:
179
diff
changeset
|
101 | { dataField: "cooler", lineWidth: 1, displayText: "Cool %", opacity: 0.4 }, |
193 | 102 | { dataField: "heater", lineWidth: 1, displayText: "Heat %", opacity: 0.3 } |
172 | 103 | ] |
104 | }, | |
105 | { | |
106 | type: 'spline', | |
107 | valueAxis: { | |
108 | minValue: 0, | |
109 | description: 'Graden C' | |
110 | }, | |
111 | series: [ | |
112 | { dataField: "air", lineWidth: 1, displayText: "Air" }, | |
113 | { dataField: "beer", lineWidth: 2, displayText: "Beer" }, | |
114 | { dataField: "tlo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 }, | |
115 | { dataField: "thi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 }, | |
116 | { dataField: "room", lineWidth: 1, displayText: "Room", opacity: 0.5 }, | |
117 | { dataField: "chiller", lineWidth: 1, displayText: "Chiller", color: '#0000bb' } | |
118 | ] | |
119 | } | |
120 | ] | |
121 | }; | |
183
a810539dc218
Added cmd_fermenter.php which interfaces http POST commands to MQTT using mosquitto_pub in a shell. Several chnges to the monitor fermenter screen.
Michiel Broek <mbroek@mbse.eu>
parents:
180
diff
changeset
|
122 | $("#fermenter_chart").jqxChart(settings); |
172 | 123 | |
124 | $("#print").click(function () { | |
183
a810539dc218
Added cmd_fermenter.php which interfaces http POST commands to MQTT using mosquitto_pub in a shell. Several chnges to the monitor fermenter screen.
Michiel Broek <mbroek@mbse.eu>
parents:
180
diff
changeset
|
125 | var content = $("#fermenter_chart")[0].outerHTML; |
172 | 126 | var newWindow = window.open("", "", "width=865, height=425"), |
127 | document = newWindow.document.open(), | |
128 | pageContent = | |
129 | '<!DOCTYPE html>' + | |
130 | '<html>' + | |
131 | '<head>' + | |
132 | '<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />' + | |
133 | '<meta charset="utf-8" />' + | |
134 | '<title>jQWidgets Chart</title>' + | |
135 | '</head>' + | |
136 | '<body>' + content + '</body></html>'; | |
137 | document.write(pageContent); | |
138 | document.close(); | |
139 | newWindow.print(); | |
140 | }); | |
190 | 141 | $("#print").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 142 | |
143 | ||
144 | $("#pdfButton").click(function () { | |
183
a810539dc218
Added cmd_fermenter.php which interfaces http POST commands to MQTT using mosquitto_pub in a shell. Several chnges to the monitor fermenter screen.
Michiel Broek <mbroek@mbse.eu>
parents:
180
diff
changeset
|
145 | $("#fermenter_chart").jqxChart("saveAsPDF", "vergisting_"+my_code+".pdf", getExportServer()); |
172 | 146 | }); |
190 | 147 | $("#pdfButton").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 148 | |
149 | $("#pngButton").click(function () { | |
183
a810539dc218
Added cmd_fermenter.php which interfaces http POST commands to MQTT using mosquitto_pub in a shell. Several chnges to the monitor fermenter screen.
Michiel Broek <mbroek@mbse.eu>
parents:
180
diff
changeset
|
150 | $("#fermenter_chart").jqxChart("saveAsPNG", "vergisting_"+my_code+".png", getExportServer()); |
172 | 151 | }); |
190 | 152 | $("#pngButton").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 153 | |
154 | $("#Close").jqxButton({ template: "success", width: 125, theme: theme }); | |
155 | $("#Close").click(function () { | |
156 | window.close(); | |
157 | }); | |
158 | }); | |
159 |