Advertisement
Guest User

Untitled

a guest
Dec 1st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <script>
  5. window.onload = function () {
  6.  
  7. var chart = new CanvasJS.Chart("chartContainer", {
  8. animationEnabled: true,
  9. title:{
  10. text: "Daily High Temperature at Different Beaches"
  11. },
  12. axisX: {
  13. valueFormatString: "DD MMM,YY"
  14. },
  15. axisY: {
  16. title: "Количество переходов(in шт.)",
  17. includeZero: false,
  18. suffix: " шт."
  19. },
  20. legend:{
  21. cursor: "pointer",
  22. fontSize: 16,
  23. itemclick: toggleDataSeries
  24. },
  25. toolTip:{
  26. shared: true
  27. },
  28. data: [{
  29. name: "User1",
  30. type: "spline",
  31. yValueFormatString: "#0.## шт.",
  32. showInLegend: true,
  33. dataPoints: [
  34. { x: new Date(2017,6,24), y: 31 },
  35. { x: new Date(2017,6,25), y: 31 },
  36. { x: new Date(2017,6,26), y: 29 },
  37. { x: new Date(2017,6,27), y: 29 },
  38. { x: new Date(2017,6,28), y: 31 },
  39. { x: new Date(2017,6,29), y: 30 },
  40. { x: new Date(2017,6,30), y: 29 }
  41. ]
  42. },
  43. {
  44. name: "User2",
  45. type: "spline",
  46. yValueFormatString: "#0.## шт.",
  47. showInLegend: true,
  48. dataPoints: [
  49. { x: new Date(2017,6,24), y: 20 },
  50. { x: new Date(2017,6,25), y: 20 },
  51. { x: new Date(2017,6,26), y: 25 },
  52. { x: new Date(2017,6,27), y: 25 },
  53. { x: new Date(2017,6,28), y: 25 },
  54. { x: new Date(2017,6,29), y: 25 },
  55. { x: new Date(2017,6,30), y: 25 }
  56. ]
  57. },
  58. {
  59. name: "User3",
  60. type: "spline",
  61. yValueFormatString: "#0.## шт.",
  62. showInLegend: true,
  63. dataPoints: [
  64. { x: new Date(2017,6,24), y: 22 },
  65. { x: new Date(2017,6,25), y: 19 },
  66. { x: new Date(2017,6,26), y: 23 },
  67. { x: new Date(2017,6,27), y: 24 },
  68. { x: new Date(2017,6,28), y: 24 },
  69. { x: new Date(2017,6,29), y: 23 },
  70. { x: new Date(2017,6,30), y: 23 }
  71. ]
  72. }]
  73. });
  74. chart.render();
  75.  
  76. function toggleDataSeries(e){
  77. if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
  78. e.dataSeries.visible = false;
  79. }
  80. else{
  81. e.dataSeries.visible = true;
  82. }
  83. chart.render();
  84. }
  85.  
  86. }
  87. </script>
  88. </head>
  89. <body>
  90. <div id="chartContainer" style="height: 300px; width: 100%;"></div>
  91. <script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
  92. </body>
  93. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement