JavaScript
var chartData = {
labels: [5,"",15],
datasets: [
{
type: 'line',
label: "",
backgroundColor: 'rgb(220, 220, 220)',
fill: false,
data: [200, 200, 200],
pointRadius: 40,
pointHoverRadius: 40,
borderWidth: 0,
border: 0,
showLine: false
}, {
type: 'line',
label: '',
backgroundColor: 'rgb(30, 159, 212)',
data: [270,210,350],
pointRadius: 40,
pointHoverRadius: 40,
borderWidth: 0,
showLine: false
}, {
type: 'line',
label: '',
backgroundColor: 'rgb(95, 200, 139)',
data: [300, 285, 470],
pointRadius: 40,
pointHoverRadius: 40,
borderWidth: 0,
showLine: false
}, {
type: 'bar',
label: 'Dataset 1',
backgroundColor: 'rgb(220, 220, 220)',
fill: false,
data: [160, 160, 160],
borderWidth: 0
}, {
type: 'bar',
label: 'Dataset 2',
backgroundColor: 'rgb(30, 159, 212)',
data: [270,210,350],
borderWidth: 0
}, {
type: 'bar',
label: 'Dataset 3',
backgroundColor: 'rgb(95, 200, 139)',
data: [300, 285, 470],
borderWidth: 0
}]
};
var ctx = document.getElementById('myChart').getContext('2d');
var myMixedChart = new Chart(ctx, {
type: 'bar',
data: chartData,
options: {
responsive: false,
scales: {
xAxes: [{
stacked: true
}],
yAxes: [{
stacked: true
}]
},
title: {
display: true,
text: 'Chart.js Combo Bar Line Chart'
},
tooltips: {
mode: 'index',
intersect: true
},
elements: {
point: {
pointStyle: 'triangle'
}
},
datasets : {
barPercentage : 0.7,
categoryPercentage : 0.8
}
}
});