feat: add accessibility title and description to pie chart

* Reuse the title as the title element
* Add description to the parser and then render
This commit is contained in:
Cory Gwin
2022-02-18 02:37:43 +00:00
committed by GitHub
parent 9110bdfb5d
commit 0b815c7782
7 changed files with 84 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import pieParser from './parser/pie';
import { log } from '../../logger';
import { configureSvgSize } from '../../utils';
import * as configApi from '../../config';
import addSVGAccessibilityFields from '../../accessibility';
let conf = configApi.getConfig();
@@ -43,6 +44,7 @@ export const draw = (txt, id) => {
const diagram = select('#' + id);
configureSvgSize(diagram, height, width, conf.pie.useMaxWidth);
addSVGAccessibilityFields(parser.yy, diagram, id);
// Set viewBox
elem.setAttribute('viewBox', '0 0 ' + width + ' ' + height);