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: @designteam/cn_people_ring
version: 0
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: { data: [ [ "DataColumn1Value1", "DataColumn2Value1", [ "DataColumn1Value2", "DataColumn2Value2", [ "DataColumn1Value3", "DataColumn2Value3", ... ], pictures: [ [ "PicturesColumn1Value1", "PicturesColumn2Value1", [ "PicturesColumn1Value2", "PicturesColumn2Value2", [ "PicturesColumn1Value3", "PicturesColumn2Value3", ... ] } }
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: "@designteam/cn_people_ring", version: "0", bindings: { data: { name: 0, // index of a column in your data link: 1, // index of a column in your data group: 2, // index of a column in your data ring: 3, // index of a column in your data caption: 4, // index of a column in your data }, pictures: { name: 0, // index of a column in your data picture: 1, // index of a column in your data } }, data: { data: [ [ "DataColumn1Value1", "DataColumn2Value1", [ "DataColumn1Value2", "DataColumn2Value2", [ "DataColumn1Value3", "DataColumn2Value3", ... ], pictures: [ [ "PicturesColumn1Value1", "PicturesColumn2Value1", [ "PicturesColumn1Value2", "PicturesColumn2Value2", [ "PicturesColumn1Value3", "PicturesColumn2Value3", ... ] } }
All possible bindings that you can supply are shown in this example:
{ template: "@designteam/cn_people_ring", version: "0", bindings: { data: { name: 0, // index of a column in your data link: 1, // index of a column in your data group: 2, // index of a column in your data ring: 3, // index of a column in your data caption: 4, // index of a column in your data }, pictures: { name: 0, // index of a column in your data picture: 1, // index of a column in your data } }, data: { data: [ [ "DataColumn1Value1", "DataColumn2Value1", [ "DataColumn1Value2", "DataColumn2Value2", [ "DataColumn1Value3", "DataColumn2Value3", ... ], pictures: [ [ "PicturesColumn1Value1", "PicturesColumn2Value1", [ "PicturesColumn1Value2", "PicturesColumn2Value2", [ "PicturesColumn1Value3", "PicturesColumn2Value3", ... ] } }
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:
{ data: [ { "DataHeader1": ..., "DataHeader2": ..., ... }, { "DataHeader1": ..., "DataHeader2": ..., ... }, { "DataHeader1": ..., "DataHeader2": ..., ... }, ... ], pictures: [ { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, ... ] }
... 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: "@designteam/cn_people_ring", version: "0", bindings: { data: { name: "DataHeader1", link: "DataHeader2", group: "DataHeader3", ring: "DataHeader4", caption: "DataHeader5", }, pictures: { name: "PicturesHeader1", picture: "PicturesHeader2", } }, data: { data: [ { "DataHeader1": ..., "DataHeader2": ..., ... }, { "DataHeader1": ..., "DataHeader2": ..., ... }, { "DataHeader1": ..., "DataHeader2": ..., ... }, ... ], pictures: [ { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, ... ] } }
All possible bindings that you can supply are shown in this example:
{ template: "@designteam/cn_people_ring", version: "0", bindings: { data: { name: "DataHeader1", link: "DataHeader2", group: "DataHeader3", ring: "DataHeader4", caption: "DataHeader5", }, pictures: { name: "PicturesHeader1", picture: "PicturesHeader2", } }, data: { data: [ { "DataHeader1": ..., "DataHeader2": ..., ... }, { "DataHeader1": ..., "DataHeader2": ..., ... }, { "DataHeader1": ..., "DataHeader2": ..., ... }, ... ], pictures: [ { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, { "PicturesHeader1": ..., "PicturesHeader2": ..., ... }, ... ] } }
(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: "@designteam/cn_people_ring", version: "0", data: { data: [ { name: ..., link: ..., group: ..., ring: ..., caption: ... }, ... ], pictures: [ { name: ..., picture: ... }, ... ] }, ... }
And the full list of all possible properties is as follows:
{ template: "@designteam/cn_people_ring", version: "0", data: { data: [ { name: ..., link: ..., group: ..., ring: ..., caption: ... }, ... ], pictures: [ { name: ..., picture: ... }, ... ] }, ... }
Meanings of the template data keys:
- data.name: name
- data.link: link
- data.group: group
- data.ring: ring
- data.caption: caption
- pictures.name: name
- pictures.picture: picture
Template settings
Options for opts.state
.
Text & title
highlightedButtons string
Highlighted buttons.
diagramLevel string
Level. Allowed values:
headingInput string
Heading.
subheadingInput string
Sub heading.
note string
Note.
source string
Source.
backColour color
Background.
techColour color
Company colour.
Square
iconColours colors
Colours.
iconWidth number
Square width.
iconHeight number
Square height.
outerStrokeWidth number
Stroke width.
outerStrokeColour color
Stroke colour.
breakpoint number
Breakpoint.
Label
labelPosition string
Label position. Allowed values:
figureMultiple number
Each square represents.
figurePrefix string
Prefix.
figureSuffix string
Suffix.