市长热线演示版

index.htm 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. <script type="text/javascript">
  8. $(function () {
  9. // Give the points a 3D feel by adding a radial gradient
  10. Highcharts.getOptions().colors = $.map(Highcharts.getOptions().colors, function (color) {
  11. return {
  12. radialGradient: {
  13. cx: 0.4,
  14. cy: 0.3,
  15. r: 0.5
  16. },
  17. stops: [
  18. [0, color],
  19. [1, Highcharts.Color(color).brighten(-0.2).get('rgb')]
  20. ]
  21. };
  22. });
  23. // Set up the chart
  24. var chart = new Highcharts.Chart({
  25. chart: {
  26. renderTo: 'container',
  27. margin: 100,
  28. type: 'scatter',
  29. options3d: {
  30. enabled: true,
  31. alpha: 10,
  32. beta: 30,
  33. depth: 250,
  34. viewDistance: 5,
  35. frame: {
  36. bottom: { size: 1, color: 'rgba(0,0,0,0.02)' },
  37. back: { size: 1, color: 'rgba(0,0,0,0.04)' },
  38. side: { size: 1, color: 'rgba(0,0,0,0.06)' }
  39. }
  40. }
  41. },
  42. title: {
  43. text: 'Draggable box'
  44. },
  45. subtitle: {
  46. text: 'Click and drag the plot area to rotate in space'
  47. },
  48. plotOptions: {
  49. scatter: {
  50. width: 10,
  51. height: 10,
  52. depth: 10
  53. }
  54. },
  55. yAxis: {
  56. min: 0,
  57. max: 10,
  58. title: null
  59. },
  60. xAxis: {
  61. min: 0,
  62. max: 10,
  63. gridLineWidth: 1
  64. },
  65. zAxis: {
  66. min: 0,
  67. max: 10
  68. },
  69. legend: {
  70. enabled: false
  71. },
  72. series: [{
  73. name: 'Reading',
  74. colorByPoint: true,
  75. data: [[1,6,5],[8,7,9],[1,3,4],[4,6,8],[5,7,7],[6,9,6],[7,0,5],[2,3,3],[3,9,8],[3,6,5],[4,9,4],[2,3,3],[6,9,9],[0,7,0],[7,7,9],[7,2,9],[0,6,2],[4,6,7],[3,7,7],[0,1,7],[2,8,6],[2,3,7],[6,4,8],[3,5,9],[7,9,5],[3,1,7],[4,4,2],[3,6,2],[3,1,6],[6,8,5],[6,6,7],[4,1,1],[7,2,7],[7,7,0],[8,8,9],[9,4,1],[8,3,4],[9,8,9],[3,5,3],[0,2,4],[6,0,2],[2,1,3],[5,8,9],[2,1,1],[9,7,6],[3,0,2],[9,9,0],[3,4,8],[2,6,1],[8,9,2],[7,6,5],[6,3,1],[9,3,1],[8,9,3],[9,1,0],[3,8,7],[8,0,0],[4,9,7],[8,6,2],[4,3,0],[2,3,5],[9,1,4],[1,1,4],[6,0,2],[6,1,6],[3,8,8],[8,8,7],[5,5,0],[3,9,6],[5,4,3],[6,8,3],[0,1,5],[6,7,3],[8,3,2],[3,8,3],[2,1,6],[4,6,7],[8,9,9],[5,4,2],[6,1,3],[6,9,5],[4,8,2],[9,7,4],[5,4,2],[9,6,1],[2,7,3],[4,5,4],[6,8,1],[3,4,0],[2,2,6],[5,1,2],[9,9,7],[6,9,9],[8,4,3],[4,1,7],[6,2,5],[0,4,9],[3,5,9],[6,9,1],[1,9,2]]
  76. }]
  77. });
  78. // Add mouse events for rotation
  79. $(chart.container).bind('mousedown.hc touchstart.hc', function (e) {
  80. e = chart.pointer.normalize(e);
  81. var posX = e.pageX,
  82. posY = e.pageY,
  83. alpha = chart.options.chart.options3d.alpha,
  84. beta = chart.options.chart.options3d.beta,
  85. newAlpha,
  86. newBeta,
  87. sensitivity = 5; // lower is more sensitive
  88. $(document).bind({
  89. 'mousemove.hc touchdrag.hc': function (e) {
  90. // Run beta
  91. newBeta = beta + (posX - e.pageX) / sensitivity;
  92. newBeta = Math.min(100, Math.max(-100, newBeta));
  93. chart.options.chart.options3d.beta = newBeta;
  94. // Run alpha
  95. newAlpha = alpha + (e.pageY - posY) / sensitivity;
  96. newAlpha = Math.min(100, Math.max(-100, newAlpha));
  97. chart.options.chart.options3d.alpha = newAlpha;
  98. chart.redraw(false);
  99. },
  100. 'mouseup touchend': function () {
  101. $(document).unbind('.hc');
  102. }
  103. });
  104. });
  105. });
  106. </script>
  107. </head>
  108. <body>
  109. <script src="../../js/highcharts.js"></script>
  110. <script src="../../js/highcharts-3d.js"></script>
  111. <script src="../../js/modules/exporting.js"></script>
  112. <div id="container" style="height: 400px"></div>
  113. </body>
  114. </html>