These methods are used to set the accessor functions for the primary and secondary keys and values for the graph. The primary key determines the groups appearing on the left for vertical orientation and top for horizontal orientation. The secondary is the other part. The value column is used to compute the size of bars.
The left example has the default keyPrimary, keySecondary, and value accessors which are d=>d[0]
, d=>d[1]
and d=>d[2]
respectively.
The right example is using d=>d[1]
(column with X,Y in data) for primary part, d=>d[0]
(column with A,B, C in data)
for secondary part, and d=>d[3]
for value.
For other options and examples, check VizJS
Modified http://vizjs.org/viz.v1.1.0.min.js to a secure url
https://d3js.org/d3.v4.min.js
https://vizjs.org/viz.v1.1.0.min.js