How to use this template
This template is designed to show realtionships between nodes in a network visualized in a 3D space, and viewable in VR on mobile devices using Google Cardboard headsets.
Data requirements
This network requires two data tables. The first are the nodes. Each row represents a node in the network and requires an id, rank, and name, an optional category column can be included. The second are the links, which require a source, the id of a node to draw the line from, a target, the id of a node to draw the line to, and a value, quantifying the relationship between the two. Finally, an optional categories table can be used to customize the color of the nodes based on their category column.
Tips
- You can edit the logo, title, description, and add your own google analytics tracking id in the Flourish interface.
- Node, link, cursor, and horizon colors can all also be customized.
- Nodes which are not linked to any other part of the network, and links which have a non-existant source or target will be ignored.
Credits
Created by Pitch Interactive and Google News Lab.
API information
This section documents API usage specific to this template, so for an introduction we suggest you refer to the generic API documentation instead.
template: _218
version: _87
Template data
There are three different formats in which you can supply data to this template. The most convenient for you to use likely depends on the source of your data, as described below.
1. Array of arrays, and a bindings object
You can supply arrays of arrays to opts.data
, which might look
like:
{ data: { nodes: [ [ "NodesColumn1Value1", "NodesColumn2Value1", [ "NodesColumn1Value2", "NodesColumn2Value2", [ "NodesColumn1Value3", "NodesColumn2Value3", ... ], links: [ [ "LinksColumn1Value1", "LinksColumn2Value1", [ "LinksColumn1Value2", "LinksColumn2Value2", [ "LinksColumn1Value3", "LinksColumn2Value3", ... ], categories: [ [ "CategoriesColumn1Value1", "CategoriesColumn2Value1", [ "CategoriesColumn1Value2", "CategoriesColumn2Value2", [ "CategoriesColumn1Value3", "CategoriesColumn2Value3", ... ] } }
where each array of arrays represents the rows in a data sheet.
To tell the API how the values from each column should be
associated with the keys that the template is expecting, you must also supply
an object attached to opts.bindings
. (The meanings of the
keys in the bindings object are documented
below.) The minimal bindings you can
supply for this template are as shown in this example:
{ template: "_218", version: "_87", bindings: { nodes: { id: 0, // index of a column in your data rank: 1, // index of a column in your data name: 2, // index of a column in your data }, links: { source: 0, // index of a column in your data target: 1, // index of a column in your data value: 2, // index of a column in your data }, categories: { } }, data: { nodes: [ [ "NodesColumn1Value1", "NodesColumn2Value1", [ "NodesColumn1Value2", "NodesColumn2Value2", [ "NodesColumn1Value3", "NodesColumn2Value3", ... ], links: [ [ "LinksColumn1Value1", "LinksColumn2Value1", [ "LinksColumn1Value2", "LinksColumn2Value2", [ "LinksColumn1Value3", "LinksColumn2Value3", ... ], categories: [ [ "CategoriesColumn1Value1", "CategoriesColumn2Value1", [ "CategoriesColumn1Value2", "CategoriesColumn2Value2", [ "CategoriesColumn1Value3", "CategoriesColumn2Value3", ... ] } }
All possible bindings that you can supply are shown in this example:
{ template: "_218", version: "_87", bindings: { nodes: { id: 0, // index of a column in your data rank: 1, // index of a column in your data name: 2, // index of a column in your data category: 3, // index of a column in your data }, links: { source: 0, // index of a column in your data target: 1, // index of a column in your data value: 2, // index of a column in your data }, categories: { id: 0, // index of a column in your data name: 1, // index of a column in your data color: 2, // index of a column in your data } }, data: { nodes: [ [ "NodesColumn1Value1", "NodesColumn2Value1", [ "NodesColumn1Value2", "NodesColumn2Value2", [ "NodesColumn1Value3", "NodesColumn2Value3", ... ], links: [ [ "LinksColumn1Value1", "LinksColumn2Value1", [ "LinksColumn1Value2", "LinksColumn2Value2", [ "LinksColumn1Value3", "LinksColumn2Value3", ... ], categories: [ [ "CategoriesColumn1Value1", "CategoriesColumn2Value1", [ "CategoriesColumn1Value2", "CategoriesColumn2Value2", [ "CategoriesColumn1Value3", "CategoriesColumn2Value3", ... ] } }
2. Array of objects with arbitrary keys, and a bindings object
This format is most likely useful when you have data from an external source,
such as CSV data loaded from d3-dsv.
You should supply this attached to the opts.data
, which might look
like:
{ nodes: [ { "NodesHeader1": ..., "NodesHeader2": ..., ... }, { "NodesHeader1": ..., "NodesHeader2": ..., ... }, { "NodesHeader1": ..., "NodesHeader2": ..., ... }, ... ], links: [ { "LinksHeader1": ..., "LinksHeader2": ..., ... }, { "LinksHeader1": ..., "LinksHeader2": ..., ... }, { "LinksHeader1": ..., "LinksHeader2": ..., ... }, ... ], categories: [ { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, ... ] }
... but with the keys being the column headers from your
source data instead. You must also supply an object attached to
opts.bindings
. The minimal bindings you can
supply for this template are as shown in this example:
{ template: "_218", version: "_87", bindings: { nodes: { id: "NodesHeader1", rank: "NodesHeader2", name: "NodesHeader3", }, links: { source: "LinksHeader1", target: "LinksHeader2", value: "LinksHeader3", }, categories: { } }, data: { nodes: [ { "NodesHeader1": ..., "NodesHeader2": ..., ... }, { "NodesHeader1": ..., "NodesHeader2": ..., ... }, { "NodesHeader1": ..., "NodesHeader2": ..., ... }, ... ], links: [ { "LinksHeader1": ..., "LinksHeader2": ..., ... }, { "LinksHeader1": ..., "LinksHeader2": ..., ... }, { "LinksHeader1": ..., "LinksHeader2": ..., ... }, ... ], categories: [ { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, ... ] } }
All possible bindings that you can supply are shown in this example:
{ template: "_218", version: "_87", bindings: { nodes: { id: "NodesHeader1", rank: "NodesHeader2", name: "NodesHeader3", category: "NodesHeader4", }, links: { source: "LinksHeader1", target: "LinksHeader2", value: "LinksHeader3", }, categories: { id: "CategoriesHeader1", name: "CategoriesHeader2", color: "CategoriesHeader3", } }, data: { nodes: [ { "NodesHeader1": ..., "NodesHeader2": ..., ... }, { "NodesHeader1": ..., "NodesHeader2": ..., ... }, { "NodesHeader1": ..., "NodesHeader2": ..., ... }, ... ], links: [ { "LinksHeader1": ..., "LinksHeader2": ..., ... }, { "LinksHeader1": ..., "LinksHeader2": ..., ... }, { "LinksHeader1": ..., "LinksHeader2": ..., ... }, ... ], categories: [ { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, { "CategoriesHeader1": ..., "CategoriesHeader2": ..., ... }, ... ] } }
(As before, the keys containing "Header" would be replaced by column names from your data source.)
3. Array of objects with template-defined keys
There is an alternative format you can use, which is likely to be easier to
use if your data is not from a spreadsheet source. With this alternative format
you supply your data to the template as
an array of objects, attached to opts.data
, where the keys must
be those used by the template, as documented below. In this case
there is no need to supply a bindings object, since the key names are already
those expected by the template. The required properties in the data
object are as follows (scroll down for a
description of what each property is):
{ template: "_218", version: "_87", data: { nodes: [ { id: ..., rank: ..., name: ... }, ... ], links: [ { source: ..., target: ..., value: ... }, ... ] }, ... }
And the full list of all possible properties is as follows:
{ template: "_218", version: "_87", data: { nodes: [ { id: ..., rank: ..., name: ..., category: ... }, ... ], links: [ { source: ..., target: ..., value: ... }, ... ], categories: [ { id: ..., name: ..., color: ... }, ... ] }, ... }
Meanings of the template data keys:
- nodes.id: id
- nodes.rank: rank
- nodes.name: name
- nodes.category: category
- links.source: source
- links.target: target
- links.value: value
- categories.id: id
- categories.name: name
- categories.color: color
Template settings
Options for opts.state
.
Introduction
logo text
Logo. Data URI of Logo at 1024 x 256 pixels
gatid string
Google Analytics Tracking ID.
title string
Title. Visualizaiton title
description text
Description. Introductory and explanatory text
Nodes
basicNodeColor color
Default Node Color. The default basic node color if category colors are not set in data
adjacentNodeColor color
Default Adjacent Node Color. The default adjacent node color if category colors are not set in data
highlightNodeColor color
Default Highlight Node Color. The default highlight node color if category colors are not set in data
Links
linkInboundColor color
Inbound Color. The color of links to shows also searched for
linkOutboundColor color
Outbound Color. The color of links to related searches
Cursor
cursorInnerColor color
Inner Color. The inside ring of the Cursor
cursorOuterColor color
Outer Color. The outside rings of the Cursor
cursorActiveColor color
Active Color. The color that indicates the cursor is selecting an element
cursorOpacity number
Opacity. The opacity of the cursor Max: 1
Legend
legendInboundLabel string
Inbound Label. Legend Label for inbound links
legendOutboundLabel string
Outbound Label. Legend Label for outbound links
Horizon
horizonTopColor color
Top Color. The color of the sky
horizonBottomColor color
Bottom Color. The color at the horizon
horizonExponent number
Exponent. The amount to blend top and bottom colors Max: 1