-
Notifications
You must be signed in to change notification settings - Fork 5
Configuration
The most straightforward way to customize a codebook is by using a settings object whose properties describe the chart's behavior and appearance.
Parameters for the settings
object are described in detail below.
All defaults can be over-written by users when creating a codebook.
object
An object passed to webcodebook.createCodebook()
(or its alias webcodebook.createChart()
) which controls the settings and appearance of the output.
character
Added in V1.2. A short description of the data set used in the title section.
default: null
array
Specifies which data columns should be used to create filters.
For example, filters:["Sex", "Age", "Site"]
would create filters for the 3 specified variables.
If no values are specified (as is the default), filters are created using the autofilters
setting described below.
default: []
number
Ignored when settings.filters
is specified.
When no filters
are specified by the user, filters are created for all categorical variables with least 2 unique levels, but no more than settings.autofilter
unique levels.
So, by default filters are created for categorical variables with 2-10 levels.
default: 10
array
Specifies which data columns should be included in the "group by" drop down.
If no values are specified (as is the default), the dropdown is populated using the autogroups
setting described below.
default: []
number
Ignored when settings.groups
is specified.
When no groups
are specified by the user, the group dropdown is populated with all categorical variables with least 2 unique levels, but no more than setting.autogroups
unique levels.
So, by default, the group dropdown includes categorical variables with 2-5 levels.
default: 5
boolean
Specifies whether the number of bins for each continuous variable should be calculated using the Freedman-Diaconis rule or whether a set number of bins (established in settings.nBins
) should be used for all variables.
default: true
number
Ignored when settings.autobins
is set to true.
Specifies the number of bins used in each histogram.
default: 100
number
Specifies the number of levels in a categorical variable above which the vertical bar chart renderer should be used instead the horizontal bar chart renderer.
default: 5
character
Added in v1.1. Sets control visibility on initial load, with the following valid options:
-
"visible"
- filters are visible, filter toggle is visible -
"minimized"
- filters are hidden, filter toggle is visible -
"hidden"
- filters are hidden, filter toggle is hidden (must be set by user when creating the codebook)
default: "visible"
character
Added in v1.3. Sets visibility for codebook charts on initial load, with the following valid options:
-
"visible"
- charts are visible, chart toggle is visible -
"minimized"
- charts are hidden, chart toggle is visible -
"hidden"
- charts are hidden, chart toggle is hidden
default: "visible"
array
of character
or object
Sets tabs to be included in the codebook. The simplest way to specify tabs is via an array of strings. Valid options are as follows (others are ignored):
"codebook"
"listing"
-
"chartMaker"
(added in v1.3) "settings"
-
"files"
(recommended use on in conjunction withexplorer
functionality)
Alternatively, users can specify an array of objects to customize the label
and instructions
components of the tabs.
The key
parameter of the object should match the text string described above.
Other object labels will overwrite the default behavior specified in this file. For example, this array would show the codebook and settings tabs only, with a custom label for settings: {"tabs":["codebook",{key:"settings", label:"Customize Settings"}]}
.
default: ["codebook","listing","chartMaker","settings"]
character
Added in v1.1.
Specify which tab to be shown on initial load from values in settings.tabs
.
default: First value in settings.tabs
.
array
of variable
Added in v1.1. Specifies a list of variables for whom no summary rows, filters or group selections will be displayed. Any variable names included in the array that are not found in the raw data will be silently ignored.
default: []
array
of object
s
Added in v1.2.
Each object in the array provides metadata for the columns in the loaded data.
value_col
(required) and label
(optional) have special meanings described below.
All other key/value pairs are simply reported as provided in the "Meta" section header view on the "Summary Table" tab.
default: []
string
required
A string matching a column in the dataset.
meta
objects with no matching data
column are ignored.
If a label
parameter is provided, it is included in the settings.variableLabels
array described below.
Labels defined settings.meta
can be overwritten by a second label is provided in settings.variableLabels
.
array
of object
s
Added in v1.1.
Specifies a list of value_col
/label
objects whose label
value propagates to group options, filter labels, summary row titles, grouped chart titles, and data listing headers
default: []