Advertisement
Guest User

Untitled

a guest
Jul 18th, 2013
1,076
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.79 KB | None | 0 0
  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.  
  10.     $.getJSON("json_master_week.php", function(data) {
  11.         console.log( "success" );
  12.         Highcharts.setOptions({
  13.                     global: {
  14.                         useUTC: false
  15.                     }
  16.             }); // Create a timer
  17.         var start = + new Date();
  18.  
  19.         // Create the chart
  20.         $('#container').highcharts('StockChart', {
  21.            
  22.             chart: {
  23.                 events: {
  24.                     load: function(chart) {
  25.                         this.setTitle(null, {
  26.                             text: 'This chart was built on '+ new Date() + ' in ' + (new Date() - start) +'ms'
  27.                         });
  28.                        
  29.  
  30.                     }
  31.                 },
  32.                 zoomType: 'x'
  33.             },
  34.  
  35.             rangeSelector: {
  36.                 buttons: [{
  37.                     type: 'hour',
  38.                     count: 1,
  39.                     text: '1hr'
  40.                 }, {
  41.                     type: 'hour',
  42.                     count: 3,
  43.                     text: '3hr'
  44.                 }, {
  45.                     type: 'hour',
  46.                     count: 12,
  47.                     text: '12hr'
  48.                 }, {
  49.                     type: 'day',
  50.                     count: 1,
  51.                     text: '1d'
  52.                 }, {
  53.                     type: 'day',
  54.                     count: 3,
  55.                     text: '3d'
  56.                 }, {
  57.                     type: 'day',
  58.                     count: 5,
  59.                     text: '5d'
  60.                 }, {
  61.                     type: 'day',
  62.                     count : 7,
  63.                     text: '7d'
  64.                 }],
  65.                 selected: 2
  66.             },
  67.  
  68.             yAxis: {
  69.                 title: {
  70.                     text: 'Temperature (C)'
  71.                 }
  72.             },
  73.  
  74.             title: {
  75.                 text: 'Master Bed Room Temps, Upwey'
  76.             },
  77.  
  78.             subtitle: {
  79.                 text: 'Built chart at...' // dummy text to reserve space for dynamic subtitle
  80.             },
  81.  
  82.             series: [{
  83.                 name: 'Temperature',
  84.                 data: data,
  85.                 tooltip: {
  86.                     valueDecimals: 2,
  87.                     valueSuffix: 'C'
  88.                 }
  89.             }]
  90.  
  91.         },function(chart){
  92.             // Last point in graph...
  93.  
  94.                 showLastPointTooltip(chart);
  95.  
  96.  
  97.  
  98.         });        
  99.     });
  100.    
  101. function showLastPointTooltip(objHighStockchart){
  102.     // show tooltip for last point  
  103.     var points=[];
  104.     if(objHighStockchart)
  105.     {
  106.         for(var i=0;i<objHighStockchart.series.length;i++)
  107.  
  108.                 points.push(objHighStockchart.series[i].points[objHighStockchart.series[i].points.length-1]);
  109.        
  110.    
  111.             objHighStockchart.tooltip.refresh(points);
  112.        
  113.        
  114.     }
  115. }
  116. });
  117. </script>
  118.     </head>
  119.     <body>
  120.  
  121.  
  122. <script src="http://code.highcharts.com/stock/highstock.js"></script>
  123. <script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
  124.  
  125. <div id="container" style="height: 500px; min-width: 500px"></div>
  126.  
  127.     </body>
  128. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement