Skip to content

Instantly share code, notes, and snippets.

@JaosnHsieh
Created September 21, 2018 07:17
Show Gist options
  • Save JaosnHsieh/e673c857bc7f7d92a78b5fe3a4bb790f to your computer and use it in GitHub Desktop.
Save JaosnHsieh/e673c857bc7f7d92a78b5fe3a4bb790f to your computer and use it in GitHub Desktop.
// from https://stackoverflow.com/a/28181877/6414615
html
/**
<canvas id="myChart" width="400" height="400"></canvas>
**/
javascript
/**
var ctx = document.getElementById("myChart").getContext("2d");
var data = {
labels: ["Chocolate", "Vanilla", "Strawberry"],
datasets: [{
label: "Blue",
backgroundColor: "blue",
data: [3, 7, 4]
}, {
label: "Red",
backgroundColor: "red",
data: [4, 3, 5]
}, {
label: "Green",
backgroundColor: "green",
data: [7, 2, 6]
}]
};
var myBarChart = new Chart(ctx, {
type: 'bar',
data: data,
options: {
barValueSpacing: 20,
scales: {
yAxes: [{
ticks: {
min: 0,
}
}]
}
}
});
*//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment