index.htm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Highstock Example</title>
  7. <style type="text/css">
  8. </style>
  9. </head>
  10. <body>
  11. <script src="../../code/highstock.js"></script>
  12. <script src="../../code/modules/exporting.js"></script>
  13. <script src="../../code/modules/export-data.js"></script>
  14. <div id="container" style="height: 400px; min-width: 310px"></div>
  15. <script type="text/javascript">
  16. // Create the chart
  17. Highcharts.stockChart('container', {
  18. chart: {
  19. events: {
  20. load: function () {
  21. // set up the updating of the chart each second
  22. var series = this.series[0];
  23. setInterval(function () {
  24. var x = (new Date()).getTime(), // current time
  25. y = Math.round(Math.random() * 100);
  26. series.addPoint([x, y], true, true);
  27. }, 1000);
  28. }
  29. }
  30. },
  31. time: {
  32. useUTC: false
  33. },
  34. rangeSelector: {
  35. buttons: [{
  36. count: 1,
  37. type: 'minute',
  38. text: '1M'
  39. }, {
  40. count: 5,
  41. type: 'minute',
  42. text: '5M'
  43. }, {
  44. type: 'all',
  45. text: 'All'
  46. }],
  47. inputEnabled: false,
  48. selected: 0
  49. },
  50. title: {
  51. text: 'Live random data'
  52. },
  53. exporting: {
  54. enabled: false
  55. },
  56. series: [{
  57. name: 'Random data',
  58. data: (function () {
  59. // generate an array of random data
  60. var data = [],
  61. time = (new Date()).getTime(),
  62. i;
  63. for (i = -999; i <= 0; i += 1) {
  64. data.push([
  65. time + i * 1000,
  66. Math.round(Math.random() * 100)
  67. ]);
  68. }
  69. return data;
  70. }())
  71. }]
  72. });
  73. </script>
  74. </body>
  75. </html>