Timeline

by sectioni

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/timeline.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
    <p class="highcharts-description">
        Timeline charts are used to place events on a time axis,
        such as this example showing the major space exploration
        events from 1951 to 1975.
    </p>
</figure>

CSS

html, body {
  height: 100%;
}

#container {
  height: 100%;
}

.highcharts-strong {
    font-weight: bold;
}

.highcharts-figure, .highcharts-data-table table {
    min-width: 320px; 
    max-width: 100%;
    height: 100%;
    margin: 1em auto;
}

.highcharts-data-table table {
	font-family: Verdana, sans-serif;
	border-collapse: collapse;
	border: 1px solid #EBEBEB;
	margin: 10px auto;
	text-align: center;
	width: 100%;	
}
.highcharts-data-table caption {
    padding: 1em 0;
    font-size: 1.2em;
    color: #555;
}
.highcharts-data-table th {
	font-weight: 600;
    padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
    padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
    background: #f8f8f8;
}
.highcharts-data-table tr:hover {
    background: #f1f7ff;
}

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'timeline'
    },
  
    xAxis: {
        visible: false
    },
    yAxis: {
        visible: false
    },
    series: [{
        data: [{
            name: 'Day 1',
            label: '- Tingling in mid-left abdomen when tilting head down.',
            color: '#ff9999'
        }, {
            name: 'Day 2',
            label: '- Tingling in left side of face for 10 seconds and then lose of sensitivity for a few hours',
            color: '#ff4d4d',
        }, {
            name: 'Day 3 - Day 7',
            label: '- Tingling mostly in legs (more on the left leg) when lying down / sitting. Sometimes in the arms.<br>- Numbness and difficulty moving legs when lying down.<br><br>- Difficulty raising elbows above shoulder level for more than 2 seconds when lying down or more than 5 seconds when sitting. No problems when standing.<br><br>- One time very strong feeling of vibrations in the whole body (including face) for 10 minutes like an electric shock. hands were shaking. no pain.<br><br>- Slight weakness in the left leg.',
            color: '#ff0000',
        }]
    }]
});