index.htm 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. min-width: 380;
  10. max-width: 600px;
  11. margin: 0 auto;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <script src="../../code/highcharts.js"></script>
  17. <script src="../../code/modules/boost.js"></script>
  18. <script src="../../code/modules/exporting.js"></script>
  19. <div id="container"></div>
  20. <script type="text/javascript">
  21. // Prepare the data
  22. var data = [],
  23. n = 1000000,
  24. i;
  25. for (i = 0; i < n; i += 1) {
  26. data.push([
  27. Math.pow(Math.random(), 2) * 100,
  28. Math.pow(Math.random(), 2) * 100
  29. ]);
  30. }
  31. if (!Highcharts.Series.prototype.renderCanvas) {
  32. throw 'Module not loaded';
  33. }
  34. console.time('scatter');
  35. Highcharts.chart('container', {
  36. chart: {
  37. zoomType: 'xy',
  38. height: '100%'
  39. },
  40. boost: {
  41. useGPUTranslations: true,
  42. usePreAllocated: true
  43. },
  44. xAxis: {
  45. min: 0,
  46. max: 100,
  47. gridLineWidth: 1
  48. },
  49. yAxis: {
  50. // Renders faster when we don't have to compute min and max
  51. min: 0,
  52. max: 100,
  53. minPadding: 0,
  54. maxPadding: 0,
  55. title: {
  56. text: null
  57. }
  58. },
  59. title: {
  60. text: 'Scatter chart with 1 million points'
  61. },
  62. legend: {
  63. enabled: false
  64. },
  65. series: [{
  66. type: 'scatter',
  67. color: 'rgba(152,0,67,0.1)',
  68. data: data,
  69. marker: {
  70. radius: 0.1
  71. },
  72. tooltip: {
  73. followPointer: false,
  74. pointFormat: '[{point.x:.1f}, {point.y:.1f}]'
  75. }
  76. }]
  77. });
  78. console.timeEnd('scatter');
  79. </script>
  80. </body>
  81. </html>