Mon, 15 Jul 2019 15:04:26 +0200
Version 0.3.11
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 | ||
296
69fadd1aded2
Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
26 | $('#jqxMenu').jqxMenu('destroy'); |
69fadd1aded2
Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
27 | |
172 | 28 | $("#jqxLoader").jqxLoader({ |
29 | width: 250, | |
30 | height: 150, | |
31 | isModal: true, | |
32 | text: "Opmaken grafiek ...", | |
33 | theme: theme | |
34 | }); | |
35 | $('#jqxLoader').jqxLoader('open'); | |
36 | ||
37 | function getExportServer() { | |
38 | return "https://www.jqwidgets.com/export_server/export.php"; | |
39 | } | |
40 | ||
41 | var sourceA = { | |
42 | datatype: "json", | |
43 | datafields: [ | |
44 | { name: "date", type: "date", format: "yyyy-MM-dd HH:mm" }, | |
45 | { name: "air", type: "float" }, | |
46 | { 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
|
47 | { 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
|
48 | { name: "room", type: "float" }, |
172 | 49 | { name: "tlo", type: "float" }, |
50 | { name: "thi", type: "float" }, | |
51 | { name: "heater", type: "int" }, | |
52 | { 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
|
53 | { name: "event", type: "string" } |
172 | 54 | ], |
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
|
55 | url: 'getfermentlog.php?code=' + my_code + '&name=' + my_name |
172 | 56 | }; |
57 | var dataAdapter = new $.jqx.dataAdapter(sourceA, { | |
58 | autoBind: true, | |
59 | async: false, | |
60 | loadComplete: function () { | |
61 | $('#jqxLoader').jqxLoader('close'); | |
62 | }, | |
63 | loadError: function (jqXHR, status, error) { | |
64 | } | |
65 | }); | |
66 | ||
67 | var settings = { | |
68 | title: my_code + ' "' + my_name + '"', | |
69 | description: "", | |
70 | source: dataAdapter, | |
71 | xAxis: { | |
72 | dataField: 'date', | |
73 | type: 'date', | |
74 | formatFunction: function (value) { | |
75 | return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear(); | |
76 | }, | |
77 | toolTipFormatFunction: function (value) { | |
78 | var h = value.getHours(); | |
79 | var m = value.getMinutes(); | |
80 | return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear() | |
81 | + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m); | |
82 | }, | |
83 | textRotationAngle: 45, | |
84 | howGridLines: false, | |
85 | rangeSelector: { | |
86 | size: 90, | |
87 | dataField: 'beer', | |
88 | serieType: 'line', | |
89 | gridLines: {visible: false}, | |
90 | } | |
91 | }, | |
92 | colorScheme: 'scheme01', | |
93 | seriesGroups: [ | |
94 | { | |
193 | 95 | type: "area", |
172 | 96 | valueAxis: { |
97 | minValue: 0, | |
98 | maxValue: 100, | |
99 | displayValueAxis: false, | |
100 | description: "Heat/Cool %" | |
101 | }, | |
102 | 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
|
103 | { dataField: "cooler", lineWidth: 1, displayText: "Cool %", opacity: 0.4 }, |
193 | 104 | { dataField: "heater", lineWidth: 1, displayText: "Heat %", opacity: 0.3 } |
172 | 105 | ] |
106 | }, | |
107 | { | |
108 | type: 'spline', | |
109 | valueAxis: { | |
110 | minValue: 0, | |
111 | description: 'Graden C' | |
112 | }, | |
113 | series: [ | |
114 | { dataField: "air", lineWidth: 1, displayText: "Air" }, | |
115 | { dataField: "beer", lineWidth: 2, displayText: "Beer" }, | |
116 | { dataField: "tlo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 }, | |
117 | { dataField: "thi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 }, | |
118 | { dataField: "room", lineWidth: 1, displayText: "Room", opacity: 0.5 }, | |
119 | { dataField: "chiller", lineWidth: 1, displayText: "Chiller", color: '#0000bb' } | |
120 | ] | |
121 | } | |
122 | ] | |
123 | }; | |
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
|
124 | $("#fermenter_chart").jqxChart(settings); |
172 | 125 | |
126 | $("#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
|
127 | var content = $("#fermenter_chart")[0].outerHTML; |
172 | 128 | var newWindow = window.open("", "", "width=865, height=425"), |
129 | document = newWindow.document.open(), | |
130 | pageContent = | |
131 | '<!DOCTYPE html>' + | |
132 | '<html>' + | |
133 | '<head>' + | |
134 | '<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />' + | |
135 | '<meta charset="utf-8" />' + | |
296
69fadd1aded2
Updated design document. Add content header application/json to all scripts that produce json output. Chart prints show the beer code and name in the header. Charts don't display the menu anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
194
diff
changeset
|
136 | '<title>' + my_code + ' ' + my_name + ' vergisting</title>' + |
172 | 137 | '</head>' + |
138 | '<body>' + content + '</body></html>'; | |
139 | document.write(pageContent); | |
140 | document.close(); | |
141 | newWindow.print(); | |
142 | }); | |
190 | 143 | $("#print").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 144 | |
145 | ||
146 | $("#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
|
147 | $("#fermenter_chart").jqxChart("saveAsPDF", "vergisting_"+my_code+".pdf", getExportServer()); |
172 | 148 | }); |
190 | 149 | $("#pdfButton").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 150 | |
151 | $("#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
|
152 | $("#fermenter_chart").jqxChart("saveAsPNG", "vergisting_"+my_code+".png", getExportServer()); |
172 | 153 | }); |
190 | 154 | $("#pngButton").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 155 | |
156 | $("#Close").jqxButton({ template: "success", width: 125, theme: theme }); | |
157 | $("#Close").click(function () { | |
158 | window.close(); | |
159 | }); | |
160 | }); | |
161 |