index.htm 2.6 KB

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