Line chart
author(s): Torstein Hønsi
by vasagi
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
Basic line chart showing trends in a dataset. This chart includes the
<code>series-label</code> module, which adds a label to each line for
enhanced readability.
</p>
</figure>
CSS
.highcharts-figure,
.highcharts-data-table table {
min-width: 360px;
max-width: 800px;
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%;
max-width: 500px;
}
.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": "line",
"styledMode": false,
"width": null,
"height": null,
"marginTop": 30,
"marginRight": 25,
"className": "vertical-chart line-chart points-no-fill line-chart-marker",
"zooming": {
"mouseWheel": {
"enabled": false
}
},
"style": {
"fontFamily": "Lucida Grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif",
"fontSize": "12px"
},
"events": {},
"resetZoomButton": {
"position": {
"x": 100,
"y": 10
},
"relativeTo": "chart"
}
},
"boost": {
"enable": false,
"useGPUTranslations": false
},
"exporting": {
"enabled": false,
"fallbackToExportServer": false
},
"title": {
"text": ""
},
"xAxis": {
"gridLineWidth": 0,
"gridLineDashStyle": "Solid",
"gridLineColor": "#eeeeee",
"className": "gridLineStyledMode wrapXaxisLabel",
"type": "datetime",
"crosshair": true,
"minTickInterval": 86400000,
"categories": false,
"maxCharCount": 20,
"title": {
"y": 5
},
"labels": {
"rotation": 0
},
"scrollbar": {
"liveRedraw": true,
"barBorderRadius": 6,
"height": 10,
"margin": 10
},
"events": {},
"tickInterval": 86400000
},
"yAxis": {
"title": {
"text": "Total Runtime (h)",
"y": 0
},
"gridLineDashStyle": "shortdot",
"visible": true,
"plotLines": [],
"labels": {},
"events": {}
},
"responsive": {
"rules": [
{
"condition": {},
"chartOptions": {
"chart": {
...