Created
September 21, 2018 07:17
-
-
Save JaosnHsieh/e673c857bc7f7d92a78b5fe3a4bb790f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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