index.htm 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. plotBackgroundColor: null,
  13. plotBackgroundImage: null,
  14. plotBorderWidth: 0,
  15. plotShadow: false
  16. },
  17. title: {
  18. text: 'Speedometer'
  19. },
  20. pane: {
  21. startAngle: -150,
  22. endAngle: 150,
  23. background: [{
  24. backgroundColor: {
  25. linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
  26. stops: [
  27. [0, '#FFF'],
  28. [1, '#333']
  29. ]
  30. },
  31. borderWidth: 0,
  32. outerRadius: '109%'
  33. }, {
  34. backgroundColor: {
  35. linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
  36. stops: [
  37. [0, '#333'],
  38. [1, '#FFF']
  39. ]
  40. },
  41. borderWidth: 1,
  42. outerRadius: '107%'
  43. }, {
  44. // default background
  45. }, {
  46. backgroundColor: '#DDD',
  47. borderWidth: 0,
  48. outerRadius: '105%',
  49. innerRadius: '103%'
  50. }]
  51. },
  52. // the value axis
  53. yAxis: {
  54. min: 0,
  55. max: 200,
  56. minorTickInterval: 'auto',
  57. minorTickWidth: 1,
  58. minorTickLength: 10,
  59. minorTickPosition: 'inside',
  60. minorTickColor: '#666',
  61. tickPixelInterval: 30,
  62. tickWidth: 2,
  63. tickPosition: 'inside',
  64. tickLength: 10,
  65. tickColor: '#666',
  66. labels: {
  67. step: 2,
  68. rotation: 'auto'
  69. },
  70. title: {
  71. text: 'km/h'
  72. },
  73. plotBands: [{
  74. from: 0,
  75. to: 120,
  76. color: '#55BF3B' // green
  77. }, {
  78. from: 120,
  79. to: 160,
  80. color: '#DDDF0D' // yellow
  81. }, {
  82. from: 160,
  83. to: 200,
  84. color: '#DF5353' // red
  85. }]
  86. },
  87. series: [{
  88. name: 'Speed',
  89. data: [80],
  90. tooltip: {
  91. valueSuffix: ' km/h'
  92. }
  93. }]
  94. },
  95. // Add some life
  96. function (chart) {
  97. if (!chart.renderer.forExport) {
  98. setInterval(function () {
  99. var point = chart.series[0].points[0],
  100. newVal,
  101. inc = Math.round((Math.random() - 0.5) * 20);
  102. newVal = point.y + inc;
  103. if (newVal < 0 || newVal > 200) {
  104. newVal = point.y - inc;
  105. }
  106. point.update(newVal);
  107. }, 3000);
  108. }
  109. });
  110. });
  111. </script>
  112. </head>
  113. <body>
  114. <script src="../../js/highcharts.js"></script>
  115. <script src="../../js/highcharts-more.js"></script>
  116. <script src="../../js/modules/exporting.js"></script>
  117. <div id="container" style="min-width: 310px; max-width: 400px; height: 300px; margin: 0 auto"></div>
  118. </body>
  119. </html>