index.htm 3.5 KB

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