Highcharts Demo
by oysteinmoseng
HTML
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/sonification.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<button id="sonify">Play chart</button>
<div id="container"></div>
<p class="highcharts-description">This candlestick chart is sonified by close value</p>
</figure>
<pre style="display: none" id="csv">DateTime,Wrapped BTC (open),Wrapped BTC (high),Wrapped BTC (low),Wrapped BTC...
CSS
* {
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
sans-serif;
}
.highcharts-figure {
max-width: 700px;
margin: 0 auto;
position: relative;
}
#sonify {
position: absolute;
top: 5px;
right: 5px;
z-index: 10;
background-color: #fff;
border: 1px solid #25386f;
color: #25386f;
font-size: 0.9rem;
min-height: 30px;
font-weight: 500;
border-radius: 4px;
padding: 0.375rem 0;
width: 10rem;
margin-bottom: 0.25rem;
margin-top: 0.25rem;
text-align: center;
cursor: pointer;
}
#sonify:hover {
background-color: #25386f;
color: #fff;
}
.highcharts-description {
margin: 0.3rem 10px;
}
JavaScript
const chart = Highcharts.stockChart('container', {
chart: {
type: 'candlestick'
},
title: {
text: 'Audio Chart'
},
data: {
csv: document.getElementById('csv').innerText
},
sonification: {
duration: 4000
},
accessibility: {
landmarkVerbosity: 'one'
}
});
document.getElementById('sonify').onclick = function () {
chart.toggleSonify();
};