index.htm 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Highcharts Example</title>
  7. <style type="text/css">
  8. #container1 {
  9. max-width: 800px;
  10. height: 115px;
  11. margin: 1em auto;
  12. }
  13. #container2, #container3 {
  14. max-width: 800px;
  15. height: 85px;
  16. margin: 1em auto;
  17. }
  18. .hc-cat-title {
  19. font-size: 13px;
  20. font-weight: bold;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <script src="../../code/highcharts.js"></script>
  26. <script src="../../code/modules/bullet.js"></script>
  27. <div id="container1"></div>
  28. <div id="container2"></div>
  29. <div id="container3"></div>
  30. <script type="text/javascript">
  31. Highcharts.setOptions({
  32. chart: {
  33. inverted: true,
  34. marginLeft: 135,
  35. type: 'bullet'
  36. },
  37. title: {
  38. text: null
  39. },
  40. legend: {
  41. enabled: false
  42. },
  43. yAxis: {
  44. gridLineWidth: 0
  45. },
  46. plotOptions: {
  47. series: {
  48. pointPadding: 0.25,
  49. borderWidth: 0,
  50. color: '#000',
  51. targetOptions: {
  52. width: '200%'
  53. }
  54. }
  55. },
  56. credits: {
  57. enabled: false
  58. },
  59. exporting: {
  60. enabled: false
  61. }
  62. });
  63. Highcharts.chart('container1', {
  64. chart: {
  65. marginTop: 40
  66. },
  67. title: {
  68. text: '2017 YTD'
  69. },
  70. xAxis: {
  71. categories: ['<span class="hc-cat-title">Revenue</span><br/>U.S. $ (1,000s)']
  72. },
  73. yAxis: {
  74. plotBands: [{
  75. from: 0,
  76. to: 150,
  77. color: '#666'
  78. }, {
  79. from: 150,
  80. to: 225,
  81. color: '#999'
  82. }, {
  83. from: 225,
  84. to: 9e9,
  85. color: '#bbb'
  86. }],
  87. title: null
  88. },
  89. series: [{
  90. data: [{
  91. y: 275,
  92. target: 250
  93. }]
  94. }],
  95. tooltip: {
  96. pointFormat: '<b>{point.y}</b> (with target at {point.target})'
  97. }
  98. });
  99. Highcharts.chart('container2', {
  100. xAxis: {
  101. categories: ['<span class="hc-cat-title">Profit</span><br/>%']
  102. },
  103. yAxis: {
  104. plotBands: [{
  105. from: 0,
  106. to: 20,
  107. color: '#666'
  108. }, {
  109. from: 20,
  110. to: 25,
  111. color: '#999'
  112. }, {
  113. from: 25,
  114. to: 100,
  115. color: '#bbb'
  116. }],
  117. labels: {
  118. format: '{value}%'
  119. },
  120. title: null
  121. },
  122. series: [{
  123. data: [{
  124. y: 22,
  125. target: 27
  126. }]
  127. }],
  128. tooltip: {
  129. pointFormat: '<b>{point.y}</b> (with target at {point.target})'
  130. }
  131. });
  132. Highcharts.chart('container3', {
  133. xAxis: {
  134. categories: ['<span class="hc-cat-title">New Customers</span><br/>Count']
  135. },
  136. yAxis: {
  137. plotBands: [{
  138. from: 0,
  139. to: 1400,
  140. color: '#666'
  141. }, {
  142. from: 1400,
  143. to: 2000,
  144. color: '#999'
  145. }, {
  146. from: 2000,
  147. to: 9e9,
  148. color: '#bbb'
  149. }],
  150. labels: {
  151. format: '{value}'
  152. },
  153. title: null
  154. },
  155. series: [{
  156. data: [{
  157. y: 1650,
  158. target: 2100
  159. }]
  160. }],
  161. tooltip: {
  162. pointFormat: '<b>{point.y}</b> (with target at {point.target})'
  163. },
  164. credits: {
  165. enabled: true
  166. }
  167. });
  168. </script>
  169. </body>
  170. </html>