Bar chart with multiple series
author(s):
Øystein Moseng
by oysteinmoseng
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.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>
<script src="https://code.highcharts.com/themes/high-contrast-light.js"></script>
<h1>Column chart with data labels</h1>
<h2>Chart</h2>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
Vertical column chart with data labels.
</p>
</figure>
<h2>CSV data</h2>
<p>
Source: <a href="https://data.world/newns92/abbott-world-marathon-majors-winners">data.world</a>.
</p>
<pre id="csv"></pre>
CSS
body {
font-family: Verdana, sans-serif;
padding-left: 10px;
}
h2 {
font-size: 1.3rem;
margin-left: 10px;
margin-bottom: 0;
margin-top: 1.5rem;
}
p {
margin-left: 1rem;
}
pre {
margin-left: 1rem;
border: 1px solid #cde;
max-width: 600px;
padding: 10px;
background-color: #f9f9f9;
border-radius: 10px;
}
#container {
height: 400px;
}
.highcharts-figure, .highcharts-data-table table {
min-width: 320px;
max-width: 600px;
margin: 1em;
}
.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;
}
input[type="number"] {
min-width: 50px;
}
JavaScript
// Configure the visualization
var chart = Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: ''
},
subtitle: {
text: 'Source: <a href="https://data.world/newns92/abbott-world-marathon-majors-winners">data.world</a>'
},
tooltip: {
backgroundColor: 'rgba(255, 255, 255, 0.9)',
stickOnContact: true
},
yAxis: {
title: {
text: ''
}
},
data: {
csv: document.getElementById('csv').innerHTML
}
});