index.htm 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #container {
  9. min-width: 300px;
  10. max-width: 600px;
  11. margin: 0 auto;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <script src="../../code/highcharts.js"></script>
  17. <script src="../../code/modules/treemap.js"></script>
  18. <div id="container"></div>
  19. <script type="text/javascript">
  20. Highcharts.chart('container', {
  21. series: [{
  22. type: "treemap",
  23. layoutAlgorithm: 'stripes',
  24. alternateStartingDirection: true,
  25. levels: [{
  26. level: 1,
  27. layoutAlgorithm: 'sliceAndDice',
  28. dataLabels: {
  29. enabled: true,
  30. align: 'left',
  31. verticalAlign: 'top',
  32. style: {
  33. fontSize: '15px',
  34. fontWeight: 'bold'
  35. }
  36. }
  37. }],
  38. data: [{
  39. id: 'A',
  40. name: 'Apples',
  41. color: "#EC2500"
  42. }, {
  43. id: 'B',
  44. name: 'Bananas',
  45. color: "#ECE100"
  46. }, {
  47. id: 'O',
  48. name: 'Oranges',
  49. color: '#EC9800'
  50. }, {
  51. name: 'Anne',
  52. parent: 'A',
  53. value: 5
  54. }, {
  55. name: 'Rick',
  56. parent: 'A',
  57. value: 3
  58. }, {
  59. name: 'Peter',
  60. parent: 'A',
  61. value: 4
  62. }, {
  63. name: 'Anne',
  64. parent: 'B',
  65. value: 4
  66. }, {
  67. name: 'Rick',
  68. parent: 'B',
  69. value: 10
  70. }, {
  71. name: 'Peter',
  72. parent: 'B',
  73. value: 1
  74. }, {
  75. name: 'Anne',
  76. parent: 'O',
  77. value: 1
  78. }, {
  79. name: 'Rick',
  80. parent: 'O',
  81. value: 3
  82. }, {
  83. name: 'Peter',
  84. parent: 'O',
  85. value: 3
  86. }, {
  87. name: 'Susanne',
  88. parent: 'Kiwi',
  89. value: 2,
  90. color: '#9EDE00'
  91. }]
  92. }],
  93. title: {
  94. text: 'Fruit consumption'
  95. }
  96. });
  97. </script>
  98. </body>
  99. </html>