Skip to main content
100%

Pictogram grid in d3js

✓ Published0🌍 Public
Aalansmithy
Last edited Jun 19, 2017
Created on Sep 17, 2014

A pictogram grid displays 100 identical SVG icons arranged in a 10x10 layout, with a jQuery UI slider controlling how many icons are highlighted in a contrasting color. The code defines the icon geometry once in an SVG `<defs>` element and reuses it via `<use>` elements, a technique that simplifies repeating graphics. D3.js (v3) generates the grid using `d3.range`, calculates each icon’s position with modulus and division, and updates the display through `d3.selectAll("use")` in response to slider input. The visualization demonstrates an interactive isotype approach for quantity comparison.

AI-generated description

Pictograms, or isotypes, in the form of repeating icons, can be used to effectively contrast quantity/magnitude comparisons in infographics and data visualisation. For more background information on the topic, I'd recommend the article by Robert Kosara:

The ISOTYPE may be close to 100 years old, but many of the ideas behind it are still very relevant and visualization might benefit from considering some of them.

Scalable Vector Graphics (SVG), the vector markup language exploited by d3.js, makes it easy to generate repeating graphics by declaring icon geometry once in the <defs> element and then calling them whenever needed via a <use> element. This simple example shows how to use d3 to create a grid of icons. A jQuery slider shows how those icons can then be addressed for interactive purposes.

The complex geometry needed to define an icon can be created by any vector graphics editor capable of generating SVG markup - Inkscape or Illustrator will work just fine. To see a project that uses this approach, have a look at the interactive census quiz of England & Wales.

mit Licensed

Similar vizzes