index.htm 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. #container {
  9. min-width: 320px;
  10. height: 400px;
  11. margin: 0 auto;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <script src="../../code/highcharts.js"></script>
  17. <script src="../../code/modules/series-label.js"></script>
  18. <script src="../../code/modules/exporting.js"></script>
  19. <script src="../../code/modules/export-data.js"></script>
  20. <div id="container"></div>
  21. <script type="text/javascript">
  22. Highcharts.chart('container', {
  23. chart: {
  24. zoomType: 'xy'
  25. },
  26. title: {
  27. text: 'Average Monthly Weather Data for Tokyo'
  28. },
  29. subtitle: {
  30. text: 'Source: WorldClimate.com'
  31. },
  32. xAxis: [{
  33. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  34. 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  35. crosshair: true
  36. }],
  37. yAxis: [{ // Primary yAxis
  38. labels: {
  39. format: '{value}°C',
  40. style: {
  41. color: Highcharts.getOptions().colors[2]
  42. }
  43. },
  44. title: {
  45. text: 'Temperature',
  46. style: {
  47. color: Highcharts.getOptions().colors[2]
  48. }
  49. },
  50. opposite: true
  51. }, { // Secondary yAxis
  52. gridLineWidth: 0,
  53. title: {
  54. text: 'Rainfall',
  55. style: {
  56. color: Highcharts.getOptions().colors[0]
  57. }
  58. },
  59. labels: {
  60. format: '{value} mm',
  61. style: {
  62. color: Highcharts.getOptions().colors[0]
  63. }
  64. }
  65. }, { // Tertiary yAxis
  66. gridLineWidth: 0,
  67. title: {
  68. text: 'Sea-Level Pressure',
  69. style: {
  70. color: Highcharts.getOptions().colors[1]
  71. }
  72. },
  73. labels: {
  74. format: '{value} mb',
  75. style: {
  76. color: Highcharts.getOptions().colors[1]
  77. }
  78. },
  79. opposite: true
  80. }],
  81. tooltip: {
  82. shared: true
  83. },
  84. legend: {
  85. layout: 'vertical',
  86. align: 'left',
  87. x: 80,
  88. verticalAlign: 'top',
  89. y: 55,
  90. floating: true,
  91. backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || 'rgba(255,255,255,0.25)'
  92. },
  93. series: [{
  94. name: 'Rainfall',
  95. type: 'column',
  96. yAxis: 1,
  97. data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
  98. tooltip: {
  99. valueSuffix: ' mm'
  100. }
  101. }, {
  102. name: 'Sea-Level Pressure',
  103. type: 'spline',
  104. yAxis: 2,
  105. data: [1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7],
  106. marker: {
  107. enabled: false
  108. },
  109. dashStyle: 'shortdot',
  110. tooltip: {
  111. valueSuffix: ' mb'
  112. }
  113. }, {
  114. name: 'Temperature',
  115. type: 'spline',
  116. data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
  117. tooltip: {
  118. valueSuffix: ' °C'
  119. }
  120. }]
  121. });
  122. </script>
  123. </body>
  124. </html>