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.

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