X Range example1

by amrutaJgtp

HTML

<script src="https://code.highcharts.com/js/highcharts.js"></script>
<script src="https://code.highcharts.com/js/modules/xrange.js"></script>
<script src="https://code.highcharts.com/js/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: black;
	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

Highcharts.chart('container', {
    chart: {
        type: 'xrange'
    },
    title: {
        text: 'IT Architecture Roadmap'
    },
    xAxis: {
        type: 'datetime',
        opposite:true
    },
    yAxis: {
        title: {
            text: ''
        },
        categories: ['User Interface(UI)', 'API', 'Storage', 'Other Service Integrations'],
        reversed: true
    },
    series: [{
        name: 'Project 1',
        pointWidth: 20,
        data: [{
            x: Date.UTC(2014, 10, 21),
            x2: Date.UTC(2014, 11, 2),
            y: 0,
            name:"Conduct interviews"
        }, {
            x: Date.UTC(2014, 11, 2),
            x2: Date.UTC(2014, 11, 5),
            y: 1
        }, {
            x: Date.UTC(2014, 11, 8),
            x2: Date.UTC(2014, 11, 9),
            y: 2
        }, {
            x: Date.UTC(2014, 11, 9),
            x2: Date.UTC(2014, 11, 19),
            y: 1
        }, {
            x: Date.UTC(2014, 11, 10),
            x2: Date.UTC(2014, 11, 23),
            y: 2
        },  {
            x: Date.UTC(2014, 10, 18),
            x2: Date.UTC(2014, 11, 11),
            y: 3
        }],
        dataLabels: {
            enabled: true,
            format: '{point.name}',
        }
    }]

});