index.htm 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Highcharts Example</title>
  6. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  7. <script type="text/javascript">
  8. var chart;
  9. $(function() {
  10. $('#container').highcharts({
  11. chart: {
  12. zoomType: 'xy'
  13. },
  14. title: {
  15. text: 'Temperature vs Rainfall'
  16. },
  17. xAxis: [{
  18. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  19. }],
  20. yAxis: [{ // Primary yAxis
  21. labels: {
  22. formatter: function() {
  23. return this.value + '°C';
  24. },
  25. style: {
  26. color: '#89A54E'
  27. }
  28. },
  29. title: {
  30. text: 'Temperature',
  31. style: {
  32. color: '#89A54E'
  33. }
  34. }
  35. }, { // Secondary yAxis
  36. title: {
  37. text: 'Rainfall',
  38. style: {
  39. color: '#4572A7'
  40. }
  41. },
  42. labels: {
  43. formatter: function() {
  44. return this.value + ' mm';
  45. },
  46. style: {
  47. color: '#4572A7'
  48. }
  49. },
  50. opposite: true
  51. }],
  52. tooltip: {
  53. shared: true
  54. },
  55. series: [{
  56. name: 'Rainfall',
  57. color: '#4572A7',
  58. type: 'column',
  59. yAxis: 1,
  60. 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],
  61. tooltip: {
  62. pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f} mm</b> '
  63. }
  64. }, {
  65. name: 'Rainfall error',
  66. type: 'errorbar',
  67. yAxis: 1,
  68. 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]],
  69. tooltip: {
  70. pointFormat: '(error range: {point.low}-{point.high} mm)<br/>'
  71. }
  72. }, {
  73. name: 'Temperature',
  74. color: '#89A54E',
  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. });
  90. </script>
  91. </head>
  92. <body>
  93. <script src="../../js/highcharts.js"></script>
  94. <script src="../../js/highcharts-more.js"></script>
  95. <script src="../../js/modules/exporting.js"></script>
  96. <div id="container" style="height: 400px; margin: auto; min-width: 310px; max-width: 600px"></div>
  97. </body>
  98. </html>