index.htm 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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="../../code/highcharts.js"></script>
  12. <script src="../../code/highcharts-more.js"></script>
  13. <script src="../../code/modules/exporting.js"></script>
  14. <div id="container" style="height: 400px; margin: auto; min-width: 310px; max-width: 600px"></div>
  15. <script type="text/javascript">
  16. Highcharts.chart('container', {
  17. chart: {
  18. zoomType: 'xy'
  19. },
  20. title: {
  21. text: 'Temperature vs Rainfall'
  22. },
  23. xAxis: [{
  24. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  25. }],
  26. yAxis: [{ // Primary yAxis
  27. labels: {
  28. format: '{value} °C',
  29. style: {
  30. color: Highcharts.getOptions().colors[1]
  31. }
  32. },
  33. title: {
  34. text: 'Temperature',
  35. style: {
  36. color: Highcharts.getOptions().colors[1]
  37. }
  38. }
  39. }, { // Secondary yAxis
  40. title: {
  41. text: 'Rainfall',
  42. style: {
  43. color: Highcharts.getOptions().colors[0]
  44. }
  45. },
  46. labels: {
  47. format: '{value} mm',
  48. style: {
  49. color: Highcharts.getOptions().colors[0]
  50. }
  51. },
  52. opposite: true
  53. }],
  54. tooltip: {
  55. shared: true
  56. },
  57. series: [{
  58. name: 'Rainfall',
  59. type: 'column',
  60. yAxis: 1,
  61. 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],
  62. tooltip: {
  63. pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f} mm</b> '
  64. }
  65. }, {
  66. name: 'Rainfall error',
  67. type: 'errorbar',
  68. yAxis: 1,
  69. data: [[48, 51], [68, 73], [92, 110], [128, 136], [140, 150], [171, 179], [135, 143], [142, 149], [204, 220], [189, 199], [95, 110], [52, 56]],
  70. tooltip: {
  71. pointFormat: '(error range: {point.low}-{point.high} mm)<br/>'
  72. }
  73. }, {
  74. name: 'Temperature',
  75. type: 'spline',
  76. 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],
  77. tooltip: {
  78. pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f}°C</b> '
  79. }
  80. }, {
  81. name: 'Temperature error',
  82. type: 'errorbar',
  83. data: [[6, 8], [5.9, 7.6], [9.4, 10.4], [14.1, 15.9], [18.0, 20.1], [21.0, 24.0], [23.2, 25.3], [26.1, 27.8], [23.2, 23.9], [18.0, 21.1], [12.9, 14.0], [7.6, 10.0]],
  84. tooltip: {
  85. pointFormat: '(error range: {point.low}-{point.high}°C)<br/>'
  86. }
  87. }]
  88. });
  89. </script>
  90. </body>
  91. </html>