JavaScript Range Bar charts are very similar to Range Column Chart except that the bars are horizontally placed in order to emphasize y values on axis. They are also drawn between a range of values - Low & High. Charts are interactive, support animation, zooming, panning & exporting as image. Given example shows a JavaScript Range Bar Chart along with HTML source code that you can edit in-browser or save to run it locally.
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
exportEnabled: true,
title: {
text: "Employees Salary in a Company"
},
axisX: {
title: "Departments"
},
axisY: {
title: "Salary in USD",
interval: 10,
suffix: "k",
prefix: "$"
},
data: [{
type: "rangeBar",
showInLegend: true,
yValueFormatString: "$#0.#K",
indexLabel: "{y[#index]}",
legendText: "Department wise Min and Max Salary",
toolTipContent: "<b>{label}</b>: {y[0]} to {y[1]}",
dataPoints: [
{ x: 10, y:[80, 115], label: "Data Scientist" },
{ x: 20, y:[95, 141], label: "Product Manager" },
{ x: 30, y:[98, 115], label: "Web Developer" },
{ x: 40, y:[90, 160], label: "Software Engineer" },
{ x: 50, y:[100,152], label: "Quality Assurance" }
]
}]
});
chart.render();
}
Using indexlabel makes the chart more readable. You can also change the color of bars using color. Some other common customizations include dataPointWidth, fillOpacity etc.