2
0

index.htm 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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>Highstock Example</title>
  7. <style type="text/css">
  8. #container {
  9. min-width: 310px;
  10. max-width: 800px;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <script src="../../code/highstock.js"></script>
  16. <script src="../../code/modules/data.js"></script>
  17. <div id="container"></div>
  18. <button id="large">Large</button>
  19. <button id="small">Small</button>
  20. <button id="auto">Auto</button>
  21. <script type="text/javascript">
  22. Highcharts.getJSON('https://www.highcharts.com/samples/data/aapl-c.json', function (data) {
  23. // Create the chart
  24. var chart = Highcharts.stockChart('container', {
  25. chart: {
  26. height: 400
  27. },
  28. title: {
  29. text: 'Highstock Responsive Chart'
  30. },
  31. subtitle: {
  32. text: 'Click small/large buttons or change window size to test responsiveness'
  33. },
  34. rangeSelector: {
  35. selected: 1
  36. },
  37. series: [{
  38. name: 'AAPL Stock Price',
  39. data: data,
  40. type: 'area',
  41. threshold: null,
  42. tooltip: {
  43. valueDecimals: 2
  44. }
  45. }],
  46. responsive: {
  47. rules: [{
  48. condition: {
  49. maxWidth: 500
  50. },
  51. chartOptions: {
  52. chart: {
  53. height: 300
  54. },
  55. subtitle: {
  56. text: null
  57. },
  58. navigator: {
  59. enabled: false
  60. }
  61. }
  62. }]
  63. }
  64. });
  65. $('#small').click(function () {
  66. chart.setSize(400);
  67. });
  68. $('#large').click(function () {
  69. chart.setSize(800);
  70. });
  71. $('#auto').click(function () {
  72. chart.setSize(null);
  73. });
  74. });
  75. </script>
  76. </body>
  77. </html>