71f4c5202b233787534163d3796f73fde019a308.svn-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. $(function() {
  2. BWA.ChartOptions = BWA.ChartOptions || {};
  3. BWA.ChartOptions.MonthMoney = {
  4. getPieChartDayOptions: function() {
  5. return _.extend({
  6. //palette: "Pastel",
  7. }, BWA.ChartOptions.MonthMoney.getPieChartOptions());
  8. },
  9. getPieChartMonthOptions: function() {
  10. return _.extend({
  11. //palette: "Pastel",
  12. }, BWA.ChartOptions.MonthMoney.getPieChartOptions());
  13. },
  14. getBarChartDayOptions: function() {
  15. return _.extend({
  16. //palette: "Pastel",
  17. }, BWA.ChartOptions.MonthMoney.getBarChartOptions($Code.TimeType.DAY));
  18. },
  19. getBarChartMonthOptions: function(handlePointClick) {
  20. return _.extend({
  21. //palette: "Pastel",
  22. }, BWA.ChartOptions.MonthMoney.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: 0,
  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. }
  61. }
  62. }
  63. ]
  64. };
  65. },
  66. getBarChartOptions: function (codeTimeType, handlePointClick) {
  67. var argumentAxis;
  68. switch (codeTimeType) {
  69. case $Code.TimeType.DAY:
  70. argumentAxis = {
  71. label: {
  72. customizeText: function() {
  73. return this.value + '일';
  74. }
  75. },
  76. //min: moment().startOf('month').date(),
  77. //max: moment().endOf('month').date(),
  78. //valueMarginsEnabled: false,
  79. tickInterval: 5,
  80. //minValueMargin: 0.0,
  81. //maxValueMargin: 0.02,
  82. };
  83. break;
  84. case $Code.TimeType.MONTH:
  85. argumentAxis = {
  86. label: {
  87. customizeText: function() {
  88. return this.value + '월';
  89. }
  90. },
  91. //min: 1,
  92. //max: 12,
  93. //valueMarginsEnabled: false,
  94. //tickInterval: 1,
  95. //minValueMargin: 0.0,
  96. //maxValueMargin: 0.02,
  97. };
  98. break;
  99. }
  100. argumentAxis.argumentType = 'string';
  101. return {
  102. pointClick: handlePointClick,
  103. legend: {
  104. visible: false,
  105. verticalAlignment: 'center',
  106. horizontalAlignment: 'right',
  107. border: {
  108. visible: true
  109. }
  110. },
  111. argumentAxis: argumentAxis,
  112. commonSeriesSettings: {
  113. type: 'stackedBar',
  114. argumentField: 'DateTime',
  115. selectionStyle: {
  116. hatching: {
  117. direction: "left"
  118. }
  119. }
  120. },
  121. valueAxis: [{
  122. label: {
  123. format: 'currency',
  124. //precision: 0
  125. },
  126. title: {
  127. text: '원'
  128. }
  129. }],
  130. series: [{
  131. valueField: 'Elec',
  132. name: $G('electricity'),
  133. label: {
  134. visible: false,
  135. customizeText: function() {
  136. return this.valueText + '원';
  137. }
  138. }
  139. }, {
  140. type: 'stackedBar',
  141. valueField: 'Gas',
  142. name: $G('gas'),
  143. label: {
  144. visible: false,
  145. customizeText: function() {
  146. return this.valueText + '원';
  147. }
  148. }
  149. }, {
  150. type: 'stackedBar',
  151. valueField: 'Water',
  152. name: $G('water'),
  153. label: {
  154. visible: false,
  155. customizeText: function() {
  156. return this.valueText + '원';
  157. }
  158. }
  159. }],
  160. tooltip: {
  161. enabled: true,
  162. format: 'fixedPoint',
  163. precision: 0,
  164. //customizeTooltip: function(point) {
  165. // return {
  166. // text: [this.argumentText, ': ', this.valueText].join('')
  167. // };
  168. //}
  169. },
  170. };
  171. },
  172. };
  173. });