Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Highcharts Example</title>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
- <script type="text/javascript">
- $(function() {
- $.getJSON("json_master_week.php", function(data) {
- console.log( "success" );
- Highcharts.setOptions({
- global: {
- useUTC: false
- }
- }); // Create a timer
- var start = + new Date();
- // Create the chart
- $('#container').highcharts('StockChart', {
- chart: {
- events: {
- load: function(chart) {
- this.setTitle(null, {
- text: 'This chart was built on '+ new Date() + ' in ' + (new Date() - start) +'ms'
- });
- }
- },
- zoomType: 'x'
- },
- rangeSelector: {
- buttons: [{
- type: 'hour',
- count: 1,
- text: '1hr'
- }, {
- type: 'hour',
- count: 3,
- text: '3hr'
- }, {
- type: 'hour',
- count: 12,
- text: '12hr'
- }, {
- type: 'day',
- count: 1,
- text: '1d'
- }, {
- type: 'day',
- count: 3,
- text: '3d'
- }, {
- type: 'day',
- count: 5,
- text: '5d'
- }, {
- type: 'day',
- count : 7,
- text: '7d'
- }],
- selected: 2
- },
- yAxis: {
- title: {
- text: 'Temperature (C)'
- }
- },
- title: {
- text: 'Master Bed Room Temps, Upwey'
- },
- subtitle: {
- text: 'Built chart at...' // dummy text to reserve space for dynamic subtitle
- },
- series: [{
- name: 'Temperature',
- data: data,
- tooltip: {
- valueDecimals: 2,
- valueSuffix: 'C'
- }
- }]
- },function(chart){
- // Last point in graph...
- showLastPointTooltip(chart);
- });
- });
- function showLastPointTooltip(objHighStockchart){
- // show tooltip for last point
- var points=[];
- if(objHighStockchart)
- {
- for(var i=0;i<objHighStockchart.series.length;i++)
- points.push(objHighStockchart.series[i].points[objHighStockchart.series[i].points.length-1]);
- objHighStockchart.tooltip.refresh(points);
- }
- }
- });
- </script>
- </head>
- <body>
- <script src="http://code.highcharts.com/stock/highstock.js"></script>
- <script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
- <div id="container" style="height: 500px; min-width: 500px"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement