790719ae42efb446f5a50b9a0c3881b37378ffa0.svn-base 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. $(function () {
  2. BWA.ChartOptions = BWA.ChartOptions || {};
  3. BWA.ChartOptions.ToeEnergyUsage = {
  4. getPieChartDayOptions: function () {
  5. return _.extend({
  6. palette: "Pastel",
  7. }, BWA.ChartOptions.ToeEnergyUsage.getPieChartOptions());
  8. },
  9. getPieChartMonthOptions: function () {
  10. return _.extend({
  11. palette: "Pastel",
  12. }, BWA.ChartOptions.ToeEnergyUsage.getPieChartOptions());
  13. },
  14. getBarChartDayOptions: function () {
  15. return _.extend({
  16. palette: "Pastel",
  17. }, BWA.ChartOptions.ToeEnergyUsage.getBarChartOptions($Code.TimeType.DAY));
  18. },
  19. getBarChartMonthOptions: function (handlePointClick) {
  20. return _.extend({
  21. palette: "Pastel",
  22. }, BWA.ChartOptions.ToeEnergyUsage.getBarChartOptions($Code.TimeType.MONTH, handlePointClick));
  23. },
  24. getPieChartOptions: function () {
  25. return {
  26. legend: {
  27. horizontalAlignment: "right",
  28. verticalAlignment: "top",
  29. margin: 10,
  30. border: {
  31. visible: true
  32. }
  33. },
  34. tooltip: {
  35. enabled: true,
  36. format: 'fixedPoint',
  37. precision: 1,
  38. customizeTooltip: function (point) {
  39. return {
  40. text: [this.argumentText, ': ', this.valueText].join('')
  41. };
  42. }
  43. },
  44. series: [
  45. {
  46. type: "doughnut", // if not, pie.
  47. argumentField: "FuelTypeName",
  48. argumentType: "string",
  49. valueField: "Value",
  50. hoverStyle: {
  51. color: "#ffd700"
  52. },
  53. label: {
  54. visible: true,
  55. connector: {
  56. visible: true
  57. },
  58. customizeText: function (pointInfo) {
  59. //return pointInfo.argumentText;
  60. return pointInfo.percentText; //
  61. }
  62. }
  63. }
  64. ]
  65. };
  66. },
  67. getBarChartOptions: function (codeTimeType, handlePointClick) {
  68. var argumentAxis;
  69. switch (codeTimeType) {
  70. case $Code.TimeType.DAY:
  71. //argumentAxis.argumentType = 'string';
  72. //argumentAxis = {
  73. // label: {
  74. // customizeText: function () {
  75. // return this.value + '일';
  76. // }
  77. // },
  78. // tickInterval: 5,
  79. //};
  80. break;
  81. case $Code.TimeType.MONTH:
  82. /*
  83. argumentAxis = {
  84. label: {
  85. customizeText: function() {
  86. return this.value + '월';
  87. }
  88. },
  89. //min: 1,
  90. //max: 12,
  91. //valueMarginsEnabled: false,
  92. //tickInterval: 1,
  93. //minValueMargin: 0.0,
  94. //maxValueMargin: 0.02,
  95. };*/
  96. break;
  97. }
  98. //argumentAxis.argumentType = 'string';
  99. return {
  100. pointClick: handlePointClick,
  101. legend: {
  102. visible: false,
  103. verticalAlignment: 'center',
  104. horizontalAlignment: 'right',
  105. border: {
  106. visible: true
  107. }
  108. },
  109. animation: {
  110. enabled: true
  111. },
  112. argumentAxis: argumentAxis,
  113. commonSeriesSettings: {
  114. type: 'stackedBar',
  115. argumentField: 'DateTime',
  116. selectionStyle: {
  117. hatching: {
  118. direction: "left"
  119. }
  120. },
  121. //label: {
  122. // visible: true,
  123. // format: 'fixedPoint',
  124. // precision: 0,
  125. //}
  126. },
  127. valueAxis: [{
  128. label: {
  129. //format: 'thousands'
  130. //precision: 2
  131. },
  132. title: {
  133. text: 'TOE'
  134. }
  135. }],
  136. series: [{
  137. valueField: 'ElectricityToe',
  138. name: $G('electricity'),
  139. label: {
  140. //visible: true,
  141. //format: 'fixedPoint',
  142. //precision: 2,
  143. //customizeText: function() {
  144. // return this.valueText + 'TOE';
  145. //}
  146. }
  147. }, {
  148. //type: 'stackedBar',
  149. //type: 'bar',
  150. valueField: 'GasToe',
  151. name: $G('gas'),
  152. label: {
  153. //visible: true,
  154. //format: 'fixedPoint',
  155. //precision: 2,
  156. //customizeText: function() {
  157. // return this.valueText + 'TOE';
  158. //}
  159. }
  160. }, {
  161. //type: 'stackedBar',
  162. valueField: 'WaterToe',
  163. name: $G('water'),
  164. //label: {
  165. // visible: false,
  166. // customizeText: function() {
  167. // return this.valueText + 'TOE';
  168. // }
  169. //}
  170. }],
  171. tooltip: {
  172. enabled: true,
  173. format: 'fixedPoint',
  174. precision: 2,
  175. customizeTooltip: function (point) {
  176. return {
  177. text: [this.valueText].join('')
  178. };
  179. }
  180. },
  181. crosshair: {
  182. enabled: false,
  183. width: 2,
  184. horizontalLine: {
  185. //color: 'skyblue',
  186. dashStyle: 'dash',
  187. visible: false
  188. },
  189. verticalLine: {
  190. //color: 'limegreen',
  191. dashStyle: 'dash'
  192. },
  193. label: {
  194. visible: true,
  195. backgroundColor: "#949494",
  196. font: {
  197. color: "#fff",
  198. size: 12,
  199. }
  200. }
  201. }
  202. };
  203. },
  204. };
  205. });