Skip to content

Instantly share code, notes, and snippets.

@zhangsida
Last active December 29, 2015 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangsida/7655933 to your computer and use it in GitHub Desktop.
Save zhangsida/7655933 to your computer and use it in GitHub Desktop.
the things to be know about this code are in the comment
<!DOCTYPE HTML>
<html>
<head>
<meta http - equiv = "Content-Type" content = "text/html; charset=utf-8" >
<title>Highstock 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('http://www.highcharts.com/samples/data/jsonp.php?filename=range.json&callback=?', function (data) {
$('#container').highcharts('StockChart', {
chart : {
type : 'arearange'
},
rangeSelector : {
selected : 2
},
title : {
text : 'Temperature variation by day'
},
tooltip : {
valueSuffix : '°C'
},
series : [{
name : 'Temperatures',
data : data
}
]
});
});
});
</script>
</head>
<body>
<script src = "../../js/highstock.js">
</script>
<script src = "../../js/highcharts-more.js">
</script>
<script src = "../../js/modules/exporting.js">
</script>
<div id = "container" style = "min-width: 400px; height: 400px; margin: 0 auto">
</div>
</body>
</html>
@zhangsida
Copy link
Author

Row 8 : $(...) is same with $(document).ready(...)
Row 9 : $.getJSON is a jQuery AJAX method with the definition:
jQuery.getJSON( url [, data ] [, success( data, textStatus, jqXHR ) ] )
Row 10: highcharts should be assigned as Function to Div-Element or his parents?
for(var i in jQuery('#container')) {
if (jQuery('#container').hasOwnProperty(i)) {
console.log(i, '' + jQuery('#container')[i]);
}
}
for(var i in jQuery('#container'))console.log(i, '' + jQuery('#container')[i]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment