du.widgets.piechart

Module implementing an interactive pie chart.

Requires: d3@v4 du.Widget

PieChart

du.widgets.piechart.PieChart(name[, parent])

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

innerRadius

du.widgets.piechart.PieChart.innerRadius(size)

Sets the inner radius in pixels. Default is 0.
argtypedescription
sizenumberSize of the inner radius in pixels.
returndescription
du.widgets.piechart.PieChartReference to the current PieChart.

outerRadius

du.widgets.piechart.PieChart.outerRadius(size)

Sets the outer radius in pixels. Default is 50.
argtypedescription
sizenumberSize of the outer radius in pixels.
returndescription
du.widgets.piechart.PieChartReference to the current PieChart.

ticks

du.widgets.piechart.PieChart.ticks(add)

Adds values as small labels inside the chart.
argtypedescription
addbooleanAdds ticks.
returndescription
du.widgets.piechart.PieChartReference to the current PieChart.

data

du.widgets.piechart.PieChart.data(data)

Binds new data to pie chart. Expected data format: array of objects with properties name (name of the slice) and value (corresponding number).
argtypedescription
dataobjectData to plot.
returndescription
du.widgets.piechart.PieChartReference to the current PieChart.

highlight

du.widgets.piechart.PieChart.highlight(key, duration)

Highlights the specified slice.
argtypedescription
keystring string[]Single key or an array of keys of the segment(s) to highlight.
durationnumberDuration of the highlight animation.
returndescription
du.widgets.piechart.PieChartReference to the current PieChart.