Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <script>
- window.onload = function () {
- var chart = new CanvasJS.Chart("chartContainer", {
- animationEnabled: true,
- title:{
- text: "Daily High Temperature at Different Beaches"
- },
- axisX: {
- valueFormatString: "DD MMM,YY"
- },
- axisY: {
- title: "Количество переходов(in шт.)",
- includeZero: false,
- suffix: " шт."
- },
- legend:{
- cursor: "pointer",
- fontSize: 16,
- itemclick: toggleDataSeries
- },
- toolTip:{
- shared: true
- },
- data: [{
- name: "User1",
- type: "spline",
- yValueFormatString: "#0.## шт.",
- showInLegend: true,
- dataPoints: [
- { x: new Date(2017,6,24), y: 31 },
- { x: new Date(2017,6,25), y: 31 },
- { x: new Date(2017,6,26), y: 29 },
- { x: new Date(2017,6,27), y: 29 },
- { x: new Date(2017,6,28), y: 31 },
- { x: new Date(2017,6,29), y: 30 },
- { x: new Date(2017,6,30), y: 29 }
- ]
- },
- {
- name: "User2",
- type: "spline",
- yValueFormatString: "#0.## шт.",
- showInLegend: true,
- dataPoints: [
- { x: new Date(2017,6,24), y: 20 },
- { x: new Date(2017,6,25), y: 20 },
- { x: new Date(2017,6,26), y: 25 },
- { x: new Date(2017,6,27), y: 25 },
- { x: new Date(2017,6,28), y: 25 },
- { x: new Date(2017,6,29), y: 25 },
- { x: new Date(2017,6,30), y: 25 }
- ]
- },
- {
- name: "User3",
- type: "spline",
- yValueFormatString: "#0.## шт.",
- showInLegend: true,
- dataPoints: [
- { x: new Date(2017,6,24), y: 22 },
- { x: new Date(2017,6,25), y: 19 },
- { x: new Date(2017,6,26), y: 23 },
- { x: new Date(2017,6,27), y: 24 },
- { x: new Date(2017,6,28), y: 24 },
- { x: new Date(2017,6,29), y: 23 },
- { x: new Date(2017,6,30), y: 23 }
- ]
- }]
- });
- chart.render();
- function toggleDataSeries(e){
- if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
- e.dataSeries.visible = false;
- }
- else{
- e.dataSeries.visible = true;
- }
- chart.render();
- }
- }
- </script>
- </head>
- <body>
- <div id="chartContainer" style="height: 300px; width: 100%;"></div>
- <script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement