fb896c34f6d48ce57c595252e5e8402082344414.svn-base 8.3 KB

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