index.htm 3.3 KB

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