index.htm 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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, #sliders {
  9. min-width: 310px;
  10. max-width: 800px;
  11. margin: 0 auto;
  12. }
  13. #container {
  14. height: 400px;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
  20. <script src="../../code/highcharts.js"></script>
  21. <script src="../../code/highcharts-3d.js"></script>
  22. <script src="../../code/modules/exporting.js"></script>
  23. <script src="../../code/modules/export-data.js"></script>
  24. <div id="container"></div>
  25. <div id="sliders">
  26. <table>
  27. <tr>
  28. <td>Alpha Angle</td>
  29. <td><input id="alpha" type="range" min="0" max="45" value="15"/> <span id="alpha-value" class="value"></span></td>
  30. </tr>
  31. <tr>
  32. <td>Beta Angle</td>
  33. <td><input id="beta" type="range" min="-45" max="45" value="15"/> <span id="beta-value" class="value"></span></td>
  34. </tr>
  35. <tr>
  36. <td>Depth</td>
  37. <td><input id="depth" type="range" min="20" max="100" value="50"/> <span id="depth-value" class="value"></span></td>
  38. </tr>
  39. </table>
  40. </div>
  41. <script type="text/javascript">
  42. // Set up the chart
  43. var chart = new Highcharts.Chart({
  44. chart: {
  45. renderTo: 'container',
  46. type: 'column',
  47. options3d: {
  48. enabled: true,
  49. alpha: 15,
  50. beta: 15,
  51. depth: 50,
  52. viewDistance: 25
  53. }
  54. },
  55. title: {
  56. text: 'Chart rotation demo'
  57. },
  58. subtitle: {
  59. text: 'Test options by dragging the sliders below'
  60. },
  61. plotOptions: {
  62. column: {
  63. depth: 25
  64. }
  65. },
  66. series: [{
  67. data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
  68. }]
  69. });
  70. function showValues() {
  71. $('#alpha-value').html(chart.options.chart.options3d.alpha);
  72. $('#beta-value').html(chart.options.chart.options3d.beta);
  73. $('#depth-value').html(chart.options.chart.options3d.depth);
  74. }
  75. // Activate the sliders
  76. $('#sliders input').on('input change', function () {
  77. chart.options.chart.options3d[this.id] = parseFloat(this.value);
  78. showValues();
  79. chart.redraw(false);
  80. });
  81. showValues();
  82. </script>
  83. </body>
  84. </html>