902e534ed3225430f9ee1a222b8061ffc53f3fb2.svn-base 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. $(function () {
  2. BWA.ChartOptions = BWA.ChartOptions || {};
  3. var C = BWA.ChartOptions.RealtimeEnergyConsumption = BWA.ChartOptions.RealtimeEnergyConsumption || {};
  4. var valueAxises = [{
  5. pane: 'topPane',
  6. name: 'Temperature',
  7. position: 'right',
  8. tick: {
  9. visible: false,
  10. },
  11. grid: {
  12. visible: false,
  13. },
  14. type: 'continuous',
  15. valueType: 'numeric',
  16. tickInterval: 3,
  17. minValueMargin: 0,
  18. maxValueMargin: 0,
  19. valueMarginsEnabled: true,
  20. title: {
  21. text: $G('outdoorTemperatureWithUnit')
  22. }
  23. },
  24. {
  25. pane: 'topPane',
  26. name: 'humidity',
  27. position: 'right',
  28. type: 'continuous',
  29. valueType: 'numeric',
  30. tick: {
  31. visible: false,
  32. },
  33. grid: {
  34. visible: false,
  35. },
  36. tickInterval: 5,
  37. minValueMargin: 0,
  38. maxValueMargin: 0,
  39. valueMarginsEnabled: true,
  40. title: {
  41. text: $G('outdoorHumidityWithUnit')
  42. },
  43. }];
  44. var fuelTypeValueAxises = [{
  45. pane: 'topPane',
  46. title: {
  47. text: $G('electricityUsageWithUnit')
  48. },
  49. grid: {
  50. visible: true,
  51. },
  52. }, {
  53. pane: 'topPane',
  54. title: {
  55. text: $G('gasUsageWithUnit')
  56. }
  57. }, {
  58. pane: 'topPane',
  59. title: {
  60. text: $G('waterUsageWithUnit')
  61. }
  62. }];
  63. var series = [{
  64. type: 'spline',
  65. pane: 'topPane',
  66. axis: 'Temperature',
  67. valueField: 'Temperature',
  68. visible: true, // 시리즈만 안보이게 할수 있다. 대신 그렇게 할려면 시작은 false로 해야 한다 hcLee 2015 04 25
  69. point: { size: 8 },
  70. color: 'red',
  71. name: $G('outdoorTemperature'),
  72. label: {
  73. visible: false,
  74. customizeText: function () {
  75. return this.valueText + ' °C';
  76. }
  77. }
  78. }, {
  79. type: 'spline',
  80. pane: 'topPane',
  81. axis: 'humidity',
  82. valueField: 'Humidity',
  83. color: 'blue',
  84. point: { size: 8 },
  85. name: $G('outdoorHumidity'),
  86. label: {
  87. visible: false,
  88. customizeText: function () {
  89. return this.valueText + ' %';
  90. }
  91. }
  92. }];
  93. var fuelTypeSeries = [{
  94. type: 'bar',
  95. pane: 'topPane',
  96. valueField: 'Value',
  97. name: $G('elec'),
  98. label: {
  99. horizontalAlignment: 'left',
  100. visible: false,
  101. customizeText: function () {
  102. return this.valueText + 'kWh';
  103. }
  104. }
  105. }, {
  106. type: 'bar',
  107. pane: 'topPane',
  108. valueField: 'Value',
  109. name: $G('gas'),
  110. label: {
  111. visible: false,
  112. customizeText: function () {
  113. return this.valueText + 'm3';
  114. }
  115. }
  116. }, {
  117. type: 'bar',
  118. pane: 'topPane',
  119. valueField: 'Value',
  120. name: $G('water'),
  121. label: {
  122. visible: false,
  123. customizeText: function () {
  124. return this.valueText + '㎥';
  125. }
  126. }
  127. }];
  128. C.getSeriesOptions = function (fuelTypeId, goalUpperBound) {
  129. return {
  130. palette: 'Ocean',
  131. valueAxis: [$.extend({}, fuelTypeValueAxises[fuelTypeId - 1], {
  132. showZero: true,
  133. })].concat(valueAxises),
  134. series: [fuelTypeSeries[fuelTypeId - 1]].concat(series),
  135. argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), $Code.TimeType.QUARTERMIN),
  136. };
  137. };
  138. C.getChartOptions = function (codeTimeType, goalUpperBound) {
  139. return {
  140. legend: {
  141. visible: true,
  142. verticalAlignment: 'top',
  143. horizontalAlignment: 'center',
  144. },
  145. argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), codeTimeType),
  146. commonSeriesSettings: {
  147. argumentField: "DateTime",
  148. selectionStyle: {
  149. hatching: {
  150. direction: "right"
  151. }
  152. }
  153. },
  154. panes: [{
  155. name: 'topPane',
  156. border: {
  157. visible: false,
  158. left: false,
  159. right: false,
  160. top: false,
  161. color: 'gray'
  162. }
  163. }, ],
  164. defaultPane: "topPane",
  165. customizePoint: function () {
  166. },
  167. tooltip: {
  168. enabled: true,
  169. format: 'fixedPoint',
  170. precision: 2,
  171. shared: true,
  172. argumentFormat: 'shortDate',
  173. customizeTooltip: function (point) {
  174. return {
  175. text: "[" + point.argument.format("hh시 mm분") + "]" + "<br/>" + "<br/>" + point.valueText
  176. };
  177. }
  178. },
  179. crosshair: {
  180. enabled: true,
  181. width: 2,
  182. horizontalLine: {
  183. dashStyle: 'dash',
  184. visible: false
  185. },
  186. verticalLine: {
  187. dashStyle: 'dash'
  188. },
  189. label: {
  190. visible: true,
  191. backgroundColor: "#949494",
  192. font: {
  193. color: "#fff",
  194. size: 12,
  195. }
  196. }
  197. }
  198. };
  199. };
  200. });