highcharts.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {% load staticfiles %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8" />
  6. <title> </title>
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0 , user-scalable=no" />
  8. <!-- bootstrap & fontawesome -->
  9. <script src="https://code.highcharts.com.cn/jquery/jquery-1.8.3.min.js"></script>
  10. <script src="https://code.highcharts.com.cn/highcharts/highcharts.js"></script>
  11. <!-- <script src="https://code.highcharts.com.cn/highcharts/modules/exporting.js"></script>
  12. <script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script> -->
  13. <style type="text/css">
  14. #container{
  15. width:1500px;
  16. height: 300px;;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <div class="content">
  22. <div id="container" style=""></div>
  23. </div>
  24. </body>
  25. <script>
  26. var data1 = [[1581893864000,44],[1582343928000,90],[1582523936000,3],[1583116061000,23]]
  27. var data2 = [[1581893364000,1],[1582343927000,9],[1582921936000,100],[1583111061000,200]]
  28. var chart = Highcharts.chart('container', {
  29. chart: {
  30. type: 'spline'
  31. },
  32. title: {
  33. text: '某地积雪厚度监测'
  34. },
  35. subtitle: {
  36. text: '非规律性时间内的变化'
  37. },
  38. xAxis: {
  39. type: 'datetime',
  40. // title: {
  41. // text: null
  42. // },
  43. dateTimeLabelFormats : {
  44. week : '%m/%d'
  45. },
  46. tickInterval: 7 * 24 * 3600 * 1000,
  47. },
  48. colors: ['#39F', '#000', '#036', '#000','#6CF', ],
  49. yAxis: {
  50. title: {
  51. text: '积雪 厚度 (m)'
  52. },
  53. min: 0
  54. },
  55. tooltip: {
  56. headerFormat: '<b>{series.name}</b><br>',
  57. pointFormat: '{point.x:%Y/%m/%e %H:%M:%S}值:{point.y} m'
  58. },
  59. plotOptions: {
  60. spline: {
  61. marker: {
  62. enabled: true
  63. }
  64. }
  65. },
  66. series: [{
  67. name: '冬',
  68. // Define the data points. All series have a dummy year
  69. // of 1970/71 in order to be compared on the same x axis. Note
  70. // that in JavaScript, months start at 0 for January, 1 for February etc.
  71. // data: [
  72. // [Date.UTC(19700927000000), -1],
  73. // [Date.UTC(1970, 9, 28), 0],
  74. // [Date.UTC(1975, 9, 29), 1],
  75. // ]
  76. data:data1
  77. },{
  78. name: '春',
  79. // Define the data points. All series have a dummy year
  80. // of 1970/71 in order to be compared on the same x axis. Note
  81. // that in JavaScript, months start at 0 for January, 1 for February etc.
  82. // data: [
  83. // [Date.UTC(19700927000000), -1],
  84. // [Date.UTC(1970, 9, 28), 0],
  85. // [Date.UTC(1975, 9, 29), 1],
  86. // ]
  87. data:data2
  88. }]
  89. });
  90. </script>
  91. </html>