Class: c3.Plot

Defined in: js/c3-plot.coffee
Inherits: c3.Chart

Overview

TODO: Avoid negative plot height/width's when div is too small to fit margins and axes.

An XY Plot is a chart with an X and a Y axis. This chart doesn't visualize data directly itself, but contains a set of layers on top of each other. Layers provide for such charts as bar charts, area graphs, scatter plots, segment stripcharts, etc. The data, scales, and x/y accessors are all required, but may be provided either to the plot itself as a default for all layers or individually as an override on each layer or some combination.

Styling

Extensibility

c3 will set the following members of the content selection:

Author:

Direct Known Subclasses

c3.Plot.Selectable c3.Plot.Zoomable

Variables Summary

version =
0.1
type =
'plot'
layers =
[]

[Array<c3.Plot.Layer>] Array of layers that constitute this XY Plot

axes =
[]

[Array<c3.Axis>] Array of axis objects to attach to this plot.

data =
[]

[Array] Default data array for layers in this plot. This can be set for each individual layer or a default for the entire chart.

h =
undefined

[d3.scale] Scale for the horizontal X axis. Please set the domain(), c3 will set the range(). This can be set for each individual layer or a default for the entire chart.

v =
undefined

[d3.scale] Scale for the vertical Y axis. Please set the domain(), c3 will set the range(). This can be set for each individual layer or a default for the entire chart.

x =
undefined

[Function] An accessor function to get the X value from a data item. This can be set for each individual layer or a default for the entire chart. Some plots support calling this accessor with the index of the data as well as the datum itself.

y =
undefined

[Function] An accessor function to get the Y value from a data item. This can be set for each individual layer or a default for the entire chart. Some plots support calling this accessor with the index of the data as well as the datum itself.

h_domain =
undefined

[Function | Array<Number|String]] Automatic scaling for horizontal domain. EXPERIMENTAL Optional domain which is used to set the h scale at render time or with rescale(). It may be a callback to allow for dynamic domains. Either min or max values may be auto which will map to min_x() or max_x().

v_domain =
undefined

[Function | Array<Number|String]] Automatic scaling for vertical domain. EXPERIMENTAL Optional domain which is used to set the v scale at render time or with rescale(). It may be a callback to allow for dynamic domains. Either min or max values may be auto which will map to min_y() or max_y().

margins =
undefined

[Number, Object] Set margins around the plot in pixels. Can either be a number to set all margins or an object to individually set the top, bottom, left, and right margins.

crop_margins =
true

[Boolean] Crop the plot rendering at the edge of the plot so it doesn't overlap the axis and margins. Set to true or false to enable/disable, or set to 'x' or 'y' to only crop in one direction.

layer_options =
undefined

[c3.Selection.Options] Options to apply to each layer. For callbacks, the first argument is the layer object and the second argument is the index of the layer

axis_options =
undefined

[c3.Selection.Options] Options to apply to each axis. For callbacks, the first argument is the axis object and the second argument is the index of the axis

Variable inherited from c3.Chart

type class options content_options anchor height width anchor_styles handlers

Instance Method Summary

Inherited Method Summary

Methods inherited from c3.Chart

#init #style #render #resize #redraw #restyle #_prep #_init #size #_size #update #_update #draw #_draw #_style

Instance Method Details

# (void) _init() Bound

# (void) _size() Bound

# (void) _update(origin) Bound

# (void) _draw(origin) Bound

# (void) _style(style_new) Bound

# (Boolean) scale(origin) Bound

Note: Needs to happen after update() so that stacked layers are computed

EXPERIMENTAL RESCALE Update any automatic scales

Returns:

  • ( Boolean ) — Returns true if any domains were changed

# (void) rescale() Bound

EXPERIMENTAL RESCALE An addition re* API which will adjust the scales for any domains with callbacks See h_domain and v_domain.

# (void) min_x() Bound

# (void) max_x() Bound

# (void) min_y() Bound

# (void) max_y() Bound

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: