ef1887a24394cbb86061c56976cce709dc9abfdf.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. $(function () {
  2. BWA.ChartOptions = BWA.ChartOptions || {};
  3. var C = BWA.ChartOptions.FmsEnergy = BWA.ChartOptions.FmsEnergy || {};
  4. var valueAxises = [
  5. {
  6. name: 've',
  7. title: {
  8. text: $G('electricityUsageWithUnit')
  9. }
  10. }, {
  11. name: 'vg',
  12. title: {
  13. text: $G('gasUsageWithUnit')
  14. }
  15. }, {
  16. name: 'vw',
  17. title: {
  18. text: $G('waterUsageWithUnit')
  19. }
  20. }, {
  21. name: 'vco2',
  22. title: {
  23. text: $G('co2WithUnit')
  24. }
  25. }, {
  26. name: 'vco2Last',
  27. position: 'right',
  28. title: {
  29. text: '작년 CO2 발생량'
  30. }
  31. }
  32. ];
  33. var seriesS = [
  34. {
  35. type: 'bar',
  36. valueField: 'Value',
  37. axis: 've',
  38. name: $G('electricityUsage'),
  39. label: {
  40. visible: false,
  41. customizeText: function () {
  42. return this.valueText + 'kWh';
  43. }
  44. }
  45. }, {
  46. type: 'bar',
  47. valueField: 'Value',
  48. axis: 'vg',
  49. name: $G('gasUsage'),
  50. label: {
  51. visible: false,
  52. customizeText: function () {
  53. return this.valueText + 'm3';
  54. }
  55. }
  56. }, {
  57. type: 'bar',
  58. valueField: 'Value',
  59. axis: 'vw',
  60. name: $G('waterUsage'),
  61. label: {
  62. visible: false,
  63. customizeText: function () {
  64. return this.valueText + 'm3';
  65. }
  66. }
  67. },
  68. [
  69. {
  70. type: 'stackedBar',
  71. valueField: 'ECo2',
  72. axis: 'vco2',
  73. name: $G('electricityCo2'),
  74. label: {
  75. visible: false,
  76. customizeText: function () {
  77. return this.valueText + 'kgCO2';
  78. }
  79. }
  80. }, {
  81. type: 'stackedBar',
  82. axis: 'vco2',
  83. valueField: 'GCo2',
  84. name: $G('gasCo2'),
  85. label: {
  86. visible: false,
  87. customizeText: function () {
  88. return this.valueText + 'kgCO2';
  89. }
  90. }
  91. }
  92. ],
  93. [
  94. {
  95. type: 'stackedBar',
  96. valueField: 'ECo2Last',
  97. name: '전년 전력 CO2',
  98. label: {
  99. visible: false,
  100. customizeText: function () {
  101. return this.valueText + 'kgCO2';
  102. }
  103. }
  104. }, {
  105. type: 'stackedBar',
  106. valueField: 'GCo2Last',
  107. name: '전년 가스 CO2',
  108. label: {
  109. visible: false,
  110. customizeText: function () {
  111. return this.valueText + 'kgCO2';
  112. }
  113. }
  114. }
  115. ]
  116. ];
  117. var seriesLastYear = [
  118. {
  119. type: 'bar',
  120. axis: 've',
  121. valueField: 'ValueLast',
  122. name: '전년 전력 사용량',
  123. label: {
  124. visible: false,
  125. customizeText: function () {
  126. return this.valueText + 'kWh';
  127. }
  128. }
  129. }, {
  130. type: 'bar',
  131. axis: 'vg',
  132. valueField: 'ValueLast',
  133. name: '전년 가스 사용량',
  134. label: {
  135. visible: false,
  136. customizeText: function () {
  137. return this.valueText + 'm3';
  138. }
  139. }
  140. }, {
  141. type: 'bar',
  142. axis: 'vw',
  143. valueField: 'ValueLast',
  144. name: '전년 수도 사용량',
  145. label: {
  146. visible: false,
  147. customizeText: function () {
  148. return this.valueText + 'm3';
  149. }
  150. }
  151. },
  152. [
  153. {
  154. type: 'stackedBar',
  155. axis: 'vco2',
  156. valueField: 'ECo2Last',
  157. name: '전년 전력 CO2',
  158. label: {
  159. visible: false,
  160. customizeText: function () {
  161. return this.valueText + 'kgCO2';
  162. }
  163. }
  164. }, {
  165. type: 'stackedBar',
  166. axis: 'vco2',
  167. valueField: 'GCo2Last',
  168. name: '전년 가스 CO2',
  169. label: {
  170. visible: false,
  171. customizeText: function () {
  172. return this.valueText + 'kgCO2';
  173. }
  174. }
  175. }
  176. ]
  177. ];
  178. C.getSeriesOptions = function (fuelTypeId, timeTypeId, MS, ME) {
  179. return {
  180. valueAxis: valueAxises[fuelTypeId - 1],
  181. commonSeriesSettings: {
  182. argumentField: "DateTime",
  183. selectionStyle: {
  184. hatching: {
  185. direction: "left"
  186. }
  187. }
  188. },
  189. series: (fuelTypeId > 3) ? seriesS[fuelTypeId - 1].concat(seriesS[fuelTypeId - 1]) : [seriesS[fuelTypeId - 1]]
  190. //series: (fuelTypeId > 3) ? seriesS[fuelTypeId - 1].concat(seriesS[fuelTypeId - 1]) : [seriesS[fuelTypeId - 1]].concat(seriesLastYear[fuelTypeId - 1])
  191. };
  192. };
  193. C.getChartOptions = function (codeTimeType) {
  194. return {
  195. palette: 'Bright',
  196. legend: {
  197. visible: true,
  198. verticalAlignment: 'top',
  199. horizontalAlignment: 'center'
  200. },
  201. commonSeriesSettings: {
  202. argumentField: "DateTime",
  203. selectionStyle: {
  204. hatching: {
  205. direction: "left"
  206. }
  207. }
  208. },
  209. valueAxis: [{
  210. title: {
  211. text: $G('electricityConsumptionUsageWithUnit')
  212. }
  213. }],
  214. series: seriesS[0],
  215. tooltip: {
  216. enabled: true,
  217. format: 'fixedPoint',
  218. precision: 2,
  219. argumentFormat: 'shortDate',
  220. customizeText: function () {
  221. return this.argumentText + "<br/>" + "<br/>" + this.valueText;
  222. }
  223. },
  224. crosshair: {
  225. enabled: true,
  226. width: 2,
  227. horizontalLine: {
  228. color: 'red',
  229. dashStyle: 'dash',
  230. visible: false
  231. },
  232. verticalLine: {
  233. color: 'red',
  234. dashStyle: 'dash',
  235. visible: true
  236. },
  237. label: {
  238. visible: true,
  239. backgroundColor: "#949494",
  240. font: {
  241. color: "#fff",
  242. size: 12,
  243. }
  244. }
  245. }
  246. };
  247. };
  248. });