Wed, 18 Sep 2019 22:50:44 +0200
Initial design of the divide batch screen.
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 |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
56 | }, |
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
57 | dataAdapter = new $.jqx.dataAdapter(sourceA, { |
172 | 58 | autoBind: true, |
59 | async: false, | |
60 | loadComplete: function () { | |
61 | $('#jqxLoader').jqxLoader('close'); | |
62 | }, | |
63 | loadError: function (jqXHR, status, error) { | |
64 | } | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
65 | }), |
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
66 | settings = { |
172 | 67 | title: my_code + ' "' + my_name + '"', |
68 | description: "", | |
69 | source: dataAdapter, | |
70 | xAxis: { | |
71 | dataField: 'date', | |
72 | type: 'date', | |
73 | formatFunction: function (value) { | |
74 | return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear(); | |
75 | }, | |
76 | toolTipFormatFunction: function (value) { | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
77 | var h = value.getHours(), |
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
78 | m = value.getMinutes(); |
172 | 79 | return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear() |
80 | + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m); | |
81 | }, | |
82 | textRotationAngle: 45, | |
83 | howGridLines: false, | |
84 | rangeSelector: { | |
85 | size: 90, | |
86 | dataField: 'beer', | |
87 | serieType: 'line', | |
88 | gridLines: {visible: false}, | |
89 | } | |
90 | }, | |
91 | colorScheme: 'scheme01', | |
92 | seriesGroups: [ | |
93 | { | |
193 | 94 | type: "area", |
172 | 95 | valueAxis: { |
96 | minValue: 0, | |
97 | maxValue: 100, | |
98 | displayValueAxis: false, | |
99 | description: "Heat/Cool %" | |
100 | }, | |
101 | 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
|
102 | { dataField: "cooler", lineWidth: 1, displayText: "Cool %", opacity: 0.4 }, |
193 | 103 | { dataField: "heater", lineWidth: 1, displayText: "Heat %", opacity: 0.3 } |
172 | 104 | ] |
105 | }, | |
106 | { | |
107 | type: 'spline', | |
108 | valueAxis: { | |
109 | minValue: 0, | |
110 | description: 'Graden C' | |
111 | }, | |
112 | series: [ | |
113 | { dataField: "air", lineWidth: 1, displayText: "Air" }, | |
114 | { dataField: "beer", lineWidth: 2, displayText: "Beer" }, | |
115 | { dataField: "tlo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 }, | |
116 | { dataField: "thi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 }, | |
117 | { dataField: "room", lineWidth: 1, displayText: "Room", opacity: 0.5 }, | |
118 | { dataField: "chiller", lineWidth: 1, displayText: "Chiller", color: '#0000bb' } | |
119 | ] | |
120 | } | |
121 | ] | |
122 | }; | |
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
|
123 | $("#fermenter_chart").jqxChart(settings); |
172 | 124 | |
125 | $("#print").click(function () { | |
494
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
126 | var content = $("#fermenter_chart")[0].outerHTML, |
af28ebe4a779
Fixed as much as possible warnings from the yui-compressor.
Michiel Broek <mbroek@mbse.eu>
parents:
296
diff
changeset
|
127 | newWindow = window.open("", "", "width=865, height=425"), |
172 | 128 | document = newWindow.document.open(), |
129 | pageContent = | |
130 | '<!DOCTYPE html>' + | |
131 | '<html>' + | |
132 | '<head>' + | |
133 | '<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />' + | |
134 | '<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
|
135 | '<title>' + my_code + ' ' + my_name + ' vergisting</title>' + |
172 | 136 | '</head>' + |
137 | '<body>' + content + '</body></html>'; | |
138 | document.write(pageContent); | |
139 | document.close(); | |
140 | newWindow.print(); | |
141 | }); | |
190 | 142 | $("#print").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 143 | |
144 | ||
145 | $("#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
|
146 | $("#fermenter_chart").jqxChart("saveAsPDF", "vergisting_"+my_code+".pdf", getExportServer()); |
172 | 147 | }); |
190 | 148 | $("#pdfButton").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 149 | |
150 | $("#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
|
151 | $("#fermenter_chart").jqxChart("saveAsPNG", "vergisting_"+my_code+".png", getExportServer()); |
172 | 152 | }); |
190 | 153 | $("#pngButton").jqxButton({ template: "primary", width: 125, theme: theme }); |
172 | 154 | |
155 | $("#Close").jqxButton({ template: "success", width: 125, theme: theme }); | |
156 | $("#Close").click(function () { | |
157 | window.close(); | |
158 | }); | |
159 | }); | |
160 |