You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.2 KiB

9 years ago
  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. <style type="text/css">
  8. ${demo.css}
  9. </style>
  10. <script type="text/javascript">
  11. var chart;
  12. $(function () {
  13. $('#container').highcharts({
  14. chart: {
  15. zoomType: 'xy'
  16. },
  17. title: {
  18. text: 'Temperature vs Rainfall'
  19. },
  20. xAxis: [{
  21. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  22. }],
  23. yAxis: [{ // Primary yAxis
  24. labels: {
  25. format: '{value} °C',
  26. style: {
  27. color: Highcharts.getOptions().colors[1]
  28. }
  29. },
  30. title: {
  31. text: 'Temperature',
  32. style: {
  33. color: Highcharts.getOptions().colors[1]
  34. }
  35. }
  36. }, { // Secondary yAxis
  37. title: {
  38. text: 'Rainfall',
  39. style: {
  40. color: Highcharts.getOptions().colors[0]
  41. }
  42. },
  43. labels: {
  44. format: '{value} mm',
  45. style: {
  46. color: Highcharts.getOptions().colors[0]
  47. }
  48. },
  49. opposite: true
  50. }],
  51. tooltip: {
  52. shared: true
  53. },
  54. series: [{
  55. name: 'Rainfall',
  56. type: 'column',
  57. yAxis: 1,
  58. 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],
  59. tooltip: {
  60. pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f} mm</b> '
  61. }
  62. }, {
  63. name: 'Rainfall error',
  64. type: 'errorbar',
  65. yAxis: 1,
  66. 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]],
  67. tooltip: {
  68. pointFormat: '(error range: {point.low}-{point.high} mm)<br/>'
  69. }
  70. }, {
  71. name: 'Temperature',
  72. type: 'spline',
  73. 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],
  74. tooltip: {
  75. pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f}°C</b> '
  76. }
  77. }, {
  78. name: 'Temperature error',
  79. type: 'errorbar',
  80. 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]],
  81. tooltip: {
  82. pointFormat: '(error range: {point.low}-{point.high}°C)<br/>'
  83. }
  84. }]
  85. });
  86. });
  87. </script>
  88. </head>
  89. <body>
  90. <script src="../../js/highcharts.js"></script>
  91. <script src="../../js/highcharts-more.js"></script>
  92. <script src="../../js/modules/exporting.js"></script>
  93. <div id="container" style="height: 400px; margin: auto; min-width: 310px; max-width: 600px"></div>
  94. </body>
  95. </html>