JSFiddle - React, Tailwind, and code Playground
by core972
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/xrange.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container"></div>
CSS
@import 'https://code.highcharts.com/css/highcharts.css';
#container {
min-width: 300px;
max-width: 800px;
height: 300px;
margin: 1em auto;
}
.highcharts-xrange-series .highcharts-point {
stroke-width: 1px;
stroke: gray;
}
.highcharts-partfill-overlay {
fill: #010101;
fill-opacity: 0.3;
}
.highcharts-data-label text {
fill: white;
text-shadow: 1px 1px black, -1px 1px black, -1px -1px black, 1px -1px black;
}
JavaScript
let months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
Highcharts.chart('container', {
chart: {
type: 'xrange',
styledMode: true
},
title: {
text: 'Highcharts X-range'
},
xAxis: {
type: 'datetime'
},
tooltip:{
formatter:function(){
console.log(this);
return false;
}
},
yAxis: {
title: {
text: ''
},
categories: ['Proto', 'Dev', 'Test'],
reversed: true
},
series: [{
name: 'Project:',
pointWidth: 20,
data: [{
x: Date.UTC(2014, 0, 1),
x2: Date.UTC(2014, 5, 2),
y: 0,
partialFill: 0.25
}, {
x: Date.UTC(2014, 2, 1),
x2: Date.UTC(2014, 3, 19),
y: 1
}, {
x: Date.UTC(2014, 11, 1),
x2: Date.UTC(2014, 11, 23),
y: 2
}],
dataLabels: {
enabled: true
}
}]
});