www/js/log_brew.js

changeset 494
af28ebe4a779
parent 297
5e2424bfbc4a
child 527
9dfefad3ae1d
equal deleted inserted replaced
491:8c4f08445624 494:af28ebe4a779
53 { name: "pwm_mlt", type: "int" }, 53 { name: "pwm_mlt", type: "int" },
54 { name: "pwm_hlt", type: "int" }, 54 { name: "pwm_hlt", type: "int" },
55 { name: "event", type: "string" } 55 { name: "event", type: "string" }
56 ], 56 ],
57 url: 'getbrewlog.php?code=' + my_code 57 url: 'getbrewlog.php?code=' + my_code
58 }; 58 },
59 var dataAdapter = new $.jqx.dataAdapter(sourceA, { 59 dataAdapter = new $.jqx.dataAdapter(sourceA, {
60 autoBind: true, 60 autoBind: true,
61 async: false, 61 async: false,
62 loadComplete: function () { 62 loadComplete: function () {
63 $('#jqxLoader').jqxLoader('close'); 63 $('#jqxLoader').jqxLoader('close');
64 }, 64 },
65 loadError: function (jqXHR, status, error) { 65 loadError: function (jqXHR, status, error) {
66 } 66 }
67 }); 67 }),
68 68 settings = {
69 var settings = {
70 title: my_code + ' "' + my_name + '"', 69 title: my_code + ' "' + my_name + '"',
71 description: "", 70 description: "",
72 source: dataAdapter, 71 source: dataAdapter,
73 xAxis: { 72 xAxis: {
74 dataField: 'date', 73 dataField: 'date',
75 type: 'date', 74 type: 'date',
76 formatFunction: function (value) { 75 formatFunction: function (value) {
77 return value.getHours() + ':' + value.getMinutes(); 76 return value.getHours() + ':' + value.getMinutes();
78 }, 77 },
79 toolTipFormatFunction: function (value) { 78 toolTipFormatFunction: function (value) {
80 var h = value.getHours(); 79 var h = value.getHours(),
81 var m = value.getMinutes(); 80 m = value.getMinutes();
82 return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear() 81 return value.getDate() + '-' + (value.getMonth() + 1) + '-' + value.getFullYear()
83 + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m); 82 + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m);
84 }, 83 },
85 textRotationAngle: 300, 84 textRotationAngle: 300,
86 }, 85 },
103 ] 102 ]
104 }; 103 };
105 $("#brew_chart").jqxChart(settings); 104 $("#brew_chart").jqxChart(settings);
106 105
107 $("#print").click(function () { 106 $("#print").click(function () {
108 var content = $("#brew_chart")[0].outerHTML; 107 var content = $("#brew_chart")[0].outerHTML,
109 var newWindow = window.open("", "", "width=865, height=425"), 108 newWindow = window.open("", "", "width=865, height=425"),
110 document = newWindow.document.open(), 109 document = newWindow.document.open(),
111 pageContent = 110 pageContent =
112 '<!DOCTYPE html>' + 111 '<!DOCTYPE html>' +
113 '<html>' + 112 '<html>' +
114 '<head>' + 113 '<head>' +

mercurial