Skip to content

Instantly share code, notes, and snippets.

@andregardi
Created September 28, 2018 19:54
Show Gist options
  • Save andregardi/7dbe750e15d6232791f43eb93a185c52 to your computer and use it in GitHub Desktop.
Save andregardi/7dbe750e15d6232791f43eb93a185c52 to your computer and use it in GitHub Desktop.
function renderChart(data, labels) {
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: labels,
datasets: [{
label: 'This week',
data: data,
}]
},
});
}
$("#renderBtn").click(
function () {
data = [20000, 14000, 12000, 15000, 18000, 19000, 22000];
labels = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
renderChart(data, labels);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment