Module implementing an interactive pie chart.
Requires: d3@v4 du.Widget
du.widgets.piechart.PieChart(name[, parent])
The pie chart widget class.
| arg | type | description |
|---|
| name | string | Identifier of the pie chart. |
| parent | object | Parent element to append widget to. If not specified, widget is appended to body. optional |
du.widgets.piechart.PieChart.innerRadius(size)
Sets the inner radius in pixels. Default is 0.
| arg | type | description |
|---|
| size | number | Size of the inner radius in pixels. |
| return | description |
|---|
du.widgets.piechart.PieChart | Reference to the current PieChart. |
du.widgets.piechart.PieChart.outerRadius(size)
Sets the outer radius in pixels. Default is 50.
| arg | type | description |
|---|
| size | number | Size of the outer radius in pixels. |
| return | description |
|---|
du.widgets.piechart.PieChart | Reference to the current PieChart. |
du.widgets.piechart.PieChart.ticks(add)
Adds values as small labels inside the chart.
| arg | type | description |
|---|
| add | boolean | Adds ticks. |
| return | description |
|---|
du.widgets.piechart.PieChart | Reference to the current PieChart. |
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).
| arg | type | description |
|---|
| data | object | Data to plot. |
| return | description |
|---|
du.widgets.piechart.PieChart | Reference to the current PieChart. |
du.widgets.piechart.PieChart.highlight(key, duration)
Highlights the specified slice.
| arg | type | description |
|---|
| key | string string[] | Single key or an array of keys of the segment(s) to highlight. |
| duration | number | Duration of the highlight animation. |
| return | description |
|---|
du.widgets.piechart.PieChart | Reference to the current PieChart. |