94ef24b0572e894be996dc261a3bdd04ac518252.svn-base 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. $(function() {
  2. BWA.ChartOptions = BWA.ChartOptions || {};
  3. var C = BWA.ChartOptions.ServiceUsageByEnergy = BWA.ChartOptions.ServiceUsageByEnergy || {};
  4. var valueAxises = [{
  5. title: {
  6. text: $G('electricityUsageWithUnit')
  7. //text: 'sdfsdfsd'
  8. }
  9. }, {
  10. title: {
  11. text: $G('gasUsageWithUnit')
  12. }
  13. }, {
  14. title: {
  15. text: $G('waterUsageWithUnit')
  16. }
  17. }, {
  18. title: {
  19. text: $G('co2WithUnit')
  20. }
  21. }
  22. ];
  23. var series = [{
  24. type: 'bar',
  25. //minBarSize: 100,
  26. //ArgumentScaleType: ScaleType.Qualitative,
  27. /* Charges:{
  28. },*/
  29. valueField: 'Value',
  30. name: $G('electricityUsage'),
  31. label: {
  32. visible: false,
  33. customizeText: function () {
  34. alert(this.valueText + 'kWh');
  35. return this.valueText + 'kWh';
  36. }
  37. }
  38. }, {
  39. type: 'bar',
  40. valueField: 'Value',
  41. name: $G('gasUsage'),
  42. label: {
  43. visible: false,
  44. customizeText: function () {
  45. return '가스';
  46. return this.valueText + 'm3';
  47. }
  48. }
  49. }, {
  50. type: 'bar',
  51. valueField: 'Value',
  52. name: $G('waterUsage'),
  53. label: {
  54. visible: false,
  55. customizeText: function () {
  56. return '물';
  57. return this.valueText + 'm3';
  58. }
  59. }
  60. }, [{
  61. type: 'stackedBar',
  62. valueField: 'ECo2',
  63. name: $G('electricityCo2'),
  64. label: {
  65. visible: false,
  66. customizeText: function () {
  67. return 'CO2';
  68. return this.valueText + 'kgCO2';
  69. }
  70. }
  71. }, {
  72. type: 'stackedBar',
  73. valueField: 'GCo2',
  74. name: $G('gasCo2'),
  75. label: {
  76. visible: false,
  77. customizeText: function() {
  78. return this.valueText + 'kgCO2';
  79. }
  80. }
  81. }, {
  82. type: 'stackedBar',
  83. valueField: 'WCo2',
  84. name: $G('waterCo2'),
  85. label: {
  86. visible: false,
  87. customizeText: function() {
  88. return this.valueText + 'kgCO2';
  89. }
  90. }
  91. }]
  92. ];
  93. //C.getSeriesOptions = function (fuelTypeId, fuelTypeName, timeTypeId) {
  94. C.getSeriesOptions = function (fuelTypeId, timeTypeId) {
  95. return {
  96. /*
  97. argumentAxis : {
  98. label: {
  99. //format: 'monthAndDay'
  100. //var d = new Date(this.valueText);
  101. customizeText: function() {
  102. //return this.Value.toString();
  103. return this.value;
  104. //return '';
  105. }
  106. },
  107. },
  108. */
  109. valueAxis: valueAxises[fuelTypeId - 1],
  110. /* valueAxis:
  111. {
  112. title: {
  113. //text: $G('electricityUsageWithUnit')
  114. text: fuelTypeName
  115. }
  116. },*/
  117. commonSeriesSettings: {
  118. argumentType: 'datetime',
  119. argumentField: "DateTime",
  120. selectionStyle: {
  121. hatching: {
  122. direction: "left"
  123. }
  124. }
  125. },
  126. /*
  127. argumentAxis : {
  128. label: {
  129. customizeText: function() {
  130. //return this.value + '일';
  131. return '일';
  132. }
  133. },
  134. },*/
  135. //argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), timeTypeId),
  136. series: series[fuelTypeId - 1],
  137. //equalBarWidth:false,
  138. //equalBarWidth: { width: 40, spacing: 10 }, // x축 갯수에 따라 width 조정 필요함 2015 03 23
  139. //equalBarWidth: { spacing: 10 }, // x축 갯수에 따라 width 조정 필요함 2015 03 23
  140. argumentAxis: BWA.Chart.getTimeLineArgumentAxis(null, timeTypeId),
  141. };
  142. };
  143. // view에서 처음 한번 이거 필요 없을 듯 hcLee
  144. C.getChartOptions = function(codeTimeType) {
  145. return {
  146. palette: 'Bright',
  147. legend: {
  148. visible: true,
  149. verticalAlignment: 'top',
  150. horizontalAlignment: 'center'
  151. },
  152. argumentAxis: BWA.Chart.getTimeLineArgumentAxis(null, codeTimeType),
  153. //argumentAxis: BWA.Chart.getTimeLineArgumentAxis(moment(), codeTimeType),
  154. /*
  155. commonSeriesSettings: {
  156. //minBarSize : 300,
  157. //ArgumentScaleType: 'DateTime',
  158. argumentField: "DateTime",
  159. selectionStyle: {
  160. hatching: {
  161. direction: "left"
  162. }
  163. }
  164. }, */
  165. /*
  166. valueAxis: [{
  167. title: {
  168. text: $G('electricityConsumptionUsageWithUnit')
  169. }
  170. }], */
  171. valueAxis: valueAxises[0],
  172. series: series[0],
  173. //equalBarWidth: false,
  174. //equalBarWidth:100,
  175. //equalBarWidth: { spacing: 10 }, // x축 갯수에 따라 width 조정 필요함 2015 03 23
  176. //equalBarWidth: { spacing: 1 }, // x축 갯수에 따라 width 조정 필요함 2015 03 23
  177. tooltip: {
  178. enabled: true,
  179. },
  180. };
  181. };
  182. });