Graph 1
by Torstein Hønsi
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.src.js"></script>
<h1>Table and SVG Chart Depicting Screen Reader Usage</h1>
<h2>Table 1</h2>
<table border="0" cellspacing="3" cellpadding="0">
<caption>Primary desktop/laptop screen readers as reported in the <a href="http://webaim.org/projects/screenreadersurvey6/">2015 Webaim Survey</a></caption>
<tr>
<th scope="col">Screen Reader</th>
<th scope="col">Percentage of Respondents</th>
</tr>
<tr>
<td>
<a href="http://www.freedomscientific.com/Products/Blindness/JAWS">
JAWS</a></td>
<td>30.2</td>
</tr>
<tr>
<td><a href="http://www.zoomtext.com/products/zoomtext-magnifierreader/">
ZoomText</a></td>
<td>22.2</td>
</tr>
<tr>
<td><a href="http://www.gwmicro.com/window-eyes/">
Window-Eyes</a></td>
<td>20.7</td>
</tr>
<tr>
<td><a href="http://www.nvaccess.org/">
NVDA</a></td>
<td>14.6</td>
</tr>
<tr>
<td><a href="http://www.apple.com/accessibility/osx/voiceover/">
VoiceOver</a></td>
<td>7.6</td>
</tr>
<tr>
<td>
<a href="https://www.satogo.com/">
System Access To Go</a></td>
<td>1.5</td>
</tr>
<tr>
<td>
<a href="http://www.chromevox.com/">
ChromeVox</a></td>
<td>0.3</td>
</tr>
<tr>
<td><a href="http://www.disabled-world.com/assistivedevices/computer/screen-readers.php">
Other</a></td>
<td>2.9</td>
</tr>
</table>
<br>
<h2>Chart 1</h2>
<div id="container" tabindex="2"></div>
JavaScript
$(function () {
// Plugin for increasing chart accessibility
(function (H) {
H.Chart.prototype.callbacks.push(function (chart) {
var options = chart.options,
acsOptions = options.accessibility || {},
series = chart.series,
numSeries = series.length,
numXAxes = chart.xAxis.length,
numYAxes = chart.yAxis.length,
titleElement = document.createElementNS('http://www.w3.org/2000/svg', 'title'),
descElement = chart.container.getElementsByTagName('desc')[0],
textElements = chart.container.getElementsByTagName('text'),
titleId = 'highcharts-title-' + chart.index,
descId = 'highcharts-desc-' + chart.index,
chartDesc,
chartTypes = [],
i;
// Get label for axis (x or y)
function getAxisLabel(axis) {
return axis.userOptions && axis.userOptions.description || axis.axisTitle && axis.axisTitle.textStr ||
axis.options.id || axis.categories && 'categories' || 'Undeclared';
}
if (!acsOptions.enabled) {
return;
}
// Hide text elements from screen readers
for (i = 0; i < textElements.length; ++i) {
textElements[i].setAttribute('aria-hidden', 'true');
}
// Enumerate chart types
for (i = 0; i < numSeries; ++i) {
if (chartTypes.indexOf(series[i].type) < 0) {
chartTypes.push(series[i].type);
}
}
// Build chart description
chartDesc = (chartTypes.length === 1 ? chartTypes[0] + ' chart, ' : '') +
(options.title.text ? ' Title: ' + options.title.text + '.' : '') +
(options.subtitle.text ? ' ' + options.subtitle.text + '.' : '') +
...