billboard.js
billboard.js copied to clipboard
[Question] Bar Chart Accessibility Question
Description
์๋ ํ์ธ์. ํ ํ๋ก์ ํธ์์ ๋น๋ณด๋์ฐจํธ JS๋ฅผ ์ฌ์ฉํ๊ณ ์๋ ๊ฐ๋ฐ์์ ๋๋ค. ์ ์ฉํ ๋น๋ณด๋JS ๋๋ถ์ ์ฝ๊ณ ๊ฐํธํ๊ฒ ๊ทธ๋ํ ๊ตฌํํ ์ ์์์ต๋๋ค.
๊ทธ๋ฐ๋ฐ ํ๊ฐ์ง ๋ฌธ์ ์ ์ด ๋ฐ์ํ์ฌ ๋ฌธ์๋ฅผ ๋๋ฆฌ๊ฒ ๋์์ต๋๋ค. ์ ๊ทผ์ฑ ๊ด๋ จ ๋ฌธ์ ์ธ๋ฐ์, ์ ๊ฐ ๊ตฌํํ ์ฐจํธ๋ ๊ฐ๋ก Bar Chart์ด๋ฉฐ, 5๊ฐ์ ์นดํ ๊ณ ๋ฆฌ์ ๊ฐ๊ฐ 2๊ฐ์ ๋ฐ์ดํฐ(data1, data2)๋ก ๊ตฌ์ฑ๋์์ต๋๋ค. ๊ทธ๋ฐ๋ฐ iOS ๊ธฐ์ค VoiceOver ์ฌ์ฉ ์, ํฌ์ปค์ค์ ํ๋ฆ์ด ๋ฐ > ํด๋น ๊ฐ > ๋ฐ > ํด๋น ๊ฐ > ๋ฐ > ํด๋น ๊ฐ์ด ์๋ ๋ฐ > ๋ฐ > ๋ฐ > ๋ฐ > ๋ฐ > ๊ฐ > ๊ฐ > ๊ฐ > ๊ฐ.. ์ ํ๋ฆ์ผ๋ก ์งํ๋์ด ์ ๊ทผ์ฑ์ด ์ ๋๋ก ์ง์ผ์ง์ง ์๋ ์ํฉ์ ๋๋ค.
ํน์ ํด๋น ์ฐจํธ์ ๊ฐ ๊ตฌ์ฑ ์ด๋ฏธ์ง(๋ฐ์ดํฐ)๋ค์ ํฌ์ปค์ค ์์๋ฅผ ์ง์ ํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์๋์ง ๋ฌธ์๋๋ฆฝ๋๋ค.
๊ทธ๋ฆฌ๊ณ ์ฐจํธ์ด๋ฏธ์ง๋ฅผ ๋์ฒดํ ์ ์๋ ํ ๋ฑ์ ๋ฐ์ดํฐ๋ฅผ ์๋์ผ๋ก ๊ทธ๋ ค์ฃผ๋ ๊ธฐ๋ฅ์ด ์๋์ง๋ ๊ถ๊ธํฉ๋๋ค.
๊ฐ์ฌํฉ๋๋ค.
Hi @Awaken-Cq, you can check working example from:
- https://jsfiddle.net/netil/4na2emyq/
A18y
For a18y, you can set manually tabindex
attribute in order according how the focus will flow.
If want flow. as bar -> data label ....
order, you can do as:
onafterinit: function() {
const {bar: {bars}, text: {texts}} = this.$;
const textNodes = texts.nodes();
let seq = 0;
let idx = 1;
bars.each(function(d, i) {
this.setAttribute("tabindex", idx++);
textNodes[seq++].setAttribute("tabindex", idx++);
});
Table view
Table view plugin is already implemented(#2188), but not officially released yet.
You can use @next
tagged version for now.
$ npm install billboard.js@next
- Load necessary files
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/billboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/plugin/billboardjs-plugin-tableview.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/billboard.min.css
- Specify tableview plugin options
plugins: [
new bb.plugin.tableview({
title: "My Yearly Data List",
categoryTitle: "Year",
style: true
}),
]
I have a follow-up question to the solution above. Is there any way to trigger tooltip.show when a bar is focused?
In other words, show tooltip when focusing a bar, circle or any other point that would trigger the tooltip on mouseover.
@adamfagerstrom, checkout the example
- https://jsfiddle.net/netil/7q62o54s/
That will do the trick, thank you @netil
Will these eventListners that's being created on each node be removed with the chart.destroy()
aswell? Or do i manually need to remove them?