Created
March 28, 2017 14:56
-
-
Save Manoj-nathwani/13bb80bded9031ff423dc2fb564779bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.bundle.js"></script> | |
<div class="panel panel-default"> | |
<div class="panel-heading">Price Changes</div> | |
<div class="panel-body"> | |
<canvas id="myChart"></canvas> | |
</div> | |
</div> | |
<script> | |
var ctx = document.getElementById("myChart"); | |
var data = { | |
labels: ["January", "February", "March", "April", "May", "June", "July"], | |
datasets: [ | |
{ | |
label: "Competitor 1", | |
fill: false, | |
lineTension: 0.1, | |
backgroundColor: "rgba(75,192,192,0.4)", | |
borderColor: "rgba(75,192,192,1)", | |
borderCapStyle: 'butt', | |
borderDash: [], | |
borderDashOffset: 0.0, | |
borderJoinStyle: 'miter', | |
pointBorderColor: "rgba(75,192,192,1)", | |
pointBackgroundColor: "#fff", | |
pointBorderWidth: 1, | |
pointHoverRadius: 5, | |
pointHoverBackgroundColor: "rgba(75,192,192,1)", | |
pointHoverBorderColor: "rgba(220,220,220,1)", | |
pointHoverBorderWidth: 2, | |
pointRadius: 1, | |
pointHitRadius: 10, | |
data: [65, 59, 80, 81, 56, 55, 40], | |
spanGaps: false, | |
}, | |
{ | |
label: "Competitor 2", | |
fill: false, | |
lineTension: 0.1, | |
backgroundColor: "rgba(75,192,192,0.4)", | |
borderColor: "rgba(75,192,192,1)", | |
borderCapStyle: 'butt', | |
borderDash: [], | |
borderDashOffset: 0.0, | |
borderJoinStyle: 'miter', | |
pointBorderColor: "rgba(75,192,192,1)", | |
pointBackgroundColor: "#fff", | |
pointBorderWidth: 1, | |
pointHoverRadius: 5, | |
pointHoverBackgroundColor: "rgba(75,192,192,1)", | |
pointHoverBorderColor: "rgba(220,220,220,1)", | |
pointHoverBorderWidth: 2, | |
pointRadius: 1, | |
pointHitRadius: 10, | |
data: [165, 39, 10, 61, 46, 95, 90], | |
spanGaps: false, | |
} | |
] | |
}; | |
var myLineChart = new Chart(ctx, { | |
type: 'line', | |
data: data, | |
options: { | |
animation: false, | |
scales: { | |
yAxes: [{ | |
ticks: { | |
beginAtZero: true, | |
callback: function(value, index, values) {return '£' + value;} | |
} | |
}] | |
} | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment