I’m trying to add a line to a bar chart using the Chartjs library for Meteor. I have the bar chart complete and I was able to add two data sets to the graph but both of them are bars. How do I make one of them be a line and one a bar?
Here’s what I have so far:
var barData = {
labels: ["Monday", "Tuesday", "Wednesday", "Thursday"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(28,132,198,0.8)",
strokeColor: "rgba(220,220,220,0.8)",
highlightFill: "rgba(28,132,198,0.3)",
highlightStroke: "rgba(220,220,220,1)",
data: [1,2,3,4]
},
{
label: "My First dataset",
fillColor: "rgba(11,52,79,0.8)",
strokeColor: "rgba(220,220,220,0.8)",
highlightFill: "rgba(11,52,79,0.3)",
highlightStroke: "rgba(220,220,220,1)",
data: [5,2,7,3]
}
]
};
var barOptions = {
scaleBeginAtZero: true,
scaleShowGridLines: true,
scaleGridLineColor: "rgba(0,0,0,.05)",
scaleGridLineWidth: 1,
barShowStroke: true,
barStrokeWidth: 2,
barValueSpacing: 5,
barDatasetSpacing: 1,
responsive: true,
}
var ctx = document.getElementById("chart").getContext("2d");
var myNewChart = new Chart(ctx).Bar(barData, barOptions);