Guest User

Untitled

a guest
Apr 25th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.89 KB | None | 0 0
  1. function drilledData(point) {
  2.  
  3. var data = {
  4.  
  5. 'Region1_Central': [
  6. {
  7. name: 'Store1',
  8. id: 'Region1_Central_Store1',
  9. type: 'line',
  10. data: [58.6, 86.5, 65.8]
  11. },
  12. {
  13. name: 'Store2',
  14. id: 'Region1_Central_Store2',
  15. type: 'line',
  16. data: [86.5, 65.8, 58.6]
  17. }
  18.  
  19. ],
  20.  
  21. 'Region1_East': [
  22. {
  23. name: 'Store1',
  24. id: 'Region1_East_Store1',
  25. type: 'line',
  26. data: [58.6, 86.5, 65.8]
  27. },
  28. {
  29. name: 'Store2',
  30. id: 'Region1_East_Store2',
  31. type: 'line',
  32. data: [86.5, 65.8, 58.6]
  33. }
  34.  
  35. ],
  36.  
  37. 'Region1_West': [
  38. {
  39. name: 'Store1',
  40. id: 'Region1_West_Store1',
  41. type: 'line',
  42. data: [58.6, 86.5, 65.8]
  43. },
  44. {
  45. name: 'Store2',
  46. id: 'Region1_West_Store2',
  47. type: 'line',
  48. data: [86.5, 65.8, 58.6]
  49. }
  50.  
  51. ],
  52.  
  53. 'Region2_Central': [
  54. {
  55. name: 'Store1',
  56. id: 'Region2_Central_Store1',
  57. type: 'line',
  58. data: [58.6, 86.5, 65.8]
  59. },
  60. {
  61. name: 'Store2',
  62. id: 'Region2_Central_Store2',
  63. type: 'line',
  64. data: [86.5, 65.8, 58.6]
  65. }
  66.  
  67. ],
  68.  
  69. 'Region2_East': [
  70. {
  71. name: 'Store1',
  72. id: 'Region2_East_Store1',
  73. type: 'line',
  74. data: [58.6, 86.5, 65.8]
  75. },
  76. {
  77. name: 'Store2',
  78. id: 'Region2_East_Store2',
  79. type: 'line',
  80. data: [86.5, 65.8, 58.6]
  81. }
  82.  
  83. ],
  84.  
  85. 'Region2_West': [
  86. {
  87. name: 'Store1',
  88. id: 'Region2_West_Store1',
  89. type: 'line',
  90. data: [58.6, 86.5, 65.8]
  91. },
  92. {
  93. name: 'Store2',
  94. id: 'Region2_West_Store2',
  95. type: 'line',
  96. data: [86.5, 65.8, 58.6]
  97. }
  98.  
  99. ]
  100.  
  101. };
  102.  
  103. return data[point];
  104.  
  105. }
  106. // Create the chart
  107. Highcharts.chart('container', {
  108.  
  109. chart: {
  110. type: 'line',
  111. events: {
  112. drilldown: function (e) {
  113.  
  114. if (!e.seriesOptions) {
  115.  
  116. var chart = this,
  117. drillSeries = drilledData(e.point.id);
  118.  
  119. chart.addSingleSeriesAsDrilldown(e.point, drillSeries[0]);
  120. chart.addSingleSeriesAsDrilldown(e.point, drillSeries[1]);
  121. chart.applyDrilldown();
  122. }
  123. }
  124. }
  125. },
  126. title: {
  127. text: 'Demo customer widget(Multiple Levels' Drilldown)'
  128. },
  129.  
  130. xAxis: {
  131. categories: ['Jan', 'Feb', 'Mar']
  132. },
  133.  
  134. yAxis: [{ // Primary yAxis
  135. labels: {
  136. format: '{value}',
  137. style: {
  138. color: 'blue'
  139. }
  140. },
  141. title: {
  142. text: 'Average Score (in %)',
  143. style: {
  144. color: 'black'
  145. }
  146. }
  147. }
  148. ],
  149. tooltip: {
  150. headerFormat: '<b>{point.name}</b><br/>',
  151. pointFormat: '{series.name}: {point.y:.1f}%'
  152. },
  153. plotOptions: {
  154. line: {
  155. allowPointSelect: true,
  156. cursor: 'pointer',
  157. dataLabels: {
  158. enabled: true
  159. },
  160. showInLegend: true
  161. },
  162. series: {
  163. compare: 'percent'
  164. }
  165.  
  166. },
  167. series: [{
  168. name: 'Region1',
  169. data: [{
  170. id: 'Region1_Central',
  171. name: 'Central',
  172. y: 60,
  173. drilldown: true
  174. }, {
  175. id: 'Region1_East',
  176. name: 'East',
  177. y: 30,
  178. drilldown: true
  179. }, {
  180. id: 'Region1_West',
  181. name: 'West',
  182. y: 40,
  183. drilldown: true
  184. }
  185. ]
  186.  
  187. }, {
  188. name: 'Region2',
  189. data: [{
  190. id: 'Region2_Central',
  191. name: 'Central',
  192. y: 40,
  193. drilldown: true
  194. }, {
  195. id: 'Region2_East',
  196. name: 'East',
  197. y: 70,
  198. drilldown: true
  199. }, {
  200. id: 'Region2_West',
  201. name: 'West',
  202. y: 60,
  203. drilldown: true
  204. }
  205. ]
  206. }
  207. ]
  208. });
Add Comment
Please, Sign In to add comment