29a1b27c09ee392fc03c6b8a4ef2460146514f60.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. $(function() {
  2. BWA.ChartOptions = BWA.ChartOptions || {};
  3. var C = BWA.ChartOptions.Zone_TempHumi = BWA.ChartOptions.Zone_TempHumi || {};
  4. var targetTempMax = ko.observableArray();
  5. var targetTempMin = ko.observableArray();
  6. var targetHumiMax = ko.observableArray();
  7. var targetHumiMin = ko.observableArray();
  8. /*
  9. var valueAxis =
  10. {
  11. name: 'temp', //
  12. position: 'left',
  13. pane: 'topPane',
  14. type: 'continuous',
  15. valueType: 'numeric',
  16. tickInterval: 10,
  17. valueMarginsEnabled: true,
  18. minValueMargin: 0,
  19. maxValueMargin: 0,
  20. min: -10,
  21. max: 40,
  22. label: {
  23. font: { color: '#c96374' },
  24. },
  25. title: {
  26. text: '온도 (°C)',
  27. },
  28. };
  29. */
  30. var valueAxises = [
  31. {
  32. name: 'temp', //
  33. position: 'left',
  34. pane: 'topPane',
  35. type: 'continuous',
  36. valueType: 'numeric',
  37. tickInterval: 10,
  38. valueMarginsEnabled: true,
  39. minValueMargin: 0,
  40. maxValueMargin: 0,
  41. min: -10,
  42. max: 40,
  43. label: {
  44. font: { color: '#c96374' },
  45. },
  46. title: {
  47. text: '온도 (°C)',
  48. },
  49. },
  50. {
  51. tickInterval: 10,
  52. valueMarginsEnabled: true,
  53. minValueMargin: 0,
  54. maxValueMargin: 0,
  55. //argumentType: 'numeric',
  56. min: 0,
  57. max: 100,
  58. label: {
  59. font: { color: '#00A7C6' },
  60. },
  61. name: 'humi', //
  62. position: 'left',
  63. pane: 'bottomPane',
  64. title: {
  65. text: '습도 (%)',
  66. }
  67. },
  68. {
  69. //tickInterval: 10,
  70. valueMarginsEnabled: true,
  71. minValueMargin: 0,
  72. maxValueMargin: 0,
  73. //argumentType: 'numeric',
  74. //min: 0,
  75. //max: 1,
  76. name: 'co2', //
  77. position: 'left',
  78. pane: 'lastPane',
  79. title: {
  80. text: 'CO2농도 (ppm)',
  81. },
  82. constantLines:
  83. [
  84. {
  85. position: 'right',
  86. label: {
  87. text: '허용농도',
  88. },
  89. width: 2,
  90. value: 800,
  91. color: 'red',
  92. dashStyle: 'dash'
  93. }],
  94. },
  95. /* {
  96. name: 't_temp', //
  97. position: 'right',
  98. pane: 'topPane',
  99. title: {
  100. text: '설정 실내온도 (°C)',
  101. }
  102. },
  103. {
  104. name: 't_humi', //
  105. position: 'right',
  106. pane: 'topPane',
  107. title: {
  108. text: '설정 실내습도 (%)',
  109. }
  110. },*/
  111. ];
  112. var series = [
  113. {
  114. type: 'rangeArea',
  115. pane: 'topPane',
  116. axis: 'temp',
  117. //valueField: 'tempSet',
  118. rangeValue1Field: "tempSetminT",
  119. rangeValue2Field: "tempSetmaxT",
  120. visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25
  121. point: { size: 0 },
  122. name: '목표실내온도',
  123. color: 'red',
  124. label: {
  125. visible: false,
  126. customizeText: function () {
  127. return this.valueText + ' °C';
  128. }
  129. }
  130. },
  131. {
  132. type: 'bar',
  133. pane: 'topPane',
  134. axis: 'temp',
  135. valueField: 'temp',
  136. visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25
  137. point: { size: 8 },
  138. name: '실내온도',
  139. //color: 'red',
  140. label: {
  141. visible: false,
  142. customizeText: function() {
  143. return this.valueText + ' °C';
  144. }
  145. }
  146. },
  147. {
  148. type: 'spline',
  149. pane: 'topPane',
  150. axis: 'temp',
  151. valueField: 'Temperature',
  152. visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25
  153. point: { size: 0 },
  154. name: '외기온도',
  155. //color: '#c96374',
  156. label: {
  157. visible: false,
  158. customizeText: function () {
  159. return this.valueText + ' °C';
  160. }
  161. }
  162. },
  163. /*
  164. {
  165. type: 'rangeArea',
  166. pane: 'bottomPane',
  167. axis: 'humi',
  168. //valueField: 'humiSet',
  169. rangeValue1Field: "humiSetminT",
  170. rangeValue2Field: "humiSetmaxT",
  171. point: { size: 0 },
  172. name: '목표실내습도',
  173. color: 'blue',
  174. label: {
  175. visible: false,
  176. customizeText: function () {
  177. return this.valueText + ' %';
  178. }
  179. }
  180. },*/
  181. {
  182. type: 'bar',
  183. pane: 'bottomPane',
  184. axis: 'humi',
  185. valueField: 'humi',
  186. point: { size: 8 },
  187. name: '실내습도',
  188. color: 'DeepSkyBlue',
  189. label: {
  190. visible: false,
  191. customizeText: function() {
  192. return this.valueText + ' %';
  193. }
  194. }
  195. },
  196. {
  197. type: 'spline',
  198. pane: 'bottomPane',
  199. axis: 'humi',
  200. valueField: 'Humidity',
  201. point: { size: 0 },
  202. name: '외기습도',
  203. //color: '#00A7C6',
  204. //color: 'blue',
  205. label: {
  206. visible: false,
  207. customizeText: function () {
  208. return this.valueText + ' %';
  209. }
  210. }
  211. },
  212. {
  213. type: 'bar',
  214. pane: 'lastPane',
  215. axis: 'co2',
  216. valueField: 'co2',
  217. visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25
  218. point: { size: 0},
  219. name: 'CO2농도',
  220. //color: 'red',
  221. label: {
  222. visible: false,
  223. customizeText: function () {
  224. return this.valueText + ' ppm';
  225. }
  226. }
  227. },
  228. ];
  229. //C.getSeriesOptions = function(fuelTypeId, goalUpperBound) {
  230. C.getSeriesOptions = function (codeTimeType, t_temp, t_humi) {
  231. return {
  232. legend: {
  233. visible: true,
  234. verticalAlignment: 'top',
  235. horizontalAlignment: 'center'
  236. },
  237. panes: [
  238. {
  239. name: 'topPane',
  240. border: {
  241. visible: false,
  242. left: false,
  243. right: false,
  244. top: false,
  245. color: 'gray'
  246. }
  247. },
  248. {
  249. name: 'bottomPane',
  250. border: {
  251. visible: false,
  252. left: false,
  253. right: false,
  254. top: false,
  255. color: 'gray'
  256. }
  257. },
  258. {
  259. name: 'lastPane',
  260. border: {
  261. visible: false,
  262. left: false,
  263. right: false,
  264. top: false,
  265. color: 'gray'
  266. }
  267. },
  268. ],
  269. customizePoint: function () {
  270. if (this.seriesName == "목표실내온도") {
  271. targetTempMax[this.index] = this.value;
  272. targetTempMin[this.index] = this.minValue;
  273. }
  274. if (this.seriesName == "실내온도" && this.value > targetTempMax[this.index] ) {
  275. return {
  276. color:'red',
  277. }
  278. }
  279. if (this.seriesName == "실내온도" && this.value < targetTempMin[this.index]) {
  280. return {
  281. color: 'blue',
  282. }
  283. }
  284. /*
  285. if (this.seriesName == "목표실내습도") {
  286. targetHumiMax[this.index] = this.value;
  287. targetHumiMin[this.index] = this.minValue;
  288. }
  289. if (this.seriesName == "실내습도" && this.value > targetHumiMax[this.index]) {
  290. return {
  291. color: 'red',
  292. }
  293. }
  294. if (this.seriesName == "실내습도" && this.value < targetHumiMin[this.index]) {
  295. return {
  296. color: 'blue',
  297. }
  298. }*/
  299. //if (this.seriesName == "CO2농도" && this.value > 0.2 or 0.5) {
  300. if (this.seriesName == "CO2농도" && this.value > 800) {
  301. return {
  302. color: 'red',
  303. }
  304. }
  305. },
  306. // series의 생성차례가 중요하다.
  307. /*
  308. customizeLabel: function () {
  309. if (this.seriesName == "목표실내온도") {
  310. targetTempMax[this.index] = this.value;
  311. targetTempMin[this.index] = this.minValue;
  312. }
  313. if (this.seriesName == "실내온도" && this.value > targetTempMax[this.index] ) {
  314. return {
  315. visible: true,
  316. precision: 2,
  317. format: 'fixedPoint',
  318. backgroundColor: '#ff4500',
  319. customizeText: function () {
  320. return this.valueText + ' (°C)'
  321. }
  322. }
  323. }
  324. if (this.seriesName == "실내온도" && this.value < targetTempMin[this.index]) {
  325. return {
  326. color:'blue',
  327. visible: true,
  328. precision: 2,
  329. format: 'fixedPoint',
  330. backgroundColor: 'blue',
  331. customizeText: function () {
  332. return this.valueText + ' (°C)'
  333. }
  334. }
  335. }
  336. if (this.seriesName == "목표실내습도") {
  337. targetHumiMax[this.index] = this.value;
  338. targetHumiMin[this.index] = this.minValue;
  339. }
  340. if (this.seriesName == "실내습도" && this.value > targetHumiMax[this.index]) {
  341. return {
  342. visible: true,
  343. precision: 0,
  344. format: 'fixedPoint',
  345. backgroundColor: '#ff4500',
  346. customizeText: function () {
  347. return this.valueText + ' (%)'
  348. }
  349. }
  350. }
  351. if (this.seriesName == "실내습도" && this.value < targetHumiMin[this.index]) {
  352. return {
  353. color: 'blue',
  354. visible: true,
  355. precision: 0,
  356. format: 'fixedPoint',
  357. backgroundColor: 'blue',
  358. customizeText: function () {
  359. return this.valueText + ' (%)'
  360. }
  361. }
  362. }
  363. },*/
  364. defaultPane: "topPane",
  365. commonSeriesSettings: {
  366. argumentField: "DateTime",
  367. selectionStyle: {
  368. hatching: {
  369. direction: "left"
  370. }
  371. }
  372. },
  373. argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), codeTimeType),
  374. //argumentAxis: BWA.Chart.getTimeLineArgumentAxis(null, codeTimeType),
  375. //argumentAxis: argumentAxisS[codeTimeType-1],
  376. /*
  377. valueAxis: [$.extend({}, {
  378. constantLines: [{
  379. label: {
  380. text: '설정 온도',
  381. },
  382. width: 2,
  383. value: goalUpperBound,
  384. color: '#ff4500',
  385. dashStyle: 'dash'
  386. }],
  387. showZero: true,
  388. //})].concat(valueAxises[0]),
  389. })].concat(valueAxises), */
  390. valueAxis:valueAxises,
  391. /*
  392. valueAxis:[$.extend({}, valueAxis, {
  393. })].concat($.extend({}, valueAxises[0], {
  394. })),*/
  395. series: series,
  396. tooltip: {
  397. enabled: true,
  398. format: 'fixedPoint',
  399. precision: 2,
  400. },
  401. crosshair: {
  402. enabled: true,
  403. width: 2,
  404. horizontalLine: {
  405. color: 'blue',
  406. dashStyle: 'dash',
  407. visible: false
  408. },
  409. verticalLine: {
  410. color: 'red',
  411. dashStyle: 'dash',
  412. visible: true
  413. },
  414. label: {
  415. visible: true,
  416. backgroundColor: "#949494",
  417. font: {
  418. color: "#fff",
  419. size: 12,
  420. }
  421. }
  422. }
  423. };
  424. };
  425. });