index.htm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. height: 300px;
  10. min-width: 310px;
  11. max-width: 800px;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  17. <script src="../../code/highcharts.js"></script>
  18. <div id="container"></div>
  19. <button id="large">Large</button>
  20. <button id="small">Small</button>
  21. <script type="text/javascript">
  22. var chart = Highcharts.chart('container', {
  23. chart: {
  24. type: 'column'
  25. },
  26. title: {
  27. text: 'Highcharts responsive chart'
  28. },
  29. subtitle: {
  30. text: 'Resize the frame or click buttons to change appearance'
  31. },
  32. legend: {
  33. align: 'right',
  34. verticalAlign: 'middle',
  35. layout: 'vertical'
  36. },
  37. xAxis: {
  38. categories: ['Apples', 'Oranges', 'Bananas'],
  39. labels: {
  40. x: -10
  41. }
  42. },
  43. yAxis: {
  44. allowDecimals: false,
  45. title: {
  46. text: 'Amount'
  47. }
  48. },
  49. series: [{
  50. name: 'Christmas Eve',
  51. data: [1, 4, 3]
  52. }, {
  53. name: 'Christmas Day before dinner',
  54. data: [6, 4, 2]
  55. }, {
  56. name: 'Christmas Day after dinner',
  57. data: [8, 4, 3]
  58. }],
  59. responsive: {
  60. rules: [{
  61. condition: {
  62. maxWidth: 500
  63. },
  64. chartOptions: {
  65. legend: {
  66. align: 'center',
  67. verticalAlign: 'bottom',
  68. layout: 'horizontal'
  69. },
  70. yAxis: {
  71. labels: {
  72. align: 'left',
  73. x: 0,
  74. y: -5
  75. },
  76. title: {
  77. text: null
  78. }
  79. },
  80. subtitle: {
  81. text: null
  82. },
  83. credits: {
  84. enabled: false
  85. }
  86. }
  87. }]
  88. }
  89. });
  90. $('#small').click(function () {
  91. chart.setSize(400, 300);
  92. });
  93. $('#large').click(function () {
  94. chart.setSize(600, 300);
  95. });
  96. </script>
  97. </body>
  98. </html>