Typica is a free program for professional coffee roasters. https://typica.us
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

print.xml 37KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. <window id="print">
  2. <layout type="vertical">
  3. <layout type="horizontal">
  4. <label>Title:</label>
  5. <line id="title" />
  6. </layout>
  7. <layout type="horizontal">
  8. <label>Subtitle:</label>
  9. <line id="subtitle" />
  10. </layout>
  11. <layout type="horizontal">
  12. <label>% weight loss:</label>
  13. <line id="loss" validator="numeric" />
  14. <label>Tolerance:</label>
  15. <line id="tolerance" validator="numeric" />
  16. </layout>
  17. <layout type="horizontal">
  18. <label>Additional notes:</label>
  19. <line id="notes" />
  20. </layout>
  21. <layout type="horizontal">
  22. <label>Measurement column:</label>
  23. <line id="addmeasurement" validator="integer" />
  24. <button name="Add column" type="push" id="ambutton" />
  25. <line id="mcols" writable="false" />
  26. </layout>
  27. <layout type="horizontal">
  28. <label>Annotation column:</label>
  29. <line id="addnote" validator="integer" />
  30. <button name="Add column" type="push" id="anbutton" />
  31. <line id="ncols" writable="false" />
  32. </layout>
  33. <button name="Print" type="push" id="export" />
  34. </layout>
  35. <program>
  36. <![CDATA[
  37. var window = this;
  38. var exportButton = findChildObject(this, 'export');
  39. exportButton.enable = false;
  40. var mcoldisp = findChildObject(this, 'mcols');
  41. mcoldisp.enable = false;
  42. var ncoldisp = findChildObject(this, 'ncols');
  43. ncoldisp.enable = false;
  44. var mbutton = findChildObject(this, 'ambutton');
  45. var msource = findChildObject(this, 'addmeasurement');
  46. var mdest = findChildObject(this, 'mcols');
  47. mbutton.clicked.connect(function() {
  48. if(window.marray === undefined)
  49. {
  50. window.marray = new Array();
  51. }
  52. window.marray.push(Number(msource.text));
  53. mdest.text = window.marray.toString();
  54. msource.text = '';
  55. if(window.narray === undefined)
  56. {} else { exportButton.enable = true;}
  57. });
  58. var abutton = findChildObject(window, 'anbutton');
  59. var asource = findChildObject(window, 'addnote');
  60. var adest = findChildObject(window, 'ncols');
  61. abutton.clicked.connect(function() {
  62. if(window.narray === undefined)
  63. {
  64. window.narray = new Array();
  65. }
  66. window.narray.push(Number(asource.text));
  67. adest.text = window.narray.toString();
  68. asource.text = '';
  69. if(window.marray === undefined)
  70. { } else { exportButton.enable = true;}
  71. });
  72. var titleField = findChildObject(window, 'title');
  73. var subTitleField = findChildObject(window, 'subtitle');
  74. exportButton.clicked.connect(function() {
  75. window.log.clearOutputColumns();
  76. for(var i = 0; i < window.marray.length; i++)
  77. {
  78. window.log.addOutputTemperatureColumn(window.marray[i]);
  79. }
  80. for(var i = 0; i < window.narray.length; i++)
  81. {
  82. window.log.addOutputAnnotationColumn(window.narray[i]);
  83. }
  84. var unitdesc = log.displayUnits();
  85. if(unitdesc != 10144)
  86. {
  87. log.setDisplayUnits(10144);
  88. }
  89. var tempFilename = log.saveTemporary();
  90. log.setDisplayUnits(unitdesc);
  91. var sourceFile = new QFile(tempFilename);
  92. sourceFile.open(3);
  93. var tf2 = tempFilename + ".xml";
  94. var destFile = new QFile(tf2);
  95. destFile.open(3);
  96. var input = new XmlReader(sourceFile);
  97. var output = new XmlWriter(destFile);
  98. output.writeStartDocument("1.0");
  99. output.writeDTD('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg.dtd">');
  100. output.writeStartElement("html");
  101. output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
  102. output.writeStartElement("head");
  103. output.writeStartElement("title");
  104. output.writeCDATA(titleField.text);
  105. output.writeEndElement();
  106. output.writeEndElement();
  107. output.writeStartElement("body");
  108. output.writeStartElement("h1");
  109. output.writeAttribute("style", "font-size:100%;font-weight:bold");
  110. output.writeCDATA(titleField.text);
  111. output.writeEndElement();
  112. output.writeStartElement("h2");
  113. output.writeAttribute("style", "font-size:100%;font-weight:normal");
  114. output.writeCDATA(subTitleField.text);
  115. output.writeEndElement();
  116. output.writeStartElement("div");
  117. output.writeAttribute("style", "width:7.5in");
  118. output.writeStartElement("div");
  119. output.writeAttribute("style", "float:left;width:2.5in");
  120. output.writeStartElement("table");
  121. output.writeStartElement("tr");
  122. output.writeStartElement("th");
  123. output.writeCDATA("Time");
  124. output.writeEndElement();
  125. input.readNext();
  126. var colMap = new Array();
  127. var tempMap = new Array();
  128. while(input.name() != "roast")
  129. {
  130. if(input.isStartElement())
  131. {
  132. if(input.name() == "tempseries")
  133. {
  134. colMap.push(input.attribute("name"));
  135. tempMap.push(input.attribute("name"));
  136. }
  137. if(input.name() == "noteseries")
  138. {
  139. colMap.push(input.attribute("name"));
  140. }
  141. }
  142. input.readNext();
  143. }
  144. for(var i = 0; i < colMap.length; i++)
  145. {
  146. output.writeStartElement("th");
  147. output.writeCDATA(colMap[i]);
  148. output.writeEndElement();
  149. }
  150. output.writeEndElement();
  151. var rowBuffer = new Array();
  152. var nextTime = 0;
  153. input.readNext();
  154. var inputReady = false;
  155. var annotationRead = false;
  156. var tm = 0;
  157. var ts = 0;
  158. while(!input.atEnd())
  159. {
  160. if(input.isStartElement())
  161. {
  162. if(input.name() == "time")
  163. {
  164. rowBuffer[0] = input.readElementText();
  165. inputReady = true;
  166. }
  167. if(input.name() == "temperature")
  168. {
  169. for (var i = 0; i < colMap.length; i++)
  170. {
  171. if(colMap[i] == input.attribute("series"))
  172. {
  173. if(log.displayUnits() == 10143)
  174. {
  175. rowBuffer[i + 1] = Math.floor((input.readElementText() - 32) * 5 / 9);
  176. }
  177. else
  178. {
  179. rowBuffer[i + 1] = Math.floor(input.readElementText());
  180. }
  181. break;
  182. }
  183. }
  184. }
  185. if(input.name() == "annotation")
  186. {
  187. for (var i = 0; i < colMap.length; i++)
  188. {
  189. if(colMap[i] == input.attribute("series"))
  190. {
  191. rowBuffer[i + 1] = input.readElementText();
  192. break;
  193. }
  194. }
  195. annotationRead = true;
  196. }
  197. if(input.name() == "tuple")
  198. {
  199. if(inputReady)
  200. {
  201. var ta1 = rowBuffer[0].split(":");
  202. var ta2 = ta1[1].split(".");
  203. if(Number(ta1[0]) == tm)
  204. {
  205. if(Number(ta2[0]) == ts)
  206. {
  207. annotationRead = false;
  208. output.writeStartElement("tr");
  209. for(var i = 0; i < rowBuffer.length; i++)
  210. {
  211. output.writeStartElement("td");
  212. output.writeAttribute("align", "center");
  213. output.writeAttribute("style", "font-size: 80%");
  214. if(i == 0)
  215. {
  216. output.writeCDATA(rowBuffer[i].split(".")[0]);
  217. }
  218. else
  219. {
  220. output.writeCDATA(rowBuffer[i]);
  221. }
  222. output.writeEndElement();
  223. }
  224. output.writeEndElement();
  225. nextTime += 30;
  226. tm = Math.floor(nextTime / 60);
  227. ts = nextTime % 60;
  228. }
  229. }
  230. if(annotationRead)
  231. {
  232. output.writeStartElement("tr");
  233. for(var i = 0; i < rowBuffer.length; i++)
  234. {
  235. output.writeStartElement("td");
  236. output.writeAttribute("align", "center");
  237. output.writeAttribute("style", "font-size: 80%");
  238. output.writeCDATA(rowBuffer[i]);
  239. output.writeEndElement();
  240. }
  241. output.writeEndElement();
  242. annotationRead = false;
  243. }
  244. }
  245. rowBuffer = new Array();
  246. }
  247. }
  248. input.readNext();
  249. }
  250. output.writeStartElement("tr");
  251. for(var i = 0; i < rowBuffer.length; i++)
  252. {
  253. output.writeStartElement("td");
  254. output.writeAttribute("align", "center");
  255. output.writeAttribute("style", "font-size: 80%");
  256. output.writeCDATA(rowBuffer[i]);
  257. output.writeEndElement();
  258. }
  259. output.writeEndElement();
  260. output.writeEndElement();
  261. output.writeEndElement();
  262. output.writeStartElement("div");
  263. output.writeAttribute("style", "width=4.5in;float=right");
  264. output.writeStartElement("svg");
  265. output.writeAttribute("xmlns", "http://www.w3.org/2000/svg");
  266. output.writeAttribute("version", "1.1");
  267. output.writeAttribute("width", "4.5in");
  268. output.writeAttribute("height", "3.4in");
  269. output.writeAttribute("viewbox", "0 0 400 400");
  270. output.writeStartElement("rect");
  271. output.writeAttribute("width", "4.5in");
  272. output.writeAttribute("height", "3.4in");
  273. output.writeAttribute("style", "fill:none;stroke-width:3;stroke:rgb(64,64,64)");
  274. output.writeEndElement();
  275. output.writeStartElement("text");
  276. output.writeAttribute("x", "0.1in");
  277. output.writeAttribute("y", "1.3in");
  278. output.writeAttribute("font-size", "12");
  279. output.writeAttribute("transform", "rotate(-90 40,150)");
  280. if(log.displayUnits() == 10143)
  281. {
  282. output.writeCDATA(TTR("print", "Temperature (°C)"));
  283. }
  284. else
  285. {
  286. output.writeCDATA(TTR("print", "Temperature (°F)"));
  287. }
  288. output.writeEndElement();
  289. output.writeStartElement("text");
  290. output.writeAttribute("x", "1.9in");
  291. output.writeAttribute("y", "3.3in");
  292. output.writeAttribute("font-size", "12");
  293. output.writeCDATA(TTR("print", "Time (minutes)"));
  294. output.writeEndElement();
  295. output.writeStartElement("line");
  296. output.writeAttribute("x1", "0.4in");
  297. output.writeAttribute("x2", "0.4in");
  298. output.writeAttribute("y1", "0.1in");
  299. output.writeAttribute("y2", "2.9in");
  300. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  301. output.writeEndElement();
  302. output.writeStartElement("line");
  303. output.writeAttribute("x1", "0.5in");
  304. output.writeAttribute("x2", "4.4in");
  305. output.writeAttribute("y1", "3in");
  306. output.writeAttribute("y2", "3in");
  307. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  308. output.writeEndElement();
  309. output.writeStartElement("line");
  310. output.writeAttribute("x1", "0.4in");
  311. output.writeAttribute("x2", "4.4in");
  312. output.writeAttribute("y1", "2.9in");
  313. output.writeAttribute("y2", "2.9in");
  314. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  315. output.writeEndElement();
  316. if(log.displayUnits() != 10143)
  317. {
  318. output.writeStartElement("text");
  319. output.writeAttribute("x", "0.3in");
  320. output.writeAttribute("y", "2.95in");
  321. output.writeAttribute("font-size", "12");
  322. output.writeCDATA("0");
  323. output.writeEndElement();
  324. }
  325. if(log.displayUnits() == 10143)
  326. {
  327. output.writeStartElement("line");
  328. output.writeAttribute("x1", "0.4in");
  329. output.writeAttribute("x2", "4.4in");
  330. output.writeAttribute("y1", "2.22in");
  331. output.writeAttribute("y2", "2.22in");
  332. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  333. output.writeEndElement();
  334. output.writeStartElement("text");
  335. output.writeAttribute("x", "0.18in");
  336. output.writeAttribute("y", "2.27in");
  337. output.writeAttribute("font-size", "12");
  338. output.writeCDATA("50");
  339. output.writeEndElement();
  340. output.writeStartElement("line");
  341. output.writeAttribute("x1", "0.4in");
  342. output.writeAttribute("x2", "4.4in");
  343. output.writeAttribute("y1", "1.71in");
  344. output.writeAttribute("y2", "1.71in");
  345. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  346. output.writeEndElement();
  347. output.writeStartElement("text");
  348. output.writeAttribute("x", "0.18in");
  349. output.writeAttribute("y", "1.76in");
  350. output.writeAttribute("font-size", "12");
  351. output.writeCDATA("100");
  352. output.writeEndElement();
  353. output.writeStartElement("line");
  354. output.writeAttribute("x1", "0.4in");
  355. output.writeAttribute("x2", "4.4in");
  356. output.writeAttribute("y1", "1.21in");
  357. output.writeAttribute("y2", "1.21in");
  358. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  359. output.writeEndElement();
  360. output.writeStartElement("text");
  361. output.writeAttribute("x", "0.18in");
  362. output.writeAttribute("y", "1.26in");
  363. output.writeAttribute("font-size", "12");
  364. output.writeCDATA("150");
  365. output.writeEndElement();
  366. output.writeStartElement("line");
  367. output.writeAttribute("x1", "0.4in");
  368. output.writeAttribute("x2", "4.4in");
  369. output.writeAttribute("y1", "0.7in");
  370. output.writeAttribute("y2", "0.7in");
  371. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  372. output.writeEndElement();
  373. output.writeStartElement("text");
  374. output.writeAttribute("x", "0.18in");
  375. output.writeAttribute("y", "0.75in");
  376. output.writeAttribute("font-size", "12");
  377. output.writeCDATA("200");
  378. output.writeEndElement();
  379. output.writeStartElement("line");
  380. output.writeAttribute("x1", "0.4in");
  381. output.writeAttribute("x2", "4.4in");
  382. output.writeAttribute("y1", "0.2in");
  383. output.writeAttribute("y2", "0.2in");
  384. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  385. output.writeEndElement();
  386. output.writeStartElement("text");
  387. output.writeAttribute("x", "0.18in");
  388. output.writeAttribute("y", "0.25in");
  389. output.writeAttribute("font-size", "12");
  390. output.writeCDATA("250");
  391. output.writeEndElement();
  392. }
  393. else
  394. {
  395. output.writeStartElement("line");
  396. output.writeAttribute("x1", "0.4in");
  397. output.writeAttribute("x2", "4.4in");
  398. output.writeAttribute("y1", "2.34in");
  399. output.writeAttribute("y2", "2.34in");
  400. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  401. output.writeEndElement();
  402. output.writeStartElement("text");
  403. output.writeAttribute("x", "0.18in");
  404. output.writeAttribute("y", "2.39in");
  405. output.writeAttribute("font-size", "12");
  406. output.writeCDATA("100");
  407. output.writeEndElement();
  408. output.writeStartElement("line");
  409. output.writeAttribute("x1", "0.4in");
  410. output.writeAttribute("x2", "4.4in");
  411. output.writeAttribute("y1", "1.78in");
  412. output.writeAttribute("y2", "1.78in");
  413. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  414. output.writeEndElement();
  415. output.writeStartElement("text");
  416. output.writeAttribute("x", "0.18in");
  417. output.writeAttribute("y", "1.83in");
  418. output.writeAttribute("font-size", "12");
  419. output.writeCDATA("200");
  420. output.writeEndElement();
  421. output.writeStartElement("line");
  422. output.writeAttribute("x1", "0.4in");
  423. output.writeAttribute("x2", "4.4in");
  424. output.writeAttribute("y1", "1.22in");
  425. output.writeAttribute("y2", "1.22in");
  426. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  427. output.writeEndElement();
  428. output.writeStartElement("text");
  429. output.writeAttribute("x", "0.18in");
  430. output.writeAttribute("y", "1.27in");
  431. output.writeAttribute("font-size", "12");
  432. output.writeCDATA("300");
  433. output.writeEndElement();
  434. output.writeStartElement("line");
  435. output.writeAttribute("x1", "0.4in");
  436. output.writeAttribute("x2", "4.4in");
  437. output.writeAttribute("y1", "0.66in");
  438. output.writeAttribute("y2", "0.66in");
  439. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  440. output.writeEndElement();
  441. output.writeStartElement("text");
  442. output.writeAttribute("x", "0.18in");
  443. output.writeAttribute("y", "0.71in");
  444. output.writeAttribute("font-size", "12");
  445. output.writeCDATA("400");
  446. output.writeEndElement();
  447. output.writeStartElement("line");
  448. output.writeAttribute("x1", "0.4in");
  449. output.writeAttribute("x2", "4.4in");
  450. output.writeAttribute("y1", "0.1in");
  451. output.writeAttribute("y2", "0.1in");
  452. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  453. output.writeEndElement();
  454. output.writeStartElement("text");
  455. output.writeAttribute("x", "0.18in");
  456. output.writeAttribute("y", "0.15in");
  457. output.writeAttribute("font-size", "12");
  458. output.writeCDATA("500");
  459. output.writeEndElement();
  460. }
  461. output.writeStartElement("line");
  462. output.writeAttribute("x1", "0.5in");
  463. output.writeAttribute("x2", "0.5in");
  464. output.writeAttribute("y1", "2.95in");
  465. output.writeAttribute("y2", "3.05in");
  466. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  467. output.writeEndElement();
  468. output.writeStartElement("text");
  469. output.writeAttribute("x", "0.47in");
  470. output.writeAttribute("y", "3.16in");
  471. output.writeAttribute("font-size", "12");
  472. output.writeCDATA("0");
  473. output.writeEndElement();
  474. output.writeStartElement("line");
  475. output.writeAttribute("x1", "0.89in");
  476. output.writeAttribute("x2", "0.89in");
  477. output.writeAttribute("y1", "2.95in");
  478. output.writeAttribute("y2", "3.05in");
  479. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  480. output.writeEndElement();
  481. output.writeStartElement("text");
  482. output.writeAttribute("x", "0.86in");
  483. output.writeAttribute("y", "3.16in");
  484. output.writeAttribute("font-size", "12");
  485. output.writeCDATA("2");
  486. output.writeEndElement();
  487. output.writeStartElement("line");
  488. output.writeAttribute("x1", "1.28in");
  489. output.writeAttribute("x2", "1.28in");
  490. output.writeAttribute("y1", "2.95in");
  491. output.writeAttribute("y2", "3.05in");
  492. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  493. output.writeEndElement();
  494. output.writeStartElement("text");
  495. output.writeAttribute("x", "1.25in");
  496. output.writeAttribute("y", "3.16in");
  497. output.writeAttribute("font-size", "12");
  498. output.writeCDATA("4");
  499. output.writeEndElement();
  500. output.writeStartElement("line");
  501. output.writeAttribute("x1", "1.67in");
  502. output.writeAttribute("x2", "1.67in");
  503. output.writeAttribute("y1", "2.95in");
  504. output.writeAttribute("y2", "3.05in");
  505. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  506. output.writeEndElement();
  507. output.writeStartElement("text");
  508. output.writeAttribute("x", "1.64in");
  509. output.writeAttribute("y", "3.16in");
  510. output.writeAttribute("font-size", "12");
  511. output.writeCDATA("6");
  512. output.writeEndElement();
  513. output.writeStartElement("line");
  514. output.writeAttribute("x1", "2.06in");
  515. output.writeAttribute("x2", "2.06in");
  516. output.writeAttribute("y1", "2.95in");
  517. output.writeAttribute("y2", "3.05in");
  518. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  519. output.writeEndElement();
  520. output.writeStartElement("text");
  521. output.writeAttribute("x", "2.03in");
  522. output.writeAttribute("y", "3.16in");
  523. output.writeAttribute("font-size", "12");
  524. output.writeCDATA("8");
  525. output.writeEndElement();
  526. output.writeStartElement("line");
  527. output.writeAttribute("x1", "2.45in");
  528. output.writeAttribute("x2", "2.45in");
  529. output.writeAttribute("y1", "2.95in");
  530. output.writeAttribute("y2", "3.05in");
  531. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  532. output.writeEndElement();
  533. output.writeStartElement("text");
  534. output.writeAttribute("x", "2.39in");
  535. output.writeAttribute("y", "3.16in");
  536. output.writeAttribute("font-size", "12");
  537. output.writeCDATA("10");
  538. output.writeEndElement();
  539. output.writeStartElement("line");
  540. output.writeAttribute("x1", "2.84in");
  541. output.writeAttribute("x2", "2.84in");
  542. output.writeAttribute("y1", "2.95in");
  543. output.writeAttribute("y2", "3.05in");
  544. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  545. output.writeEndElement();
  546. output.writeStartElement("text");
  547. output.writeAttribute("x", "2.78in");
  548. output.writeAttribute("y", "3.16in");
  549. output.writeAttribute("font-size", "12");
  550. output.writeCDATA("12");
  551. output.writeEndElement();
  552. output.writeStartElement("line");
  553. output.writeAttribute("x1", "3.23in");
  554. output.writeAttribute("x2", "3.23in");
  555. output.writeAttribute("y1", "2.95in");
  556. output.writeAttribute("y2", "3.05in");
  557. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  558. output.writeEndElement();
  559. output.writeStartElement("text");
  560. output.writeAttribute("x", "3.17in");
  561. output.writeAttribute("y", "3.16in");
  562. output.writeAttribute("font-size", "12");
  563. output.writeCDATA("14");
  564. output.writeEndElement();
  565. output.writeStartElement("line");
  566. output.writeAttribute("x1", "3.62in");
  567. output.writeAttribute("x2", "3.62in");
  568. output.writeAttribute("y1", "2.95in");
  569. output.writeAttribute("y2", "3.05in");
  570. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  571. output.writeEndElement();
  572. output.writeStartElement("text");
  573. output.writeAttribute("x", "3.56in");
  574. output.writeAttribute("y", "3.16in");
  575. output.writeAttribute("font-size", "12");
  576. output.writeCDATA("16");
  577. output.writeEndElement();
  578. output.writeStartElement("line");
  579. output.writeAttribute("x1", "4.01in");
  580. output.writeAttribute("x2", "4.01in");
  581. output.writeAttribute("y1", "2.95in");
  582. output.writeAttribute("y2", "3.05in");
  583. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  584. output.writeEndElement();
  585. output.writeStartElement("text");
  586. output.writeAttribute("x", "3.95in");
  587. output.writeAttribute("y", "3.16in");
  588. output.writeAttribute("font-size", "12");
  589. output.writeCDATA("18");
  590. output.writeEndElement();
  591. output.writeStartElement("line");
  592. output.writeAttribute("x1", "4.4in");
  593. output.writeAttribute("x2", "4.4in");
  594. output.writeAttribute("y1", "2.95in");
  595. output.writeAttribute("y2", "3.05in");
  596. output.writeAttribute("style", "stroke:rgb(0,0,0);stroke-width:1");
  597. output.writeEndElement();
  598. output.writeStartElement("text");
  599. output.writeAttribute("x", "4.34in");
  600. output.writeAttribute("y", "3.16in");
  601. output.writeAttribute("font-size", "12");
  602. output.writeCDATA("20");
  603. output.writeEndElement();
  604. sourceFile.close();
  605. sourceFile.open(3);
  606. input = new XmlReader(sourceFile);
  607. var lineStyles = new Array();
  608. lineStyles.push("stroke:rgb(255,0,0);stroke-width:1");
  609. lineStyles.push("stroke:rgb(0,255,0);stroke-width:1");
  610. lineStyles.push("stroke:rgb(0,0,255);stroke-width:1");
  611. lineStyles.push("stroke:rgb(255,255,0);stroke-width:1");
  612. lineStyles.push("stroke:rgb(255,0,255);stroke-width:1");
  613. lineStyles.push("stroke:rgb(0,255,255);stroke-width:1");
  614. var check1 = false;
  615. var drawable = false;
  616. var previousX;
  617. var currentX;
  618. var previousY = new Array();
  619. input.readNext();
  620. while(!input.atEnd())
  621. {
  622. if(input.isStartElement())
  623. {
  624. if(input.name() == "time")
  625. {
  626. if(check1)
  627. {
  628. previousX = currentX;
  629. }
  630. var tstring = input.readElementText();
  631. var tsplit1 = tstring.split(":");
  632. var tsplit2 = tsplit1[1].split(".");
  633. currentX = 0.5 + (Number(tsplit1[0])*0.195) + (Number(tsplit2[0])*0.00325);// + (Number(tsplit2[1]) * 0.00000325);
  634. if(check1)
  635. {
  636. drawable = true;
  637. }
  638. check1 = true;
  639. }
  640. if(input.name() == "temperature")
  641. {
  642. var series;
  643. for(var i = 0; i < tempMap.length; i++)
  644. {
  645. if(tempMap[i] == input.attribute("series"))
  646. {
  647. series = i;
  648. break;
  649. }
  650. }
  651. var currentY = 2.9 - Number(input.readElementText()) * 0.0056;
  652. if(drawable)
  653. {
  654. output.writeStartElement("line");
  655. output.writeAttribute("style", lineStyles[series % 6]);
  656. output.writeAttribute("x1", String(previousX)+"in");
  657. output.writeAttribute("x2", String(currentX)+"in");
  658. output.writeAttribute("y1", String(previousY[series])+"in");
  659. output.writeAttribute("y2", String(currentY)+"in");
  660. output.writeEndElement();
  661. }
  662. previousY[series] = currentY;
  663. }
  664. }
  665. input.readNext();
  666. }
  667. sourceFile.remove();
  668. sourceFile.close();
  669. output.writeEndElement();
  670. output.writeStartElement("div");
  671. output.writeAttribute("style", "margin-left:3in;margin-top:0.5in");
  672. var lossField = findChildObject(window, 'loss');
  673. var tolField = findChildObject(window, 'tolerance');
  674. if(lossField.text != "")
  675. {
  676. output.writeStartElement("p");
  677. output.writeCDATA(TTR("print", "Weight loss: "));
  678. output.writeCDATA(lossField.text);
  679. if(tolField.text != "")
  680. {
  681. output.writeCDATA("±");
  682. output.writeCDATA(tolField.text);
  683. }
  684. output.writeCDATA("%");
  685. output.writeEndElement();
  686. output.writeStartElement("table");
  687. output.writeStartElement("tr");
  688. output.writeStartElement("th");
  689. output.writeCDATA(TTR("print", "Roasted"));
  690. output.writeEndElement();
  691. output.writeStartElement("th");
  692. output.writeCDATA(TTR("print", "Green"));
  693. output.writeEndElement();
  694. output.writeEndElement();
  695. var green;
  696. var roasted;
  697. var loss = (Number(lossField.text) + Number(tolField.text)) / 100;
  698. for(roasted = 1; roasted < 30; roasted++)
  699. {
  700. green = (1/-(loss-1)) * roasted;
  701. if(green > 30)
  702. {
  703. break;
  704. }
  705. if(roasted % 5 == 0)
  706. {
  707. output.writeStartElement("tr");
  708. output.writeStartElement("td");
  709. output.writeAttribute("align", "center");
  710. output.writeCDATA(roasted);
  711. output.writeEndElement();
  712. output.writeStartElement("td");
  713. output.writeAttribute("align", "center");
  714. output.writeCDATA(green.toFixed(2));
  715. output.writeEndElement();
  716. output.writeEndElement();
  717. }
  718. }
  719. roasted--;
  720. if(roasted % 5 > 0)
  721. {
  722. green = (1/-(loss-1)) * roasted;
  723. output.writeStartElement("tr");
  724. output.writeStartElement("td");
  725. output.writeAttribute("align", "center");
  726. output.writeCDATA(roasted);
  727. output.writeEndElement();
  728. output.writeStartElement("td");
  729. output.writeAttribute("align", "center");
  730. output.writeCDATA(green.toFixed(2));
  731. output.writeEndElement();
  732. output.writeEndElement();
  733. }
  734. output.writeEndElement();
  735. }
  736. var noteField = findChildObject(window, 'notes');
  737. if(noteField.text != "")
  738. {
  739. output.writeStartElement("p");
  740. output.writeCDATA(noteField.text);
  741. output.writeEndElement();
  742. }
  743. output.writeEndElement();
  744. output.writeEndElement();
  745. output.writeEndElement();
  746. output.writeEndElement();
  747. output.writeEndDocument();
  748. var printView = new WebView;
  749. destFile.close();
  750. printView.load(tf2);
  751. printView.print();
  752. destFile.remove();
  753. window.close();
  754. });
  755. ]]>
  756. </program>
  757. </window>