I'm unable to find out the docs in version 2 of Charts.js.
Any idea how to go about adding mixed charts ? ( A line and bar graph in the same chart)
@adityaanandmc you would do the following:
var chartInstance = new Chart(ctx, {
data: {
datasets: [{
// Makes this dataset bars
type: 'bar',
data: []
}, {
// Makes this dataset a line
type: 'line'
}]
}
});
@etimberg That didn't seem to work for me!! - It didn't display the bar graph, just the line graph
This instead did work :
var chartInstance = new Chart(ctx, {
type: 'bar', // Setting this as the default
data: {
datasets: [{
// Makes this dataset bars by default
data: []
}, {
// Makes this dataset a line
type: 'line'
}]
}
});
Most helpful comment
@etimberg That didn't seem to work for me!! - It didn't display the bar graph, just the line graph
This instead did work :