Word cloud

author(s): Jon Arild Nygård

by oysteinmoseng

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/wordcloud.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="https://code.highcharts.com/themes/high-contrast-dark.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
</figure>

CSS

body {
    background-color: #2F2B37;
}
.highcharts-figure,
.highcharts-data-table table {
    min-width: 320px;
    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;
}

#container {
    height: 00px;
}

JavaScript

Highcharts.chart('container', {
    accessibility: {
        screenReaderSection: {
            beforeChartFormat: '<h5>{chartTitle}</h5>' +
                '<div>{chartSubtitle}</div>' +
                '<div>{chartLongdesc}</div>' +
                '<div>{viewTableButton}</div>'
        }
    },
    chart: {
    	backgroundColor: 'transparent',
        width: 640
    },
    series: [{
        type: 'wordcloud',
        data: [
        { name: 'WCAG', weight: 4 },
        { name: 'Section 508', weight: 3 },
        { name: 'ADA', weight: 2 },
        { name: 'EU WAD', weight: 3 },
        { name: 'VPAT', weight: 2 },
        { name: 'ATAG', weight: 2 },
        { name: 'Rehabilitation Act of 1973', weight: 1 },
        { name: 'CVAA', weight: 3 },
        { name: 'ACAA', weight: 3 },
        { name: 'CDPA', weight: 2 },
        { name: 'CCPA', weight: 2 },
        { name: 'UCRA', weight: 1 },
        { name: 'EAA', weight: 2 },
        { name: 'AUS DDA', weight: 1 },
        { name: 'CAN Human Rights Act', weight: 1 },
        { name: 'CAN PCFI', weight: 1 },
        { name: 'N° 2005-102 Article 47', weight: 1 },
        { name: 'N° 2016-1321 Article 106', weight: 1 },
        { name: 'GER EODP', weight: 1 },
        { name: 'IND RPD', weight: 1 },
        { name: 'IRE Disability Act', weight: 1 },
        { name: 'JIS X 8341-3', weight: 1 },
        { name: 'SWE Discrimination Act (2008:567)', weight: 1 },
        { name: 'UK Equality Act', weight: 2 },
        { name: 'Section 255', weight: 2 },
        ],
        name: 'Occurrences'
    }],
    credits: { enabled: false },
    title: {
        text: null
    }
});