Dependency wheel

author(s): Torstein Hønsi

by Jens Kühn

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/sankey.js"></script>
<script src="https://code.highcharts.com/modules/dependency-wheel.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">
        Chart showing a dependency wheel, where each point consists of multiple
        weighted links to other points. This chart type is often used to
        visualize data flow, and can be a striking way to illustrate
        relationships in data.
    </p>
</figure>

CSS

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

#container {
    height: 500px;
}

.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;
}

#csv {
    display: none;
}

JavaScript

Highcharts.chart('container', {

    title: {
        text: 'Highcharts Dependency Wheel'
    },

    accessibility: {
        point: {
            valueDescriptionFormat: '{index}. From {point.from} to {point.to}: {point.weight}.'
        }
    },

    series: [{
        keys: ['from', 'to', 'weight'],
        data: [
            ['Kinder Schokolade', 'Milchschnitte', 5],
            ['Kinder Schokolade', 'Kinder Überraschung', 1],
            ['Kinder Schokolade', 'Kinder Pinguin', 1],
            ['Milchschnitte', 'Kinder Schokolade', 1],
            ['Milchschnitte', 'Kinder Überraschung', 5],
            ['Milchschnitte', 'Kinder Pinguin', 1],
            ['Kinder Überraschung', 'Kinder Schokolade', 1],
            ['Kinder Überraschung', 'Milchschnitte', 1],
            ['Kinder Überraschung', 'Kinder Pinguin', 5],
            ['Kinder Pinguin', 'Kinder Schokolade', 1],
            ['Kinder Pinguin', 'Milchschnitte', 1],
            ['Kinder Pinguin', 'Kinder Überraschung', 1]
        ],
        type: 'dependencywheel',
        name: 'Dependency wheel series',
        dataLabels: {
            color: '#333',
            textPath: {
                enabled: true,
                attributes: {
                    dy: 5
                }
            },
            distance: 10
        },
        size: '95%'
    }]

});