dc.js Namespace: dc (original) (raw)
dc
The entire dc.js library is scoped under the dc name space. It does not introduce anything else into the global name space.
Most dc
functions are designed to allow function chaining, meaning they return the current chart instance whenever it is appropriate. The getter forms of functions do not participate in function chaining because they return values that are not the chart, although some, such as .svg and .xAxis, return values that are themselves chainable d3 objects.
Version:
- <%= conf.pkg.version %>
Source:
Example
// Example chaining chart.width(300) .height(300) .filter('sunday');
Classes
Mixins
Namespaces
Members
dateFormat :function
The default date format for dc.js
Type:
- function
Default Value:
- d3.timeFormat('%m/%d/%Y')
Source:
disableTransitions :Boolean
If this boolean is set truthy, all transitions will be disabled, and changes to the charts will happen immediately.
Type:
- Boolean
Default Value:
- false
Source:
Methods
deregisterAllCharts(group)
Clear given group if one is provided, otherwise clears all groups.
Parameters:
Name | Type | Description |
---|---|---|
group | String | Group name |
Source:
Returns:
Type
undefined
deregisterChart(chart [, group])
Remove given chart instance from the given group, creating the group if necessary. If no group is provided, the default group dc.constants.DEFAULT_CHART_GROUP
will be used.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
chart | Object | dc.js chart instance | |
group | String | Group name |
Source:
Returns:
Type
undefined
filterAll( [group])
Clear all filters on all charts within the given chart group. If the chart group is not given then only charts that belong to the default chart group will be reset.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
group | String |
Source:
Returns:
Type
undefined
hasChart(chart)
Determine if a given chart instance resides in any group in the registry.
Parameters:
Name | Type | Description |
---|---|---|
chart | Object | dc.js chart instance |
Source:
Returns:
Type
Boolean
pluck(n [, f])
Returns a function that given a string property name, can be used to pluck the property off an object. A function can be passed as the second argument to also alter the data being returned.
This can be a useful shorthand method to create accessor functions.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
n | String | ||
f | function |
Source:
Returns:
Type
function
Examples
var xPluck = dc.pluck('x'); var objA = {x: 1}; xPluck(objA) // 1
var xPosition = dc.pluck('x', function (x, i) {
// this
is the original datum,
// x
is the x property of the datum,
// i
is the position in the array
return this.radius + x;
});
dc.selectAll('.circle').data(...).x(xPosition);
redrawAll( [group])
Redraw all charts belong to the given chart group. If the chart group is not given then only charts that belong to the default chart group will be re-drawn. Redraw is different from re-render since when redrawing dc tries to update the graphic incrementally, using transitions, instead of starting from scratch.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
group | String |
Source:
Returns:
Type
undefined
refocusAll( [group])
Reset zoom level / focus on all charts that belong to the given chart group. If the chart group is not given then only charts that belong to the default chart group will be reset.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
group | String |
Source:
Returns:
Type
undefined
registerChart(chart [, group])
Add given chart instance to the given group, creating the group if necessary. If no group is provided, the default group dc.constants.DEFAULT_CHART_GROUP
will be used.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
chart | Object | dc.js chart instance | |
group | String | Group name |
Source:
Returns:
Type
undefined
renderAll( [group])
Re-render all charts belong to the given chart group. If the chart group is not given then only charts that belong to the default chart group will be re-rendered.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
group | String |
Source:
Returns:
Type
undefined
transition(selection [, duration] [, delay] [, name])
Start a transition on a selection if transitions are globally enabled (dc.disableTransitions is false) and the duration is greater than zero; otherwise return the selection. Since most operations are the same on a d3 selection and a d3 transition, this allows a common code path for both cases.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
selection | d3.selection | the selection to be transitioned | ||
duration | Number|function | 250 | the duration of the transition in milliseconds, a function returning the duration, or 0 for no transition | |
delay | Number|function | the delay of the transition in milliseconds, or a function returning the delay, or 0 for no delay | ||
name | String | the name of the transition (if concurrent transitions on the same elements are needed) |
Source:
Returns:
Type
d3.transition|d3.selection