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.

87 lines
2.4 KiB

8 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. ${demo.css}
  9. </style>
  10. <script type="text/javascript">
  11. $(function () {
  12. $('#container').highcharts({
  13. chart: {
  14. type: 'column'
  15. },
  16. title: {
  17. text: 'Stacked column chart'
  18. },
  19. xAxis: {
  20. categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
  21. },
  22. yAxis: {
  23. min: 0,
  24. title: {
  25. text: 'Total fruit consumption'
  26. },
  27. stackLabels: {
  28. enabled: true,
  29. style: {
  30. fontWeight: 'bold',
  31. color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
  32. }
  33. }
  34. },
  35. legend: {
  36. align: 'right',
  37. x: -30,
  38. verticalAlign: 'top',
  39. y: 25,
  40. floating: true,
  41. backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
  42. borderColor: '#CCC',
  43. borderWidth: 1,
  44. shadow: false
  45. },
  46. tooltip: {
  47. formatter: function () {
  48. return '<b>' + this.x + '</b><br/>' +
  49. this.series.name + ': ' + this.y + '<br/>' +
  50. 'Total: ' + this.point.stackTotal;
  51. }
  52. },
  53. plotOptions: {
  54. column: {
  55. stacking: 'normal',
  56. dataLabels: {
  57. enabled: true,
  58. color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
  59. style: {
  60. textShadow: '0 0 3px black'
  61. }
  62. }
  63. }
  64. },
  65. series: [{
  66. name: 'John',
  67. data: [5, 3, 4, 7, 2]
  68. }, {
  69. name: 'Jane',
  70. data: [2, 2, 3, 2, 1]
  71. }, {
  72. name: 'Joe',
  73. data: [3, 4, 4, 2, 5]
  74. }]
  75. });
  76. });
  77. </script>
  78. </head>
  79. <body>
  80. <script src="../../js/highcharts.js"></script>
  81. <script src="../../js/modules/exporting.js"></script>
  82. <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
  83. </body>
  84. </html>