b0ea0ae42455bfca027abb7b69b28eb5c743da54.svn-base 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. $(function () {
  2. BWA.ChartOptions = BWA.ChartOptions || {};
  3. var seriesBudgetCode;
  4. //var seriesBudgetCode2;
  5. //var colors = ['Chocolate', 'MediumSeaGreen', 'DarkGoldenRod', 'DarkTurquoise', 'DarkViolet', 'Khaki'];
  6. var colors = ['#5F8B95', '#BA4D51', '#AF8A53', '#955F71', '#859666', 'DarkViolet'];
  7. BWA.ChartOptions.BudgetExecuteView = {
  8. MakeSeries: function (CodeType) {
  9. seriesBudgetCode = new Array();
  10. for (var s = 0; s < CodeType.length; s++) {
  11. var ss2 = {
  12. type: 'stackedBar',
  13. color: colors[s],
  14. axis: 'v_1', // 이것이 중요 !!!! 이렇게 axis를 다르게 명시해야 시리즈가 따로 생긴다 2015 12 08
  15. //valueField: CodeType[s].Name() + "누적",
  16. valueField: CodeType[s].Name() + "_B",
  17. name: "예산 " + CodeType[s].Name(),
  18. label: {
  19. visible: false,
  20. customizeText: function () {
  21. return this.valueText + '원';
  22. }
  23. }
  24. };
  25. seriesBudgetCode.push(ss2);
  26. var ss = {
  27. type: 'stackedBar',
  28. color: colors[s],
  29. //axis: 'v_1', // 이것이 중요 !!!! 이렇게 axis를 명시하지 않거나 다르게 v_2 로 명시해야 시리즈가 따로 생긴다 2015 12 08
  30. //valueField: CodeType[s].Name() + "누적",
  31. valueField: CodeType[s].Name(),
  32. name: CodeType[s].Name(),
  33. label: {
  34. visible: false,
  35. customizeText: function () {
  36. return this.valueText + '원';
  37. }
  38. }
  39. };
  40. seriesBudgetCode.push(ss);
  41. }
  42. },
  43. getPieChartDayOptions: function () {
  44. return _.extend({
  45. //palette: "Pastel",
  46. }, BWA.ChartOptions.BudgetExecuteView.getPieChartOptions());
  47. },
  48. getPieChartMonthOptions: function () {
  49. return _.extend({
  50. //palette: "Pastel",
  51. }, BWA.ChartOptions.BudgetExecuteView.getPieChartOptions());
  52. },
  53. getBarChartDayOptions: function (handlePointClick) {
  54. return _.extend({
  55. }, BWA.ChartOptions.BudgetExecuteView.getBarChartOptions($Code.TimeType.MONTH, handlePointClick));
  56. },
  57. getPieChartOptions: function () {
  58. return {
  59. legend: {
  60. horizontalAlignment: "right",
  61. verticalAlignment: "top",
  62. margin: 10,
  63. border: {
  64. visible: true
  65. }
  66. },
  67. tooltip: {
  68. enabled: true,
  69. format: 'fixedPoint',
  70. precision: 0,
  71. customizeTooltip: function (point) {
  72. return {
  73. text: [this.argumentText, ': ', this.valueText].join('')
  74. };
  75. }
  76. },
  77. series: [
  78. {
  79. type: "doughnut", // if not, pie.
  80. argumentField: "FuelTypeName",
  81. argumentType: "string",
  82. valueField: "Value",
  83. hoverStyle: {
  84. color: "#ffd700"
  85. },
  86. label: {
  87. visible: false,
  88. connector: {
  89. visible: true
  90. },
  91. customizeText: function (pointInfo) {
  92. return pointInfo.argumentText;
  93. }
  94. }
  95. }
  96. ]
  97. };
  98. },
  99. getBarChartOptions: function (codeTimeType, handlePointClick) {
  100. switch (codeTimeType) {
  101. case $Code.TimeType.DAY:
  102. argumentAxis = {
  103. label: {
  104. customizeText: function () {
  105. return this.value + '일';
  106. }
  107. },
  108. tickInterval: 5,
  109. };
  110. break;
  111. case $Code.TimeType.MONTH:
  112. argumentAxis = {
  113. label: {
  114. customizeText: function () {
  115. return this.value + '월';
  116. }
  117. },
  118. };
  119. break;
  120. }
  121. argumentAxis.argumentType = 'string';
  122. return {
  123. pointClick: handlePointClick,
  124. legend: {
  125. visible: false,
  126. verticalAlignment: 'center',
  127. horizontalAlignment: 'right',
  128. border: {
  129. visible: true
  130. }
  131. },
  132. argumentAxis: argumentAxis,
  133. commonSeriesSettings: {
  134. //type: 'stackedBar',
  135. argumentField: 'DateTime',
  136. selectionStyle: {
  137. hatching: {
  138. direction: "left"
  139. }
  140. }
  141. },
  142. valueAxis: [{
  143. name : "v_1",
  144. label: {
  145. //format: 'thousands'
  146. //precision: 2
  147. },
  148. title: {
  149. text: '원'
  150. }
  151. }],
  152. //series: [seriesBudgetCode, seriesBudgetCode2],
  153. series: seriesBudgetCode,
  154. tooltip: {
  155. enabled: true,
  156. format: 'fixedPoint',
  157. precision: 0,
  158. customizeTooltip: function(point) {
  159. return {
  160. text: [this.seriesName, ': ', this.valueText].join('')
  161. };
  162. }
  163. },
  164. };
  165. },
  166. };
  167. });