dc.js Class: seriesChart (original) (raw)
dc. seriesChart
new seriesChart(parent [, chartGroup])
A series chart is a chart that shows multiple series of data overlaid on one chart, where the series is specified in the data. It is a specialization of Composite Chart and inherits all composite features other than recomposing the chart.
Examples:
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
parent | String|node | d3.selection | |
chartGroup | String | The name of the chart group this chart instance should be placed in. Interaction with a chart will only trigger events and redraws within the chart's group. |
Mixes In:
Source:
Returns:
Type
Example
// create a series chart under #chart-container1 element using the default global chart group var seriesChart1 = dc.seriesChart("#chart-container1"); // create a series chart under #chart-container2 element using chart group A var seriesChart2 = dc.seriesChart("#chart-container2", "chartGroupA");
Methods
chart( [chartFunction])
Get or set the chart function, which generates the child charts.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
chartFunction | function | dc.lineChart |
Source:
Returns:
Type
function|dc.seriesChart
Example
// put curve on the line charts used for the series chart.chart(function(c) { return dc.lineChart(c).curve(d3.curveBasis); }) // do a scatter series chart chart.chart(dc.scatterPlot)
seriesAccessor( [accessor])
mandatory
Get or set accessor function for the displayed series. Given a datum, this function should return the series that datum belongs to.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
accessor | function |
Source:
Returns:
Type
function|dc.seriesChart
Example
// simple series accessor chart.seriesAccessor(function(d) { return "Expt: " + d.key[0]; })
seriesSort( [sortFunction])
Get or set a function to sort the list of series by, given series values.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
sortFunction | function | d3.ascending |
Source:
See:
Returns:
Type
function|dc.seriesChart
Example
chart.seriesSort(d3.descending);
valueSort( [sortFunction])
Get or set a function to sort each series values by. By default this is the key accessor which, for example, will ensure a lineChart series connects its points in increasing key/x order, rather than haphazardly.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
sortFunction | function |
Source:
See:
Returns:
Type
function|dc.seriesChart
Example
// Default value sort _chart.valueSort(function keySort (a, b) { return d3.ascending(_chart.keyAccessor()(a), _chart.keyAccessor()(b)); });