du.widgets.areachart

Module implementing an area chart.

Requires: d3@v4 du.Widget

AreaChart

du.widgets.areachart.AreaChart(name[, parent])

The area chart widget class.
argtypedescription
namestringIdentifier of the widget.
parentobjectParent element to append widget to. If not specified, widget is appended to body. optional

opacity

du.widgets.areachart.AreaChart.opacity(value)

Sets the opacity of the area plots. Default is 0.3.
argtypedescription
valuenumberThe opacity value to set.
returndescription
du.widgets.areachart.AreaChartReference to the current AreaChart.

data

du.widgets.areachart.AreaChart.data(data)

Binds data to the area plot. Expected data format: array containing an object for each plot. A plot object has a name property with the name of the plot and a values property which is the array of (x, y) coordinates. All plots are sorted by their x values before plot.
argtypedescription
dataArrayData to plot.
returndescription
du.widgets.areachart.AreaChartReference to the current AreaChart.

highlight

du.widgets.areachart.AreaChart.highlight(key, duration)

Highlights the specified plot.
argtypedescription
keystring string[]Single key or an array of keys of the area(s) to highlight.
durationnumberDuration of the highlight animation.
returndescription
du.widgets.areachart.AreaChartReference to the current AreaChart.