Skip to content

Word Cloud MicroSim

Run the WordCloud MicroSim

We can add links from each word to the Glossary of Terms

First, we need to turn off the link decorations in the CSS:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
body {
    font-family: Arial, Helvetica, sans-serif;
}
#wordcloud {
    width: 100%;
    height: 600px;
    border: 1px solid #ddd;
}
#wordcloud a {
    text-decoration: none;
    color: inherit;
}

Next, we add a JavaScript function to convert the links into a lower-case string with dashes used to replace spaces.

1
2
3
4
5
6
7
const wordList = wordData.map(([label, weight]) => {
    return [
        label,
        weight,
        () => window.location.href = `../../glossary#${label.replace(/\s+/g, '-').toLowerCase()}`
    ];
});