Skip to content

Patterns ​

A pattern is a navigation structure you can reuse across many charts. Pick the pattern that fits the data, then fit the keys and focus indicators to the chart's layout.

These patterns come from several projects: our collaboration with Adobe, our collaboration with Bokeh, the Skeleton authoring app, and other charts built with Data Navigator.

Pick a pattern ​

PatternUse it forExample charts
ListA few marks, one categoryBar, pie, single line
Basic FrameAny chart with a title, axes, or legends drawn as pixelsWraps any other pattern
TreeOne grouping, or a hierarchy of any depthMulti-line, circle packing, tree diagram
Dual TreeTwo categories per data pointStacked bar, clustered bar, multi-line by month
2D SpatialTwo numerical axesScatterplot, heatmap
Spatial PlusTwo numerical axes and a categoryScatterplot colored by group
Text LabelsWriting labels and letting people customize themAll of the above

Not sure? Count the groupings each data point belongs to.

  • None, just a few items: list.
  • One: tree.
  • Two categories: dual tree.
  • Two numbers: 2D spatial.
  • Two numbers and a category: spatial plus.

Then wrap it in a frame if the chart draws its title, axes, or legends on a canvas.

What every example includes ​

  • Keyboard navigation and text chat. Both are always on. Text chat works on phones and tablets, where there is no keyboard. Type enter, then help.
  • A keys table, made by the built-in commands table (rendering's commandsElement) from the rules the structure actually uses.
  • The inspector in tree view, which shows the structure and highlights where you are.
  • Alt text for the canvas, written as: chart type, what it shows, one key takeaway.
  • Focus indicators shaped like the marks: boxes for bars, arcs for slices, circles for points, bands for lines and ranges, hulls for scattered groups.
  • The spec, pulled straight from the code that runs the demo.

Every chart is drawn with D3 on a <canvas>. A canvas is a single image to assistive technology, which is exactly the case Data Navigator is for. The focus indicators are drawn over the canvas using spatialProperties.path and the geometry helpers such as convexHullOfCircles and offsetLinePath.

Shared code ​

  • canvas.js draws text, axes, and legends, and returns their boxes for focus indicators.
  • charts.js draws the bar, line, stacked, clustered, and scatter charts.
  • mount.js connects one structure to keyboard input, text chat, the inspector, and the keys table.
  • labels.js builds labels from end-user settings.

Released under the MIT License.