Suzette Classification - Économie domestique

by djakacki

HTML

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

<div id="container"></div>

CSS

#container {
  min-width: 320px;
  max-width: 800px;
  margin: 0 auto;
  height: 600px;
}

JavaScript

/* eslint-disable default-case */
const classCon50 = '#4287F5',
    classConMore20 = '#95b7ed',
    classConLess20 = '#dae3f2';

Highcharts.chart('container', {
    chart: {
        type: 'networkgraph',
        marginTop: 80
    },

    title: {
        text: 'Classification - Économie domestique'
    },

    tooltip: {
        formatter: function () {
            let info = '';
            switch (this.color) {
            case classCon50:
                console.log(classCon50);
                info = 'is a <b>the center</b> of this graph';
                break;
            case classConMore20:
                console.log(classConMore20);
                info = 'has <b>more than 20</b> connections to Économie domestique';
                break;
            case classConLess20:
                console.log(classConLess20);
                info = 'has <b>fewer than 20</b> connections to Économie domestique';
                break;
            }
            return '<b>' + this.key + '</b>: ' + info;
        }
    },

    plotOptions: {
        networkgraph: {
            keys: ['from', 'to'],
            layoutAlgorithm: {
                enableSimulation: true,
                integration: 'verlet',
                linkLength: 100
            }
        }
    },

    series: [
        {
            marker: {
                radius: 13
            },
            dataLabels: {
                enabled: true,
                linkFormat: '',
                allowOverlap: true,
                style: {
                    textOutline: false
                }
            },
            data: [
                ['Économie domestique', 'Morale'],
                ['Économie domestique', 'Instruction civique'],
                ['Économie domestique', 'Civilité'],
                ['Économie domestique', 'Français'],
                ['Économie domestique', 'Composition'],
                ['Économie domestique',...