forked from mitchpaulus/psychrometric-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
338 lines (331 loc) · 22.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="dynamic psychrometric chart">
<meta name="keywords" content="psychrometric chart,psychrometrics,HVAC">
<title>Psychrometric Page</title>
<link rel="stylesheet" href="psychrometrics.css" type="text/css" charset="utf-8">
</head>
<body style="font-family: 'Fira Sans', sans-serif">
<div style="display: grid; grid-template-columns: 1430px 1fr ">
<div id="vizcontainer" style="grid-column: 1 / 2">
<svg id="chartsvg" style="border:1px lightgray solid;"></svg>
<div class="download-buttons"><button data-bind="click: savePng">Download PNG</button> <button data-bind="click: saveSvg">Download SVG</button></div>
<br>
<a href="https://psychrochart.com/">Original Psychrometric Page: Mitchell T. Paulus</a>
<div class="states" data-bind="foreach: states">
<div class="state">
<div>
<span data-bind="visible: $root.Items[0].IsChecked()"><span data-bind="text: name"></span>: </span>
<span data-bind="visible: $root.Items[1].IsChecked()">Relative Humidity <span data-bind="text: RH"></span>%, </span>
<span data-bind="visible: $root.Items[2].IsChecked()">Dry bulb temp T<sub>db</sub> <span data-bind="text: Tdb"> </span>°F, </span>
<span data-bind="visible: $root.Items[3].IsChecked()">Wet bulb temp T<sub>wb</sub> <span data-bind="text: Twb"></span>°F, </span>
<span data-bind="visible: $root.Items[4].IsChecked()">Dewpoint temp T<sub>d</sub> <span data-bind="text: Td"></span>°F, </span>
<span data-bind="visible: $root.Items[5].IsChecked()">Enthalpy h <span data-bind="text: enthalpy"></span> btu/lb, </span>
<span data-bind="visible: $root.Items[6].IsChecked()">Humidity Ratio ω <span data-bind="text: humidityRatio"></span> lb h<sub>2</sub>o / lb da, </span>
<span data-bind="visible: $root.Items[7].IsChecked()">Moist Air Specific Volume v <span data-bind="text: v"></span> ft<sup>3</sup> / lb da, </span>
<span data-bind="visible: $root.Items[8].IsChecked()">Vapor Pressure <span data-bind="text: pv"></span> psia.</span></span>
<span data-bind="visible: $root.Items[9].IsChecked()">Test1 <span data-bind="text: Test1"></span></span></span>
<span data-bind="visible: $root.Items[9].IsChecked()">Test2 <span data-bind="text: Test2"></span></span></span>
</div>
</div>
</div>
</div>
<div style="grid-column: 2 / 3">
<div class="base-chart-options">
<div id="tab">
<ul class="ui-tab" role="tablist">
<li role="tab">
<a href="#tab1" data-bind="click: showBlock, css: { 'active': selected() == 'tab1' || init() == 1 }">Chart</a>
</li>
<li role="tab">
<a href="#tab2" data-bind="click: showBlock, css: { 'active': selected() == 'tab2' }">Output</a>
</li>
<li role="tab">
<a href="#tab3" data-bind="click: showBlock, css: { 'active': selected() == 'tab3' }">Colors</a>
</li>
<li role="tab">
<a href="#tab4" data-bind="click: showBlock, css: { 'active': selected() == 'tab4' }">Titles</a>
</li>
</ul>
<div class="ui-tabpanel" role="tabpanel" data-bind="visible: selected() == 'tab1' || init() == 1">
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showEnthalpyLines">Show enthalpy</label></div>
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showvLines">Show specific volume</label></div>
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showWetBulb">Show wet bulb</label></div>
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showDryBulb">Show dry bulb</label></div>
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showω">Show ω </label></div>
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showRH">Show Relative Humidity</label></div>
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showVP">Show Vapor Pressure</label></div>
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showProtractor">Show Protractor</label></div>
<div class="checkbox-option"><label><input type="checkbox" disabled data-bind="metric">Metric </label></div>
<!--
<div class="checkbox-option"><label><input type="checkbox" data-bind="checked: showTest">Test</label></div>
-->
<div style="margin-top: 10px">
<div><label><span class="input-options">Max dry bulb temp / °F</span><input type="number" data-bind="textInput: maxTempInput, attr: {max: 180, step: 1}"></label></div>
<div><label><span class="input-options">Min dry bulb temp / °F</span><input type="number" data-bind="textInput: minTempInput, attr: {min: 10, step: 1}"></label></div>
<div><label><span class="input-options">Max ω</span><input type="number" step="0.001" data-bind="textInput: maxωInput"></label></div>
<div><label><span class="input-options">Total Pressure / psia</span><input type="number" step="0.1" data-bind="textInput: totalPressureInput"></label></div>
<div><label><span class="input-options">Altitude / ft</span><input type="number" step="100" data-bind="textInput: altitudeInput"></label></div>
<br>
<br>
<input type="button" value="Default" onclick="setDefaultInputs()"/>
</div>
</div>
<div class="ui-tabpanel" role="tabpanel" data-bind="visible: selected() == 'tab2'">
<label><input type="checkbox" data-bind="checked: AllChecked" />All</label><br>
<div data-bind="foreach: Items">
<div><label><input type="checkbox" data-bind="checked: IsChecked" /><span data-bind="text: Name"></span></label></div>
</div>
</div>
<div class="ui-tabpanel" role="tabpanel" data-bind="visible: selected() == 'tab3'">
<div class="grid">
<label>State:</label>
<input type="color" data-bind="value: StateColor" />
<span data-bind="text: StateColor"></span>
</div>
<div class="grid">
<label>Relative Humidity:</label>
<input type="color" data-bind="value: RHColor" />
<span data-bind="text: RHColor"></span>
</div>
<div class="grid">
<label>Enthalpy:</label>
<input type="color" data-bind="value: HColor" />
<span data-bind="text: HColor"></span>
</div>
<div class="grid">
<label>Wet Bulb:</label>
<input type="color" data-bind="value: TwbColor" />
<span data-bind="text: TwbColor"></span>
</div>
<div class="grid">
<label>Specific Volume:</label>
<input type="color" data-bind="value: VColor" />
<span data-bind="text: VColor"></span>
</div>
<div class="grid">
<label>Dry Bulb:</label>
<input type="color" data-bind="value: TdbColor" />
<span data-bind="text: TdbColor"></span>
</div>
<div class="grid">
<label>Humidity:</label>
<input type="color" data-bind="value: WColor" />
<span data-bind="text: WColor"></span>
</div>
<div class="grid">
<label>Foreground:</label>
<input type="color" data-bind="value: ForegroundColor" />
<span data-bind="text: ForegroundColor"></span>
</div>
<div class="grid">
<label>Background: </label>
<input type="color" data-bind="value: BackgroundColor" />
<span data-bind="text: BackgroundColor"></span>
</div>
<br>
<div>
<div id="tooltip" display="none" style="position: absolute; display: none;"></div>
<svg width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1;fill=none">
<rect x="0" y="0" width="20" height="20" style="fill:#ff0000" />
<rect x="0" y="20" width="20" height="20" style="fill:#ff0000" />
<rect x="0" y="40" width="20" height="20" style="fill:#008000" />
<rect x="0" y="60" width="20" height="20" style="fill:#ffa500" />
<rect x="0" y="80" width="20" height="20" style="fill:#800080" />
<rect x="0" y="100" width="20" height="20" style="fill:#000000" />
<rect x="0" y="120" width="20" height="20" style="fill:#0000ff" />
<rect x="0" y="140" width="20" height="20" style="fill:#000000" />
<rect x="0" y="160" width="20" height="20" style="fill:#ffffff; stroke:#000000;stroke-width:1" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setColors(defaultColors)" onmousemove="showTooltip(evt, 'Default palette');" onmouseout="hideTooltip();" />
</g>
</svg>
<svg width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" style="fill:#ff0000" />
<rect x="0" y="20" width="20" height="20" style="fill:#f68712" />
<rect x="0" y="40" width="20" height="20" style="fill:#2c2829" />
<rect x="0" y="60" width="20" height="20" style="fill:#951c21" />
<rect x="0" y="80" width="20" height="20" style="fill:#4d45a4" />
<rect x="0" y="100" width="20" height="20" style="fill:#2c2829" />
<rect x="0" y="120" width="20" height="20" style="fill:#7a7b7c" />
<rect x="0" y="140" width="20" height="20" style="fill:#000000" />
<rect x="0" y="160" width="20" height="20" style="fill:#ffffff; stroke:#000000;stroke-width:1" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setColors(cooleradoColors)" onmousemove="showTooltip(evt, 'Coolerado palette');" onmouseout="hideTooltip();" />
</g>
</svg>
<svg width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" style="fill:#e41a1c" />
<rect x="0" y="20" width="20" height="20" style="fill:#984ea3" />
<rect x="0" y="40" width="20" height="20" style="fill:#377eb8" />
<rect x="0" y="60" width="20" height="20" style="fill:#ff7f00" />
<rect x="0" y="80" width="20" height="20" style="fill:#4daf4a" />
<rect x="0" y="100" width="20" height="20" style="fill:#999999" />
<rect x="0" y="120" width="20" height="20" style="fill:#999999" />
<rect x="0" y="140" width="20" height="20" style="fill:#000000" />
<rect x="0" y="160" width="20" height="20" style="fill:#ffffff; stroke:#000000;stroke-width:1" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setColors(colerBrewerColors)" onmousemove="showTooltip(evt, 'ColorBrewer palette');" onmouseout="hideTooltip();" />
</g>
</svg>
<svg width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" style="fill:#000075" />
<rect x="0" y="20" width="20" height="20" style="fill:#4363d8" />
<rect x="0" y="40" width="20" height="20" style="fill:#dcbeff" />
<rect x="0" y="60" width="20" height="20" style="fill:#ffe119" />
<rect x="0" y="80" width="20" height="20" style="fill:#f58231" />
<rect x="0" y="100" width="20" height="20" style="fill:#a9a9a9" />
<rect x="0" y="120" width="20" height="20" style="fill:#a9a9a9" />
<rect x="0" y="140" width="20" height="20" style="fill:#000000" />
<rect x="0" y="160" width="20" height="20" style="fill:#ffffff; stroke:#000000;stroke-width:1" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setColors(TrubetskoyColors)" onmousemove="showTooltip(evt, 'Trubetskoy palette');" onmouseout="hideTooltip();" />
</g>
</svg>
<svg width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" style="fill:#cc3311" />
<rect x="0" y="20" width="20" height="20" style="fill:#009988" />
<rect x="0" y="40" width="20" height="20" style="fill:#ee7733" />
<rect x="0" y="60" width="20" height="20" style="fill:#0077bb" />
<rect x="0" y="80" width="20" height="20" style="fill:#33bbee" />
<rect x="0" y="100" width="20" height="20" style="fill:#ee3377" />
<rect x="0" y="120" width="20" height="20" style="fill:#bbbbbb" />
<rect x="0" y="140" width="20" height="20" style="fill:#000000" />
<rect x="0" y="160" width="20" height="20" style="fill:#ffffff; stroke:#000000;stroke-width:1" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setColors(colorBlindColors)" onmousemove="showTooltip(evt, 'Color Blind palette');" onmouseout="hideTooltip();" />
</g>
</svg>
<svg width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" style="fill:#000000" />
<rect x="0" y="20" width="20" height="20" style="fill:#000000" />
<rect x="0" y="40" width="20" height="20" style="fill:#000000" />
<rect x="0" y="60" width="20" height="20" style="fill:#000000" />
<rect x="0" y="80" width="20" height="20" style="fill:#000000" />
<rect x="0" y="100" width="20" height="20" style="fill:#000000" />
<rect x="0" y="120" width="20" height="20" style="fill:#000000" />
<rect x="0" y="140" width="20" height="20" style="fill:#000000" />
<rect x="0" y="160" width="20" height="20" style="fill:#ffffff; stroke:#000000;stroke-width:1" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setColors(bwColors)" onmousemove="showTooltip(evt, 'Black & White');" onmouseout="hideTooltip();" />
</g>
</svg>
<svg width="15" height="180">
</svg>
<svg id="undo" width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" data-bind="style: { fill: previousColors()[0] }" />
<rect x="0" y="20" width="20" height="20" data-bind="style: { fill: previousColors()[1] }" />
<rect x="0" y="40" width="20" height="20" data-bind="style: { fill: previousColors()[2] }" />
<rect x="0" y="60" width="20" height="20" data-bind="style: { fill: previousColors()[3] }" />
<rect x="0" y="80" width="20" height="20" data-bind="style: { fill: previousColors()[4] }" />
<rect x="0" y="100" width="20" height="20" data-bind="style: { fill: previousColors()[5] }" />
<rect x="0" y="120" width="20" height="20" data-bind="style: { fill: previousColors()[6] }" />
<rect x="0" y="140" width="20" height="20" data-bind="style: { fill: previousColors()[7] }" />
<rect x="0" y="160" width="20" height="20" style="fill:#ffffff; stroke:#000000" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setPreviousColors()" onmousemove="showTooltip(evt, 'Undo All Changes');" onmouseout="hideTooltip();" />
</g>
</svg>
<svg width="35" height="180">
</svg>
<svg id="user1" width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" data-bind="style: { fill: user1Colors()[0] }" />
<rect x="0" y="20" width="20" height="20" data-bind="style: { fill: user1Colors()[1] }" />
<rect x="0" y="40" width="20" height="20" data-bind="style: { fill: user1Colors()[2] }" />
<rect x="0" y="60" width="20" height="20" data-bind="style: { fill: user1Colors()[3] }" />
<rect x="0" y="80" width="20" height="20" data-bind="style: { fill: user1Colors()[4] }" />
<rect x="0" y="100" width="20" height="20" data-bind="style: { fill: user1Colors()[5] }" />
<rect x="0" y="120" width="20" height="20" data-bind="style: { fill: user1Colors()[6] }" />
<rect x="0" y="140" width="20" height="20" data-bind="style: { fill: user1Colors()[7] }" />
<rect x="0" y="160" width="20" height="20" data-bind="style: { fill: user1Colors()[8] }" style="stroke:#000000" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setUser1Colors()" onmousemove="showTooltip(evt, 'User palette 1');" onmouseout="hideTooltip();" />
<foreignObject x="0" y="180" width="100%" height="100%" onmousemove="showTooltip(evt, 'Save custom palette');" onmouseout="hideTooltip();">
<input type="checkbox" data-bind="checked: user1Color">
</foreignObject>
</g>
</svg>
<svg id="user2" width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" data-bind="style: { fill: user2Colors()[0] }" />
<rect x="0" y="20" width="20" height="20" data-bind="style: { fill: user2Colors()[1] }" />
<rect x="0" y="40" width="20" height="20" data-bind="style: { fill: user2Colors()[2] }" />
<rect x="0" y="60" width="20" height="20" data-bind="style: { fill: user2Colors()[3] }" />
<rect x="0" y="80" width="20" height="20" data-bind="style: { fill: user2Colors()[4] }" />
<rect x="0" y="100" width="20" height="20" data-bind="style: { fill: user2Colors()[5] }" />
<rect x="0" y="120" width="20" height="20" data-bind="style: { fill: user2Colors()[6] }" />
<rect x="0" y="140" width="20" height="20" data-bind="style: { fill: user2Colors()[7] }" />
<rect x="0" y="160" width="20" height="20" data-bind="style: { fill: user2Colors()[8] }" style="stroke:#000000" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setUser2Colors()" onmousemove="showTooltip(evt, 'User palette 2');" onmouseout="hideTooltip();" />
<foreignObject x="0" y="180" width="100%" height="100%" onmousemove="showTooltip(evt, 'Save custom palette');" onmouseout="hideTooltip();">
<input type="checkbox" data-bind="checked: user2Color">
</foreignObject>
</g>
</svg>
<svg id="user3" width="25" height="200">
<g style="stroke:#ffffff;stroke-width:1">
<rect x="0" y="0" width="20" height="20" data-bind="style: { fill: user3Colors()[0] }" />
<rect x="0" y="20" width="20" height="20" data-bind="style: { fill: user3Colors()[1] }" />
<rect x="0" y="40" width="20" height="20" data-bind="style: { fill: user3Colors()[2] }" />
<rect x="0" y="60" width="20" height="20" data-bind="style: { fill: user3Colors()[3] }" />
<rect x="0" y="80" width="20" height="20" data-bind="style: { fill: user3Colors()[4] }" />
<rect x="0" y="100" width="20" height="20" data-bind="style: { fill: user3Colors()[5] }" />
<rect x="0" y="120" width="20" height="20" data-bind="style: { fill: user3Colors()[6] }" />
<rect x="0" y="140" width="20" height="20" data-bind="style: { fill: user3Colors()[7] }" />
<rect x="0" y="160" width="20" height="20" data-bind="style: { fill: user3Colors()[8] }" style="stroke:#000000" />
<rect x="0" y="0" width="20" height="180" style="fill:#FF000000" onClick="setUser3Colors()" onmousemove="showTooltip(evt, 'User palette 3');" onmouseout="hideTooltip();" />
<foreignObject x="0" y="180" width="100%" height="100%" onmousemove="showTooltip(evt, 'Save custom palette');" onmouseout="hideTooltip();">
<input type="checkbox" data-bind="checked: user3Color">
</foreignObject>
</g>
</svg>
</div>
</div>
<div class="ui-tabpanel" role="tabpanel" data-bind="visible: selected() == 'tab4'">
<div><label><span class="text-options">X-axis label: </span><input class="input_long" type="text" data-bind="textInput: xAxisLabel"></label></div>
<div><label><span class="text-options">Humidity label: </span><input class="input_long" type="text" data-bind="textInput: humidityLabel"></label></div>
<div><label><span class="text-options">Y-axis label: </span><input class="input_long" type="text" data-bind="textInput: yAxisLabel"></label></div>
<div><label><span class="text-options">Enthalpy label: </span><input class="input_long" type="text" data-bind="textInput: enthalpyLabel"></label></div>
<br>
<br>
<input type="button" value="Default" onclick="setDefaultText()"/>
</div>
</div>
<div class="states" data-bind="foreach: states">
<div class="state">
<div>
<label><span class="state-label">Dry Bulb Temperature / °F</span><input data-bind="value: Tdb" type="number"></label>
</div>
<div style="margin-bottom:10px">
<label data-bind="visible:specialProperty() === 0"><span id="Inputω" class="state-label">Humidity Ratio / lb h2o / lb da</span><input data-bind="value: humidityRatio" type="number" step="0.001"></label>
<label data-bind="visible:specialProperty() === 1"><span id="InputRH" class="state-label">Relative Humidity / %</span><input data-bind="value: RH" type="number"></label>
<label data-bind="visible:specialProperty() === 2"><span id="InputTwb" class="state-label">Wet Bulb Temperature / °F</span><input data-bind="textInput: Twb" type="number"></label>
<select data-bind="foreach: groups, value: selectedOption">
<optgroup data-bind="attr: {label: label}, foreach: children">
<option data-bind="text: label, option: $data"></option>
</optgroup>
</select>
</div>
<div>
<label><span class="state-label">State Label</span><input class="input_short" data-bind="textInput: name" type="text"></label>
</div>
<div class="remove-button">
<button data-bind="click: $root.removeState">Remove State</button>
</div>
</div>
</div>
<div>
<button data-bind="click: addState">Add new state</button>
</div>
</div>
</div>
<!--<div class="download-buttons"> <a download="psy.svg" data-bind="attr: { href: blobUrl }">Download File</a> </div>-->
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-min.js"></script>
<script src="savepng.js"></script>
<script src="psychrometrics.js"></script>
</body>
</html>