Extends AbstractChart
Creates a new histogram graph.
args
Object argument object. See AbstractChart for general parameters.args.binCount
Number? approximate number of bins that should be used for the histogram. Defaults to what d3.bin thinks is best.args.args
...any
Mount the histogram rectangles.
Returns void
Handle move events from the delaunay triangulation.
Returns Function handler function.
Handle leaving the delaunay triangulation area.
Returns Function handler function.
Mount new delaunay triangulation.
Returns void
Extends AbstractChart
Creates a new scatter graph.
args
Object argument object. See AbstractChart for general parameters.args.sizeAccessor
(String | Function) accesor specifying the size of a data point. Can be either a string (name of the size field) or a function (receiving a data point and returning its size). (optional, defaultd=>3
)args.xRug
Boolean whether or not to generate a rug for the x axis. (optional, defaultfalse
)args.yRug
Boolean whether or not to generate a rug for the y axis. (optional, defaultfalse
)args.args
...any
Mount new rugs.
xRug
Boolean whether or not to generate a rug for the x axis. (optional, defaultfalse
)yRug
Boolean whether or not to generate a rug for the y axis. (optional, defaultfalse
)
Returns void
Mount scatter points.
Returns void
Handle incoming points from the delaunay triangulation.
Returns Function handler function
Handle leaving the delaunay area.
Returns Function handler function
Mount new delaunay triangulation instance.
Returns void
Extends AbstractChart
Creates a new line graph.
$0
Object$0.area
$0.confidenceBand
$0.voronoi
$0.defined
(optional, defaultnull
)$0.activeAccessor
(optional, defaultnull
)$0.activePoint
$0.args
...any
args
Object argument object. See AbstractChart for general parameters.args.area
(Boolean | Array) specifies for which sub-array of data an area should be shown. Boolean if data is a simple array. (optional, default[]
)args.confidenceBand
Array? array with two elements specifying how to access the lower (first) and upper (second) value for the confidence band. The two elements work like accessors and are either a string or a function.args.voronoi
Object? custom parameters passed to the voronoi generator.args.defined
Function? optional function specifying whether or not to show a given data point.args.activeAccessor
(String | Function)? accessor specifying for a given data point whether or not to show it as active.
activePoint
Object? custom parameters passed to the active point generator. See {@see Point} for a list of parameters.
Mount lines for each array of data points.
Returns void
If an active accessor is specified, mount active points.
params
Object? custom parameters for point generation. See {@see Point} for a list of options.
Returns void
Mount all specified areas.
area
(Boolean | Array) specifies for which sub-array of data an area should be shown. Boolean if data is a simple array. (optional, default[]
)
Returns void
Mount the confidence band specified by two accessors.
$0
Object$0.lowerAccessor
$0.upperAccessor
lowerAccessor
(Function | String) for the lower confidence bound. Either a string (specifying the property of the object representing the lower bound) or a function (returning the lower bound when given a data point).upperAccessor
(Function | String) for the upper confidence bound. Either a string (specifying the property of the object representing the upper bound) or a function (returning the upper bound when given a data point).
Returns void
Mount markers, if any.
Returns void
Handle incoming points from the delaunay move handler.
Returns Function handler function.
Handles leaving the delaunay area.
Returns Function handler function.
Mount a new delaunay triangulation instance.
Returns void
Normalizes the passed data to a nested array of objects.
isSingleObject: return error isArrayOfObjects: nest once isArrayOfArrays: do nothing isNestedArrayOfArrays: do nothing, assume index-based accessor isNestedArrayOfObjects: do nothing
Returns void
This abstract chart class implements all functionality that is shared between all available chart types. This is not meant to be directly instantiated.
$0
Object$0.data
$0.target
$0.markers
$0.baselines
$0.xAccessor
(optional, default'date'
)$0.yAccessor
(optional, default'value'
)$0.margin
$0.buffer
$0.width
$0.height
$0.color
$0.colors
$0.xScale
$0.yScale
$0.xAxis
$0.yAxis
$0.showTooltip
$0.tooltipFunction
$0.legend
$0.legendTarget
$0.brush
$0.custom
...any
args
Object argument object.args.data
Array data that needs to be visualized.args.target
(String | Object) DOM node to which the graph should be mounted. Either D3 selection or D3 selection specifier.args.width
Number total width of the graph.args.height
Number total height of the graph.args.markers
Array markers that should be added to the chart. Each marker object should be accessible through the xAccessor and contain a label field. (optional, default[]
)args.baselines
Array baselines that should be added to the chart. Each baseline object should be accessible through the yAccessor and contain a label field. (optional, default[]
)args.xAccessor
(String | Function) either name of the field that contains the x value or function that receives a data object and returns its x value. (optional, defaultd=>d
)args.yAccessor
(String | Function) either name of the field that contains the y value or function that receives a data object and returns its y value. (optional, defaultd=>d
)args.margin
Object margin object specifying top, bottom, left and right margin. (optional, default{top:10,left:60,right:20,bottom:40}
)args.buffer
Number amount of buffer between the axes and the graph. (optional, default10
)args.color
(String | Array)? custom color scheme for the graph.args.colors
(String | Array) alternative to color. (optional, defaultschemeCategory10
)args.xScale
Object? object that can be used to overwrite parameters of the auto-generated x Scale.args.yScale
Object? object that can be used to overwrite parameters of the auto-generated y Scale.args.xAxis
Object? object that can be used to overwrite parameters of the auto-generated x Axis.args.yAxis
Object? object that can be used to overwrite parameters of the auto-generated y Axis.args.showTooltip
Boolean? whether or not to show a tooltip.args.tooltipFunction
Function? function that receives a data object and returns the string displayed as tooltip.args.legend
Array? names of the sub-arrays of data, used as legend labels.args.legendTarget
(String | Object)? DOM node to which the legend should be mounted.
brush
(Boolean | String)? if truthy, add a bidirectional brush. Ifx
ory
, add one-directional brush.
Draw the abstract chart.
Returns void
Draw the actual chart. This is meant to be overridden by chart implementations.
Returns void
Mount a new legend if necessary
symbolType
String symbol type (circle, square, line)
Returns void
Mount new x axis.
Returns void
Mount new y axis.
Returns void
Mount a new tooltip if necessary.
showTooltip
Boolean? whether or not to show a tooltip.tooltipFunction
Function? function that receives a data object and returns the string displayed as tooltip.
Returns void
Mount the main container.
Returns void
This method is called by the abstract chart constructor. In order to simplify parsing of passed data, set flags specifying what types of data we're dealing with.
Returns void
This method is called by the abstract chart constructor. Append the local svg node to the specified target, if necessary. Return existing svg node if it's already present.
Returns void
If needed, charts can implement data normalizations, which are applied when instantiating a new chart.
Returns void
Usually, the domains of the chart's scales depend on the chart type and the passed data, so this should usually be overwritten by chart implementations.
params
Object object of custom parameters for the specific chart type
Returns Object specifying the domain for x and y axis as separate properties.
Meant to be overwritten by chart implementations. Set tick format of the x axis.
Returns void
Meant to be overwritten by chart implementations. Set tick format of the y axis.
Returns void