index.htm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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://cdn.hcharts.cn/jquery/jquery-1.8.3.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. headerFormat: '<b>{point.x}</b><br/>',
  48. pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
  49. },
  50. plotOptions: {
  51. column: {
  52. stacking: 'normal',
  53. dataLabels: {
  54. enabled: true,
  55. color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
  56. style: {
  57. textShadow: '0 0 3px black'
  58. }
  59. }
  60. }
  61. },
  62. series: [{
  63. name: 'John',
  64. data: [5, 3, 4, 7, 2]
  65. }, {
  66. name: 'Jane',
  67. data: [2, 2, 3, 2, 1]
  68. }, {
  69. name: 'Joe',
  70. data: [3, 4, 4, 2, 5]
  71. }]
  72. });
  73. });
  74. </script>
  75. </head>
  76. <body>
  77. <script src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
  78. <script src="http://cdn.hcharts.cn/highcharts/modules/exporting.js"></script>
  79. <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
  80. </body>
  81. </html>