index.htm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. </style>
  9. </head>
  10. <body>
  11. <script src="../../code/highcharts.js"></script>
  12. <script src="../../code/modules/exporting.js"></script>
  13. <script src="../../code/modules/export-data.js"></script>
  14. <div id="container" style="min-width: 310px; height: 400px; max-width: 700px; margin: 0 auto"></div>
  15. <script type="text/javascript">
  16. Highcharts.chart('container', {
  17. chart: {
  18. type: 'scatter',
  19. margin: [70, 50, 60, 80],
  20. events: {
  21. click: function (e) {
  22. // find the clicked values and the series
  23. var x = Math.round(e.xAxis[0].value),
  24. y = Math.round(e.yAxis[0].value),
  25. series = this.series[0];
  26. // Add it
  27. series.addPoint([x, y]);
  28. }
  29. }
  30. },
  31. title: {
  32. text: 'User supplied data'
  33. },
  34. subtitle: {
  35. text: 'Click the plot area to add a point. Click a point to remove it.'
  36. },
  37. xAxis: {
  38. gridLineWidth: 1,
  39. minPadding: 0.2,
  40. maxPadding: 0.2,
  41. maxZoom: 60
  42. },
  43. yAxis: {
  44. title: {
  45. text: 'Value'
  46. },
  47. minPadding: 0.2,
  48. maxPadding: 0.2,
  49. maxZoom: 60,
  50. plotLines: [{
  51. value: 0,
  52. width: 1,
  53. color: '#808080'
  54. }]
  55. },
  56. legend: {
  57. enabled: false
  58. },
  59. exporting: {
  60. enabled: false
  61. },
  62. plotOptions: {
  63. series: {
  64. lineWidth: 1,
  65. point: {
  66. events: {
  67. 'click': function () {
  68. if (this.series.data.length > 1) {
  69. this.remove();
  70. }
  71. }
  72. }
  73. }
  74. }
  75. },
  76. series: [{
  77. data: [[20, 20], [80, 80]]
  78. }]
  79. });
  80. </script>
  81. </body>
  82. </html>