4d9b5ebb8136a800d1a72af82b049b09dd734110.svn-base 5.9 KB

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