index.htm 3.9 KB

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