index.htm 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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>Highcharts Example</title>
  7. <style type="text/css">
  8. </style>
  9. </head>
  10. <body>
  11. <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  12. <script src="../../code/highcharts.js"></script>
  13. <script src="../../code/modules/exporting.js"></script>
  14. <script src="../../code/modules/export-data.js"></script>
  15. <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
  16. <script type="text/javascript">
  17. Highcharts.chart('container', {
  18. chart: {
  19. type: 'spline',
  20. animation: Highcharts.svg, // don't animate in old IE
  21. marginRight: 10,
  22. events: {
  23. load: function () {
  24. // set up the updating of the chart each second
  25. var series = this.series[0];
  26. setInterval(function () {
  27. var x = (new Date()).getTime(), // current time
  28. y = Math.random();
  29. series.addPoint([x, y], true, true);
  30. }, 1000);
  31. }
  32. }
  33. },
  34. time: {
  35. useUTC: false
  36. },
  37. title: {
  38. text: 'Live random data'
  39. },
  40. xAxis: {
  41. type: 'datetime',
  42. tickPixelInterval: 150
  43. },
  44. yAxis: {
  45. title: {
  46. text: 'Value'
  47. },
  48. plotLines: [{
  49. value: 0,
  50. width: 1,
  51. color: '#808080'
  52. }]
  53. },
  54. tooltip: {
  55. headerFormat: '<b>{series.name}</b><br/>',
  56. pointFormat: '{point.x:%Y-%m-%d %H:%M:%S}<br/>{point.y:.2f}'
  57. },
  58. legend: {
  59. enabled: false
  60. },
  61. exporting: {
  62. enabled: false
  63. },
  64. series: [{
  65. name: 'Random data',
  66. data: (function () {
  67. // generate an array of random data
  68. var data = [],
  69. time = (new Date()).getTime(),
  70. i;
  71. for (i = -19; i <= 0; i += 1) {
  72. data.push({
  73. x: time + i * 1000,
  74. y: Math.random()
  75. });
  76. }
  77. return data;
  78. }())
  79. }]
  80. });
  81. </script>
  82. </body>
  83. </html>