Highcharts Demo
author(s): Torstein Hønsi
by anikettiwari
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<div id="container"></div>
JavaScript
let data = [{
name: "Thursday",
color: "grey",
fromDate: "2019-10-10 08:00",
toDate: "2019-10-10 10:00",
},
{
name: "Thursday",
fromDate: "2019-10-10 10:00",
toDate: "2019-10-10 12:00",
color: "orange"
},
{
name: "Thursday",
fromDate: "2019-10-10 12:00",
toDate: "2019-10-10 15:00",
color: "grey"
},
{
name: "friday",
color: "grey",
fromDate: "2019-10-11 08:00",
toDate: "2019-10-11 12:00",
},
{
name: "friday",
fromDate: "2019-10-11 12:00",
toDate: "2019-10-11 15:00",
color: "orange"
}
],
newData = [];
data.forEach(point => {
newData.push({
name: point.name,
color: point.color,
low: Date.parse(point.fromDate),
high: Date.parse(point.toDate)
})
});
Highcharts.chart('container', {
chart: {
type: 'columnrange',
inverted: true
},
yAxis: {
//type: 'datetime'
},
series: [{
data: newData
}]
});