new SeriesChart(parent [, chartGroup])
Create a Series Chart.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
parent |
String | node | d3.selection | Any valid d3 single selector specifying a dom block element such as a div; or a dom element or d3 selection. |
|
chartGroup |
String |
<optional> |
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:
Example
// create a series chart under #chart-container1 element using the default global chart group var seriesChart1 = new SeriesChart("#chart-container1"); // create a series chart under #chart-container2 element using chart group A var seriesChart2 = new SeriesChart("#chart-container2", "chartGroupA");
Classes
Methods
-
chart( [chartFunction])
-
Get or set the chart function, which generates the child charts.
Parameters:
Name Type Argument Default Description chartFunction
function <optional>
(anchor) => new LineChart(anchor) - Source:
Returns:
- Type
- function | SeriesChart
Example
// put curve on the line charts used for the series chart.chart(function(c) { return new LineChart(c).curve(d3.curveBasis); }) // do a scatter series chart chart.chart(anchor => new ScatterPlot(anchor))
-
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 <optional>
- Source:
Returns:
- Type
- function | 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 <optional>
d3.ascending - Source:
- See:
Returns:
- Type
- function | 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 <optional>
- Source:
- See:
Returns:
- Type
- function | SeriesChart
Example
// Default value sort _chart.valueSort(function keySort (a, b) { return d3.ascending(_chart.keyAccessor()(a), _chart.keyAccessor()(b)); });