Advertisement
Guest User

Untitled

a guest
Feb 5th, 2013
785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function () {
  2.    
  3.     var chart = new Highcharts.Chart({
  4.    
  5.         chart: {
  6.             renderTo: 'container',
  7.             type: 'gauge',
  8.             plotBackgroundColor: null,
  9.             plotBackgroundImage: null,
  10.             plotBorderWidth: 0,
  11.             plotShadow: false
  12.         },
  13.        
  14.         title: {
  15.             text: 'Speedometer'
  16.         },
  17.        
  18.         pane: {
  19.             startAngle: -150,
  20.             endAngle: 150,
  21.             background: [{
  22.                 backgroundColor: {
  23.                     linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
  24.                     stops: [
  25.                         [0, '#FFF'],
  26.                         [1, '#333']
  27.                     ]
  28.                 },
  29.                 borderWidth: 0,
  30.                 outerRadius: '109%'
  31.             }, {
  32.                 backgroundColor: {
  33.                     linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
  34.                     stops: [
  35.                         [0, '#333'],
  36.                         [1, '#FFF']
  37.                     ]
  38.                 },
  39.                 borderWidth: 1,
  40.                 outerRadius: '107%'
  41.             }, {
  42.                 // default background
  43.             }, {
  44.                 backgroundColor: '#DDD',
  45.                 borderWidth: 0,
  46.                 outerRadius: '105%',
  47.                 innerRadius: '103%'
  48.             }]
  49.         },
  50.            
  51.         // the value axis
  52.         yAxis: {
  53.             min: 0,
  54.             max: 200,
  55.            
  56.             minorTickInterval: 'auto',
  57.             minorTickWidth: 1,
  58.             minorTickLength: 10,
  59.             minorTickPosition: 'inside',
  60.             minorTickColor: '#666',
  61.    
  62.             tickPixelInterval: 30,
  63.             tickWidth: 2,
  64.             tickPosition: 'inside',
  65.             tickLength: 10,
  66.             tickColor: '#666',
  67.             labels: {
  68.                 step: 2,
  69.                 rotation: 'auto'
  70.             },
  71.             title: {
  72.                 text: 'km/h'
  73.             },
  74.             plotBands: [{
  75.                 from: 0,
  76.                 to: 120,
  77.                 color: '#55BF3B' // green
  78.             }, {
  79.                 from: 120,
  80.                 to: 160,
  81.                 color: '#DDDF0D' // yellow
  82.             }, {
  83.                 from: 160,
  84.                 to: 200,
  85.                 color: '#DF5353' // red
  86.             }]        
  87.         },
  88.    
  89.         series: [{
  90.             name: 'Speed',
  91.             data: [80],
  92.             tooltip: {
  93.                 valueSuffix: ' km/h'
  94.             }
  95.         }]
  96.    
  97.     },
  98.     // Add some life
  99.     function (chart) {
  100.         setInterval(function() {
  101.         $(function() {
  102.         $.get("livedata.php", function(data, textStatus) {
  103.             $.each(data, function(index, wind) {
  104.             var point = chart.series[0].points[0],
  105.             newVal = WindSpeed;
  106.             point.update(newVal);
  107.             });
  108.         });
  109.         }, "json");
  110.     }, 3000);
  111.     })
  112. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement