All Projects → tomgp → D3 Iconarray

tomgp / D3 Iconarray

Licence: bsd-3-clause
A D3 module for making grids of icons

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to D3 Iconarray

Floweaver
View flow data as Sankey diagrams
Stars: ✭ 266 (+236.71%)
Mutual labels:  data-visualisation, d3
d3-gridding
grids for rapid D3 charts mockups
Stars: ✭ 100 (+26.58%)
Mutual labels:  d3, grid
Awesome Grid
A curated list of grid(table) libraries and resources that developers may find useful.
Stars: ✭ 1,142 (+1345.57%)
Mutual labels:  grid
Easygrid
EasyGrid - VanillaJS Responsive Grid
Stars: ✭ 77 (-2.53%)
Mutual labels:  grid
D3 Tip
d3 tooltips
Stars: ✭ 1,188 (+1403.8%)
Mutual labels:  d3
Lagrit
Los Alamos Grid Toolbox (LaGriT) is a library of user callable tools that provide mesh generation, mesh optimization and dynamic mesh maintenance in two and three dimensions.
Stars: ✭ 67 (-15.19%)
Mutual labels:  grid
Axentix
Axentix is an open source Framework based on CSS Grid using HTML, CSS and JS. The easy layout control and grid system makes it one of the most easy to learn framework.
Stars: ✭ 75 (-5.06%)
Mutual labels:  grid
D3
This is the repository for my course, Learning Data Visualization with D3.js on LinkedIn Learning and Lynda.com.
Stars: ✭ 64 (-18.99%)
Mutual labels:  d3
Interior
Design system for the modern web.
Stars: ✭ 77 (-2.53%)
Mutual labels:  grid
Smoothrefreshlayout
一款支持上下拉刷新、越界回弹、二级刷新、横向刷新、拉伸回弹、平滑滚动、嵌套滚动的多功能刷新控件
Stars: ✭ 1,166 (+1375.95%)
Mutual labels:  scale
R Raster Vector Geospatial
Introduction to Geospatial Raster and Vector Data with R
Stars: ✭ 76 (-3.8%)
Mutual labels:  data-visualisation
Path planning
This repository contains path planning algorithms in C++ for a grid based search.
Stars: ✭ 70 (-11.39%)
Mutual labels:  grid
Explore
R package that makes basic data exploration radically simple (interactive data exploration, reproducible data science)
Stars: ✭ 69 (-12.66%)
Mutual labels:  data-visualisation
React Native Grid List
🌁 Grid list component implemented with FlatList
Stars: ✭ 74 (-6.33%)
Mutual labels:  grid
Ecommerce Netlify
🛍 A JAMstack Ecommerce Site built with Nuxt and Netlify Functions
Stars: ✭ 1,147 (+1351.9%)
Mutual labels:  grid
Pan Zoom
Pan / zoom for any element
Stars: ✭ 77 (-2.53%)
Mutual labels:  grid
Etymap
Interactive visualization of Wiktionary words and etymologies.
Stars: ✭ 65 (-17.72%)
Mutual labels:  d3
Eventdrops
A time based / event series interactive visualization using d3.js
Stars: ✭ 1,164 (+1373.42%)
Mutual labels:  d3
Blenderdatavis
Data visualisation addon for Blender
Stars: ✭ 72 (-8.86%)
Mutual labels:  data-visualisation
Covid19 Dashboard
A site that displays up to date COVID-19 stats, powered by fastpages.
Stars: ✭ 1,212 (+1434.18%)
Mutual labels:  data-visualisation

d3-iconarray

examples

A D3 plugin targeting V4 helping you to draw an array of icons.

Why?

There are two parts to this plugin. First a layout which will assign x,y coordinates to elements of an array given some parameters. Second a scale which will put regular breaks in the array of icons to aid legibility.

Installing

If you use NPM, npm install d3-iconarray. Otherwise, download the latest release.

Examples

API Reference

Layout

# d3_iconarray.layout()

Construct a new icon array layout function.

# layout([data array])

The function created by the above. When given an array of data will return an array containing grid positions as well as the original data. Unless a height or width restriction has been specified the layout will try to make the grid as square as possible. eg. a 100 element data array will result in a 10x10 grid.

example

var layout = d3_iconarray.layout();

var grid = layout([1,2,3,4]); 

/*
'grid' is

[
	{"data":1,"position":{"x":0,"y":0}},
	{"data":2,"position":{"x":1,"y":0}},
	{"data":3,"position":{"x":0,"y":1}},
	{"data":4,"position":{"x":1,"y":1}}
]

/*

You can use the resulting grid to plot icons, the data points will be arranged like this

layout 1

# layout.widthFirst([boolean])

This function sets the order in which points are arranged in the grid. if widthFirst is set to true rows will be filled before starting the next, if it's false columns in the layout will be filled first. if no argument is provided it returns the current value.

example

var layout = d3_iconarray.layout()
					.widthFirst(true);

var grid = layout([1,2,3,4]); 

the resulting in the resulting grid the icons will be arranged like this

layout 2

with .widthFirst(false) they'll be arranged like this

layout 3

when to use the widthFirst switch (UK election results)

# layout.width([integer])

the width function defines the maximum number of elements the grid will have in a given row. if no argument is provided it returns the current value.

example

var layout = d3_iconarray.layout().width(3);
var grid = layout([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]);

results in a grid like

layout width restriction

# layout.height([integer])

the height function sets the maximum number of elements the grid will have in a given row. if no argument is provided it returns the current value.

example

var layout = d3_iconarray.layout().height(3);
var grid = layout([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]);

results in a grid like

layout height restriction

# layout.position([integer])

given the a number representing an array element this function will tell you it's {x, y} location in the grid. This function needs some dimension of the grid (height or width) to have been set explicitly (by height or width) or implicitly by passing a data array to the layout function

example

var layout = d3_iconarray.layout();
var grid = layout([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]);

var p = layout.position(7);
// p is {x: 3, y: 1}

# layout.maxDimension([integer])

A bit like position but given a number will return the maximum extent of the lyout if it were to have that many elements. THis is useful for setting the domain of scales.

Scale

You can use any kind of scale to draw your grid to the screen. The scale provided by the plugin can let you add breaks to your icon array to improve legibility e.g. here's a 2500 element array grouped in to blocks of 100.

blocks of 100

# d3_iconarray.scale()

Creates a scale function just like good ol' d3.scaleLinear() etc.

# scale(x)

Given a value x in the input domain, returns the corresponding value in the output range.

# scale.domain([numbers])

Set the input domain, an array of 2 numbers.

If no arguments are provided this returns the current value.

# scale.range([numbers])

Set the output range, an array of 2 numbers.

If no arguments are provided this returns the current value.

# scale.gapInterval(x)

This function accepts a number which sets at what interval a gaps appear in the output range. i.e. if x is 10 there will be an extra gap after every ten items in the output range.

If no arguments are provided this returns the current value.

see this example

# scale.gapSize(x)

This sets how big the gaps in the output range will be relative to the normal spacing. So if the normal spacing between two whole numbers is 10px and the gap size is set to 1.5 the extra wide space will be 15px.

If no arguments are provided this returns the current value.

see this example

Why?

#

Twenty years ago, a psychological study compared for the first time rudimentary icon displays for communicating risk. Today, we have dozens of randomized experiments to support the use of icon arrays (sometimes referred to as “pictographs”) as an evidence-based standard in medical risk communication.

Why use Icon Arrays

Icon arrays are particularly effective, and are apparently less likely to increase patient anxiety than other graphical techniques.

Scientific American: Inadequate Data Visualization Leaves Patients Undereducated

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].