ONA COVID-19 Sentiment
author(s): Adam Nekola
by Adam Nekola
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/exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
</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;
}
JavaScript
Highcharts.chart('container', {
chart: {
type: 'packedbubble',
height: '500px'
},
title: {
text: 'Sentiment expressed in ONA Community Survey',
align: 'left',
style: {
fontFamily: 'Roboto',
fontWeight: '800'
}
},
tooltip: {
useHTML: true,
pointFormat: '<b>{point.name}:</b> {point.value}m CO<sub>2</sub>'
},
plotOptions: {
packedbubble: {
//minSize: '27%',
maxSize: '900px',
zMin: 0,
zMax: 1000,
layoutAlgorithm: {
splitSeries: false,
gravitationalConstant: 0.02
},
dataLabels: {
enabled: true,
format: '{point.name}',
style: {
color: 'black',
textOutline: 'none',
fontWeight: 'normal',
fontSize: '18px',
fontFamily: 'Roboto'
}
}
}
},
series: [{
name: 'Sentiment',
data: [{
name: "Fine",
value: 10.7,
color: '#73CE78'
},
{
name: "Lonely / Isolated",
value: 8.8,
color: '#21BACE'
},
{
name: "Concerned",
value: 30.8,
color: '#FFD170'
},
{
name: "Overwhelmed",
value: 18.6,
color: '#E58D44'
},
{
name: "Stressed",
value: 31.1,
color: '#E83933'
}]
}]
});