Open Source Chart Library Selection
Chart Library Research Outcomes
The recommended path forward is as follows:
- Use the well-established open source D3 data-driven SVG visualization library as the starting point of the work.
- Create appropriate Infusion-based components for the chart types we wish to implement, along with appropriate helper functions for working with D3 under Infusion's paradigm.
- Move forward with the building of the demonstration example (pie chart authoring) with this approach.
The rationale for this is:
- While it had been hoped that a higher-level charting library might be found to abstract away some of the complexity of drawing and working with HTML charts, feelings after initial exploration and research are follows:
- D3's own paradigms for managing data and visualizations are not that difficult to work with, once some initial leaps of understanding are made
- Higher-level frameworks, whether based on D3 or not, mostly present canned charts, and much of what we want to achieve (sonification integration and maximum accessibility) would require working at a lower level or writing our own extensions anyway
- The overall complexity of integration with Infusion will be reduced by incorporating a single lower level framework
- While the immediate issue at hand is the creation of charts, longer-term the problem domain seems to be that of building maximally accessible web visualizations. The sooner we increase our understanding of this problem domain and begin building these features into Infusion, the better (while, obviously, also solving the issue at hand)
Some comments on this approach in light of the criteria below:
- License: fully open license, non-contagious:Â https://github.com/mbostock/d3/blob/master/LICENSE
- Support and community: mature, well-established community; many people currently working with D3, including building their own libraries atop it
- Documentation:Â extensive documentation and examples available both on D3 wiki itself (https://github.com/mbostock/d3/wiki) and on wider web.
- Accessibility:Â sufficiently flexible to allow us to build maximum accessibility for SVG-based charts into our components
- Technical criteria:
- SVG vs. Canvas:
- On the whole, SVG seems to be favourable for building accessible infographics, especially for our major criteria of keyboard-only access to individual elements
- tabindex and focusable for elements is officially supported in the SVG spec, works well in Chrome and Safari, and is the subject of an outstanding Firefox bug we have inquired into
- On the whole, SVG seems to be favourable for building accessible infographics, especially for our major criteria of keyboard-only access to individual elements
- Tests: extensive test suite:Â https://github.com/mbostock/d3/tree/master/test
- Build scripts:https://github.com/mbostock/d3/tree/master/src - aspects could be isolated if desired
- Size: 55k minified & gzipped
- Browser support: dependent on browser's support for SVG:Â http://caniuse.com/#feat=svg
- Hooks into chart behaviour: D3 itself does not have built-in charts, but provides extensive helper functionality and data binding for easing the building of custom chartsÂ
- http://bl.ocks.org/waharnum/e9e8d710bcc55304a380Â / http://bl.ocks.org/waharnum/raw/e9e8d710bcc55304a380/- a somewhat crude example
- Extensibility of charts: see above comment
- Performance:Â largely dependent on browser's SVG performance; Â conventional wisdom seems to be SVG performance degrades relative to Canvas above 10,000 nodes, but we don't expect to be dealing with anywhere near that many for the authoring tool
- SVG vs. Canvas:
Criteria
- License
- Open
- Non-contagious
- Support and community
- How reactive / active?
- Forums, places to ask questions
- Active development
- How many people actually work on core?
- Documentation
- Quality
- Accessible criteria
- Alternate representations
- Navigating aspects of chart with keyboard only
- Screen reader behaviour
- Technical criteria
- Configurability & flexibility
- Separation of concerns
- chart data is JSONÂ
- chart configuration and behaviour are JS
- chart appearance is CSS)
- Separation of concerns
- SVG vs. Canvas
- Tests! Do they have them?
- Build scripts - can we isolate aspects of the library?
- Size of libraryÂ
- Supported browsers
- Should there be a difference in browser targets between authoring vs embedding?
- Hooks into chart behaviour?
- Extensibility of charts - can we easily derive new types of charts with different behaviour?
- Performance
- Configurability & flexibility
Specific Features We'd Like to Support for Round One (pie chart) - spike explorations
- Via designs at https://www.dropbox.com/s/j8s86ix9wgxrsqt/CA%20Tool%20%5BVersion%205%5D.pdf?dl=0
- Dynamically update chart based on data entry in other areas
- Textures / high contrast
- Highlight slices & other interactive behaviours with aspects of chart
- Including keyboard access to aspects of chart
- Add legends
- Expose user options (turn off animations, etc)
- High configurability of chart behaviour and appearance
- Separation between slices
- Isolation of slices
- Placement of labels, size of labels, presence of labels
- Via discussions
- Edit in chart
- Interact with chart in a selector/scrubber manner
Â
Possibilities
D3-based
- http://d3js.org/
- https://github.com/novus/nvd3Â - Alan exploring
- http://c3js.org/Â - Justin exploring
- https://github.com/dc-js/dc.js - Cindy exploring
- Useful discussion of jQuery + D3 working together:Â http://collaboradev.com/2014/03/18/d3-and-jquery-interoperability/
Â
Other
- http://gionkunz.github.io/chartist-js/index.html (SVG-based)
- http://www.chartjs.org/Â (Canvas-based)
Â
Background Reading
D3 library
- http://chimera.labs.oreilly.com/books/1230000000345/index.html - free online version of 2013 O'Reilly book about D3
- http://square.github.io/intro-to-d3/ - A tutorial of D3.js library
- http://bost.ocks.org/mike/chart/Â - influential on D3-based chart libraries & JS charting in general
- http://bost.ocks.org/mike/nest/ - How to make nested selections with D3
D3 & jQuery interoperability
- http://collaboradev.com/2014/03/18/d3-and-jquery-interoperability/Â - discusses working with jQuery and D3 in the same project
Using D3 for canvas drawing
- https://bocoup.com/weblog/d3js-and-canvas/Â - approaches to using D3 to manage Canvas drawing
SVG accessibility
- http://www.w3.org/TR/svg-aam-1.0/Â - W3C SVG accessibility API working draft
- https://www.w3.org/WAI/PF/HTML/wiki/Canvas - wiki used by Canvas API sub-group of W3C HTML Accessibility Task Force
- http://www.slideshare.net/AnnaKhabibullina/svg-accessibility - short presentation on SVG accessibility techniques
- http://www.sitepoint.com/tips-accessible-svg/ - Tips for creating accessible SVG