CopyPastor

Detecting plagiarism made easy.

Score: 0.8167266249656677; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2020-09-17
by DevMaster

Original Post

Original - Posted on 2016-08-11
by Ramesh



            
Present in both answers; Present only in the new answer; Present only in the old answer;

There is not problem with option for x-axis.
I bet there is a problem with **dataset**.
Dataset of *x* and *y* should be specified.
Following snippet will help you.
```javascript var ctx2 = document.getElementById("myChart2"); var myChart = new Chart(ctx2, { type: "bar", data: { datasets: [ { label: "US Dates", data: [ { x: "04/01/2014", y: 175, }, { x: "10/01/2014", y: 175, }, { x: "04/01/2015", y: 178, }, { x: "10/01/2015", y: 178, }, ], backgroundColor: "rgba(255, 99, 132, 0.2)", borderColor: "rgba(255, 99, 132, 1)", borderWidth: 2, }, { label: "UK Dates", data: [ { x: "04/01/2014", y: 143, }, { x: "10/1/2014", y: 175, }, { x: "04/01/2015", y: 165, }, { x: "10/1/2015", y: 178, }, ], backgroundColor: "rgba(99, 255, 132, 0.2)", borderColor: "rgba(99, 255, 132, 1)", borderWidth: 2, }, ], }, options: { responsive: true, title: { display: true, text: "Chart.js Time Scale", }, scales: { xAxes: [ { type: "time", position: "bottom", time: { displayFormats: { day: "MM/YY" }, tooltipFormat: "DD/MM/YY", unit: "month", }, }, ], yAxes: [ { scaleLabel: { display: true, labelString: "value", }, }, ], }, }, }); ```


<!-- begin snippet: js hide: false console: false babel: false -->
<!-- language: lang-js -->
var config = { type: 'line', data: { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [{ label: "My First dataset", data: [10, 80, 56, 60, 6, 45, 15], fill: false, backgroundColor: "#eebcde ", borderColor: "#eebcde", borderCapStyle: 'butt', borderDash: [5, 5], }] }, options: { responsive: true, legend: { position: 'bottom', }, hover: { mode: 'label' }, scales: { xAxes: [{ display: true, scaleLabel: { display: true, labelString: 'Month' } }], yAxes: [{ display: true, ticks: { beginAtZero: true, steps: 10, stepValue: 5, max: 100 } }] }, title: { display: true, text: 'Chart.js Line Chart - Legend' } } };
var ctx = document.getElementById("canvas").getContext("2d"); new Chart(ctx, config);

<!-- language: lang-html -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.bundle.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <body> <canvas id="canvas"></canvas> </body>
<!-- end snippet -->


        
Present in both answers; Present only in the new answer; Present only in the old answer;