Coder Social home page Coder Social logo

joshpoll / olli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mitvis/olli

0.0 0.0 0.0 307 KB

A JavaScript library that converts visualizations into a keyboard-navigable structure accessible to screen readers to make visualizations more accessible for blind and low vision users.

JavaScript 0.54% TypeScript 99.46%

olli's Introduction

Olli - Making Visualizations more Accessible

Olli is a library, that in a single function call, creates a scalable and standard infrastructure for acessible web-based visualizations by embedding a navigable tree that users can explore for a richer screen reader experience. Adapters specific to different visualization libaries break down a chart where an accessible rendering is then created using existing ARIA TreeView technology.

Current Visualization Library Support

How It Works

  1. Using an adapter design pattern, visualizations are deconstructed into a VisualizationStructure type detailing a chart's structural, hierarchical, and visual components.
  2. The deconstructed chart is then transformed into a tree following the design dimensions outlined in this paper from EuroVis2022
  3. The tree is then traversed to create various HTML Elements that are then appeneded to the webpage with set ARIA labels and key-bindings.

All of these steps are done by calling olli({...}) in a single configuration containing the deconstructed visualization, type of rendering to create, and the DOM Id of where to append the rendering.

Usage

HTML <Script> Tags

The most basic way to use Olli is to add it to any basic HTML page.

Show instructions
  1. Add the script tag inside the document <head>:

    <html>
      ...
      <head>
         ...
         <script src="..." />
         ...
      </head>
      ...
    </html>
  2. Call Olli from a <script> tag:

    ...
    <script>
      ...
      olli({
        visualization: vegaLiteAdapter(visSpec, additionalInfo),
        renderType: 'tree'
        domId: 'Accessible-Vis'
      })
    </script>

JS Applications

Olli can also be easily added to normal JavaScript applications.

Show instructions
  1. Install the preset:

    npm install olli
  2. Import olli, and the adapter you want to use, into the file you want to use it in

    import {olli, vegaLiteAdater} from 'olli'
    
    ...
  3. Call olli and set-up your configuration object:

    ...
    
      olli({
        visualization: vegaLiteAdapter(visSpec, additionalInfo),
        renderType: 'tree'
        domId: 'Accessible-Vis'
      })
    ...   

React

Olli can even be used with React, but due to how React handles the state of the DOM, olli has to be called inside the `useEffect(() => {}) hook.

Show instructions
  1. Install preset:

    npm install olli
  2. Import olli, and the adapter you want to use, into the component you want to use it in

    import {olli, vegaLiteAdater} from 'olli'
    
    ...
  3. Call olli and set-up your configuration object inside the useEffect(() => {}) hook:

    ...
    
    useEffect(() => {
      olli({
        visualization: vegaLiteAdapter(visSpec, additionalInfo),
        renderType: 'tree'
        domId: 'Accessible-Vis'
      })
    })
    ...   

Configuration Object

The configuration object is what's needed to generate an accessibile visualization. It is a simple object that includes the OlliVisSpec of your visualization, the type of rendering you want to create, an optional ARIA label for the rendering, and the DOM id of where you want the rendering placed on your webpage. If no render type is specified the default rendering will be the navigable TreeView.

Type specification of the configuration:

type OlliConfigOptions = {
    visualization: OlliVisSpec,
    domId: string,
    renderType?: 'tree' | 'table',
    ariaLabel?: string
}

Configuration Example:

let olliConfig: OlliConfigOptions = {
  visualization: VegaLiteAdapter(vlScenegraph, vlSpec),
  domId: 'Accessible-Vis',
  renderType: 'tree'
}

Contributing

If you want to help with Olli's development and want to see visualizations become more accessible, anyone is welcome to clone the repository and fix bugs or add new features

git clone https:...
cd olli
git branch [Your Branch Name]
git checkout Your Branch Name]

Adding New Adapters

There's a non-zero chance that an adapter may not exist yet for your visualization library, but that's ok! There's a simple interface outlined for adapters where you can either create your own, or submit an issue to add support for your library.

The adapter interface is as follows:

export type VisAdapter = (visObject: any, helperVisInformation: any) => VisualizationStructure

For an explanation on the types that exist for Olli and how visualizations are decontructed check out the README under .\src\Adapters\

olli's People

Contributors

matt-blanco avatar jonathanzong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.