Skip to content
jwildfire edited this page Sep 6, 2018 · 12 revisions

Everything in this library is scoped under the webcodebook namespace:

webcodebook

object

the webcodebook namespace represented as an object whose properties and methods provide access to the functions needed to create a web codebook, an explorer, or to initialize a stand-alone instance of one of the charts used in the webcodebook.

webcodebook.createCodebook(element, config)

a factory to create a codebook.

returns: codebook object

Param Type Description
element string CSS selector identifying the element in which to create the codebook; defaults to "body"
config object config object specifying all options for how the codebook is to appear and behave; see Configuration

codebook.init(data)

function to initialize a codebook for a given data object.

Param Type Description
data object data object to be summarize; see Data Guidelines

codebook.on(event,function)

Added in v1.2. Function to add a callback to a codebook. Should be called before codebook.init()

Param Type Description
event string event specifying when the function should be run. Valid events are "init" and "complete"
function function function to be called. Function's context (this) is the codebook object itself

webcodebook.createExplorer(element, config)

a factory to create a codebook explorer. The codebook explorer allows users to pre-configure a UI element to toggle between codebooks for multiple data files.

returns: explorer object

Param Type Description
element string CSS selector identifying the element in which to create the explorer; defaults to "body"
config object config object specifying all options for how the explorer is to appear and behave; see Configuration

explorer.addFiles(files)

A function that adds additional files to an existing explorer. files should follow the guidelines specified here. Added in v1.3.

explorer.on(event,function)

Added in v1.5. Function to add a callback to an explorer. Should be called before explorer.init().

Param Type Description
event string event specifying when the function should be run. Valid events are "init", "addFile" and "makeCodebook"
function function function to be called. Function's context (this) is the codebook object itself

webcodebook.charts

An object containing references to the code used to create the 4 custom chart types used in the web codebook:

  1. Horizontal Bar charts - initialized with src/charts/createHorizontalBars.js
  2. Vertical Bar charts - initialized with src/charts/createVerticalBars.js
  3. Histogram/Box Plots - initialized with src/charts/createHistogramBoxPlot.js
  4. Dot Plots - initialized with src/charts/createDotPlot.js

The charts are all created using custom webcharts renderers. Once created, each chart is a stand-alone webcharts chart object that is bound to the codebook object. Users could theoretically create stand-alone, customizable instances of these charts outside of the context of a codebook, but that functionality is not fully supported or documented in the current release.