Example HTML
<canvas
class="chart"
data-type="horizontalBar"
data-labels="["White", "Blue", "Black", "Red", "Green", "Colorless"]"
data-series="[13, 11, 5, 2, 2, null]"></canvas>
JavaScript
$('.chart').each(function () {
var id = $(this).attr("id"),
type = $(this).data("type"),
labels = $(this).data("labels"),
series = $(this).data("series"),
options = $(this).data("options"),
ctx = this.getContext("2d");
new Chart(ctx, {
'type': type,
'data': {
labels: labels,
datasets: [{
data: series
}]
},
options: options
});
});