4200c309536012f89bc9262ff743b8ba9ba8f9ae.svn-base 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. .highcharts-tooltip h3 {
  9. margin: 0.3em 0;
  10. }
  11. </style>
  12. <script type="text/javascript">
  13. $(function () {
  14. $('#container').highcharts({
  15. chart: {
  16. type: 'bubble',
  17. plotBorderWidth: 1,
  18. zoomType: 'xy'
  19. },
  20. legend: {
  21. enabled: false
  22. },
  23. title: {
  24. text: 'Sugar and fat intake per country'
  25. },
  26. subtitle: {
  27. text: 'Source: <a href="http://www.euromonitor.com/">Euromonitor</a> and <a href="https://data.oecd.org/">OECD</a>'
  28. },
  29. xAxis: {
  30. gridLineWidth: 1,
  31. title: {
  32. text: 'Daily fat intake'
  33. },
  34. labels: {
  35. format: '{value} gr'
  36. },
  37. plotLines: [{
  38. color: 'black',
  39. dashStyle: 'dot',
  40. width: 2,
  41. value: 65,
  42. label: {
  43. rotation: 0,
  44. y: 15,
  45. style: {
  46. fontStyle: 'italic'
  47. },
  48. text: 'Safe fat intake 65g/day'
  49. },
  50. zIndex: 3
  51. }]
  52. },
  53. yAxis: {
  54. startOnTick: false,
  55. endOnTick: false,
  56. title: {
  57. text: 'Daily sugar intake'
  58. },
  59. labels: {
  60. format: '{value} gr'
  61. },
  62. maxPadding: 0.2,
  63. plotLines: [{
  64. color: 'black',
  65. dashStyle: 'dot',
  66. width: 2,
  67. value: 50,
  68. label: {
  69. align: 'right',
  70. style: {
  71. fontStyle: 'italic'
  72. },
  73. text: 'Safe sugar intake 50g/day',
  74. x: -10
  75. },
  76. zIndex: 3
  77. }]
  78. },
  79. tooltip: {
  80. useHTML: true,
  81. headerFormat: '<table>',
  82. pointFormat: '<tr><th colspan="2"><h3>{point.country}</h3></th></tr>' +
  83. '<tr><th>Fat intake:</th><td>{point.x}g</td></tr>' +
  84. '<tr><th>Sugar intake:</th><td>{point.y}g</td></tr>' +
  85. '<tr><th>Obesity (adults):</th><td>{point.z}%</td></tr>',
  86. footerFormat: '</table>',
  87. followPointer: true
  88. },
  89. plotOptions: {
  90. series: {
  91. dataLabels: {
  92. enabled: true,
  93. format: '{point.name}'
  94. }
  95. }
  96. },
  97. series: [{
  98. data: [
  99. { x: 95, y: 95, z: 13.8, name: 'BE', country: 'Belgium' },
  100. { x: 86.5, y: 102.9, z: 14.7, name: 'DE', country: 'Germany' },
  101. { x: 80.8, y: 91.5, z: 15.8, name: 'FI', country: 'Finland' },
  102. { x: 80.4, y: 102.5, z: 12, name: 'NL', country: 'Netherlands' },
  103. { x: 80.3, y: 86.1, z: 11.8, name: 'SE', country: 'Sweden' },
  104. { x: 78.4, y: 70.1, z: 16.6, name: 'ES', country: 'Spain' },
  105. { x: 74.2, y: 68.5, z: 14.5, name: 'FR', country: 'France' },
  106. { x: 73.5, y: 83.1, z: 10, name: 'NO', country: 'Norway' },
  107. { x: 71, y: 93.2, z: 24.7, name: 'UK', country: 'United Kingdom' },
  108. { x: 69.2, y: 57.6, z: 10.4, name: 'IT', country: 'Italy' },
  109. { x: 68.6, y: 20, z: 16, name: 'RU', country: 'Russia' },
  110. { x: 65.5, y: 126.4, z: 35.3, name: 'US', country: 'United States' },
  111. { x: 65.4, y: 50.8, z: 28.5, name: 'HU', country: 'Hungary' },
  112. { x: 63.4, y: 51.8, z: 15.4, name: 'PT', country: 'Portugal' },
  113. { x: 64, y: 82.9, z: 31.3, name: 'NZ', country: 'New Zealand' }
  114. ]
  115. }]
  116. });
  117. });
  118. </script>
  119. </head>
  120. <body>
  121. <script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
  122. <script src="http://cdn.hcharts.cn/highcharts/highcharts-more.js"></script>
  123. <script src="http://cdn.hcharts.cn/highcharts/modules/exporting.js"></script>
  124. <div id="container" style="height: 400px; min-width: 310px; max-width: 600px; margin: 0 auto"></div>
  125. </body>
  126. </html>