1
0

test6.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
  7. <script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js'></script>
  8. <script src='https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.js'></script>
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-zoom/0.3.0/Chart.Zoom.min.js"></script>
  10. </head>
  11. <body>
  12. <div id="div_linechart">
  13. <button id="reset_zoom" style="float:right;color:black;">Reset</button>
  14. <canvas id="linechart"></canvas>
  15. </div>
  16. </body>
  17. <script>
  18. var ctx = document.getElementById("linechart").getContext("2d");
  19. window.myChart = new Chart(ctx, {
  20. type: 'line',
  21. data: window.chartdata,
  22. options: {
  23. responsive: true,
  24. animation: false,
  25. tooltips: {
  26. mode: 'nearest', //'label'
  27. intersect: false,
  28. position: 'nearest',
  29. },
  30. legend: {
  31. display: false,
  32. labels: {
  33. fontColor: "#FFFFFF",
  34. fontSize: 12
  35. }
  36. },
  37. hover: {
  38. mode: 'x'
  39. },
  40. scales: {
  41. xAxes: [{
  42. ticks: {
  43. fontColor: "#FFFFFF",
  44. fontSize: 12
  45. },
  46. display: true,
  47. type: 'time',
  48. time: {
  49. tooltipFormat:'ddd MMM DD YYYY hh A',
  50. },
  51. gridLines: {
  52. color: "#595959",
  53. }
  54. }],
  55. yAxes: [{
  56. ticks: {
  57. fontColor: "#FFFFFF",
  58. fontSize: 14
  59. },
  60. gridLines: {
  61. color: "#999999",
  62. }
  63. }],
  64. },
  65. pan: {
  66. enabled: true,
  67. mode: 'x',
  68. },
  69. zoom: {
  70. enabled: true,
  71. mode: 'x',
  72. }
  73. }
  74. });
  75. </script>
  76. </html>