15ae86d0401aa0a52ade887c9148ce7b45fcb27b.svn-base 3.3 KB

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