You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
3.9 KiB

9 years ago
  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. <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. yAxis: [{
  44. min: -20,
  45. max: 6,
  46. minorTickPosition: 'outside',
  47. tickPosition: 'outside',
  48. labels: {
  49. rotation: 'auto',
  50. distance: 20
  51. },
  52. plotBands: [{
  53. from: 0,
  54. to: 6,
  55. color: '#C02316',
  56. innerRadius: '100%',
  57. outerRadius: '105%'
  58. }],
  59. pane: 0,
  60. title: {
  61. text: 'VU<br/><span style="font-size:8px">Channel A</span>',
  62. y: -40
  63. }
  64. }, {
  65. min: -20,
  66. max: 6,
  67. minorTickPosition: 'outside',
  68. tickPosition: 'outside',
  69. labels: {
  70. rotation: 'auto',
  71. distance: 20
  72. },
  73. plotBands: [{
  74. from: 0,
  75. to: 6,
  76. color: '#C02316',
  77. innerRadius: '100%',
  78. outerRadius: '105%'
  79. }],
  80. pane: 1,
  81. title: {
  82. text: 'VU<br/><span style="font-size:8px">Channel B</span>',
  83. y: -40
  84. }
  85. }],
  86. plotOptions: {
  87. gauge: {
  88. dataLabels: {
  89. enabled: false
  90. },
  91. dial: {
  92. radius: '100%'
  93. }
  94. }
  95. },
  96. series: [{
  97. data: [-20],
  98. yAxis: 0
  99. }, {
  100. data: [-20],
  101. yAxis: 1
  102. }]
  103. },
  104. // Let the music play
  105. function (chart) {
  106. setInterval(function () {
  107. if (chart.series) { // the chart may be destroyed
  108. var left = chart.series[0].points[0],
  109. right = chart.series[1].points[0],
  110. leftVal,
  111. rightVal,
  112. inc = (Math.random() - 0.5) * 3;
  113. leftVal = left.y + inc;
  114. rightVal = leftVal + inc / 3;
  115. if (leftVal < -20 || leftVal > 6) {
  116. leftVal = left.y - inc;
  117. }
  118. if (rightVal < -20 || rightVal > 6) {
  119. rightVal = leftVal;
  120. }
  121. left.update(leftVal, false);
  122. right.update(rightVal, false);
  123. chart.redraw();
  124. }
  125. }, 500);
  126. });
  127. });
  128. </script>
  129. </head>
  130. <body>
  131. <script src="../../js/highcharts.js"></script>
  132. <script src="../../js/highcharts-more.js"></script>
  133. <script src="../../js/modules/exporting.js"></script>
  134. <div id="container" style="width: 600px; height: 300px; margin: 0 auto"></div>
  135. </body>
  136. </html>