E-mail List Archives
Re: Pie Charts in Survey Results
From: Jared Smith
Date: May 31, 2018 4:59PM
- Next message: suman damera: "aria1.1 term role"
- Previous message: Murray Inman: "Pie Charts in Survey Results"
- Next message in Thread: None
- Previous message in Thread: Murray Inman: "Pie Charts in Survey Results"
- View all messages in this Thread
Murray Inman wrote:
> What tool do you use to make the pie charts in the Survey of Web
> Accessibility Practitioners #2 Results
> <https://webaim.org/projects/practitionersurvey2/>? I like them!
Thanks! And, hey everyone, our survey results have been published! There's
some really interesting stuff in there that you may find interesting and
I'm using the Google Charts API... with a fair amount of tweaking for
better accessibility. Their charts will create an embedded data table of
the chart data, but it's not highly accessible and is coded to be presented
only to screen reader users. For each chart, I've copied/pasted this
dynamically generated table into static HTML below each chart (thus I only
have to define the data once) and then manually added the accessibility
markup (basically just global copy/paste to add a caption and table
headers). This could probably be done dynamically instead, if desired.
There are some oddities and ARIA silliness that Google has added to the
charts themselves - which are SVG. I added scripting to hide the SVG
element with aria-hidden="true", hide the embedded table with CSS
display:none, remove the SVG's aria-label (to ensure it won't be read), and
remove the table's aria-label (which is always aria-label="A tabular
representation of the data in the chart." - SUPER informative, eh?). I then
define the entire chart element as role="img" and give it a descriptive
You can review the code of the page (with the jQuery near the bottom) to
see how this is done.
The result is that everyone gets the shiny, sexy chart and an accessible
data table. The chart is presented to screen readers as an image with a
succinct alternative text (via aria-label) with the full chart data
accessible via the data table. I'd be happy to hear feedback or
recommendations on this.
One possible limitation is that the mouse interactivity/tooltips with the
chart segments are not keyboard accessible. Because this data is already
fully accessible via the data table, and because making these keyboard
accessible would introduce numerous tab stops, repetition, and likely
confusion for screen reader users, I opted to not attempt this.