index.htm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Highcharts Example</title>
  6. <script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
  7. <style type="text/css">
  8. ${demo.css}
  9. </style>
  10. <script type="text/javascript">
  11. $(function () {
  12. $('#container').highcharts({
  13. chart: {
  14. type: 'gauge',
  15. plotBorderWidth: 1,
  16. plotBackgroundColor: {
  17. linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
  18. stops: [
  19. [0, '#FFF4C6'],
  20. [0.3, '#FFFFFF'],
  21. [1, '#FFF4C6']
  22. ]
  23. },
  24. plotBackgroundImage: null,
  25. height: 200
  26. },
  27. title: {
  28. text: 'VU meter'
  29. },
  30. pane: [{
  31. startAngle: -45,
  32. endAngle: 45,
  33. background: null,
  34. center: ['25%', '145%'],
  35. size: 300
  36. }, {
  37. startAngle: -45,
  38. endAngle: 45,
  39. background: null,
  40. center: ['75%', '145%'],
  41. size: 300
  42. }],
  43. tooltip: {
  44. enabled: false
  45. },
  46. yAxis: [{
  47. min: -20,
  48. max: 6,
  49. minorTickPosition: 'outside',
  50. tickPosition: 'outside',
  51. labels: {
  52. rotation: 'auto',
  53. distance: 20
  54. },
  55. plotBands: [{
  56. from: 0,
  57. to: 6,
  58. color: '#C02316',
  59. innerRadius: '100%',
  60. outerRadius: '105%'
  61. }],
  62. pane: 0,
  63. title: {
  64. text: 'VU<br/><span style="font-size:8px">Channel A</span>',
  65. y: -40
  66. }
  67. }, {
  68. min: -20,
  69. max: 6,
  70. minorTickPosition: 'outside',
  71. tickPosition: 'outside',
  72. labels: {
  73. rotation: 'auto',
  74. distance: 20
  75. },
  76. plotBands: [{
  77. from: 0,
  78. to: 6,
  79. color: '#C02316',
  80. innerRadius: '100%',
  81. outerRadius: '105%'
  82. }],
  83. pane: 1,
  84. title: {
  85. text: 'VU<br/><span style="font-size:8px">Channel B</span>',
  86. y: -40
  87. }
  88. }],
  89. plotOptions: {
  90. gauge: {
  91. dataLabels: {
  92. enabled: false
  93. },
  94. dial: {
  95. radius: '100%'
  96. }
  97. }
  98. },
  99. series: [{
  100. name: 'Channel A',
  101. data: [-20],
  102. yAxis: 0
  103. }, {
  104. name: 'Channel B',
  105. data: [-20],
  106. yAxis: 1
  107. }]
  108. },
  109. // Let the music play
  110. function (chart) {
  111. setInterval(function () {
  112. if (chart.series) { // the chart may be destroyed
  113. var left = chart.series[0].points[0],
  114. right = chart.series[1].points[0],
  115. leftVal,
  116. rightVal,
  117. inc = (Math.random() - 0.5) * 3;
  118. leftVal = left.y + inc;
  119. rightVal = leftVal + inc / 3;
  120. if (leftVal < -20 || leftVal > 6) {
  121. leftVal = left.y - inc;
  122. }
  123. if (rightVal < -20 || rightVal > 6) {
  124. rightVal = leftVal;
  125. }
  126. left.update(leftVal, false);
  127. right.update(rightVal, false);
  128. chart.redraw();
  129. }
  130. }, 500);
  131. });
  132. });
  133. </script>
  134. </head>
  135. <body>
  136. <script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
  137. <script src="http://cdn.hcharts.cn/highcharts/highcharts-more.js"></script>
  138. <script src="http://cdn.hcharts.cn/highcharts/modules/exporting.js"></script>
  139. <div id="container" style="width: 600px; height: 300px; margin: 0 auto"></div>
  140. </body>
  141. </html>