Dumbbell series

author(s): Rafal Sebestjanski

by Geo George

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/dumbbell.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">
        Dumbbell charts are variants of columnrange charts, where a
        low and a high value is given for each data point. The points
        are visualized as markers with a line between them, resembling
        a dumbbell.
    </p>
</figure>

CSS

.highcharts-figure,
.highcharts-data-table table {
    min-width: 310px;
    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

var data = [{
    name: 'Austria',
    low: 69,
    high: 82
}, {
    name: 'Belgium',
    low: 70,
    high: 81
}, {
    name: 'Bulgaria',
    low: 69,
    high: 75
}, {
    name: 'Croatia',
    low: 65,
    high: 78
}, {
    name: 'Cyprus',
    low: 70
}, {
    name: 'Czech Republic',
    low: 70
}, {
    name: 'Denmark',
    low: 72
}, {
    name: 'Estonia',
    low: 68
}, {
    name: 'Finland',
    low: 69
}, {
    name: 'France',
    low: 70
}, {
    name: 'Greece',
    low: 68
}, {
    name: 'Spain',
    low: 69
}, {
    name: 'Netherlands',
    low: 73
}, {
    name: 'Ireland',
    low: 70
}, {
    name: 'Lithuania',
    low: 70
}, {
    name: 'Luxembourg',
    low: 68
}, {
    name: 'Latvia',
    low: 70
}, {
    name: 'Malta',
    low: 69
}, {
    name: 'Germany',
    low: 69
}, {
    name: 'Poland',
    low: 68
}, {
    name: 'Portugal',
    low: 63
}, {
    name: 'Romania',
    low: 66
}, {
    name: 'Slovakia',
    low: 70
}, {
    name: 'Slovenia',
    low: 69
}, {
    name: 'Sweden',
    low: 73
}, {
    name: 'Hungary',
    low: 68
}, {
    name: 'Italy',
    low: 69
}, {
    name: 'UK',
    low: 71
}];
var data2 = [{
    name: 'Austria',

    high: 82
}, {
    name: 'Belgium',

    high: 81
}, {
    name: 'Bulgaria',

    high: 75
}, {
    name: 'Croatia',

    high: 78
}, {
    name: 'Cyprus',

    high: 81
}, {
    name: 'Czech Republic',

    high: 79
}, {
    name: 'Denmark',

    high: 81
}, {
    name: 'Estonia',

    high: 78
}, {
    name: 'Finland',

    high: 81
}, {
    name: 'France',

    high: 83
}, {
    name: 'Greece',

    high: 81
}, {
    name: 'Spain',

    high: 83
}, {
    name: 'Netherlands',

    high: 82
}, {
    name: 'Ireland',

    high: 82
}, {
    name: 'Lithuania',

    high: 75
}, {
    name: 'Luxembourg',

    high: 83
}, {
    name: 'Latvia',

    high: 75
}, {
    name: 'Malta',

    high: 82
}, {
    name: 'Germany',

    high: 81
}, {
    name: 'Poland',

    high: 78
}, {
    name: 'Portugal',

    high: 81
},...