Draw simple pie chart using svg.
- Source:
Methods
(static) init(idopt, optionsopt) → {array}
Initialize the component
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | external:jQuery | string | <optional> | Selector or jQuery element | |||||||||||||||||||||||||
options | object | <optional> | Options can be passed to init or read from the data-options attribute on the element Properties
|
- Source:
Returns:
Returns array of all targeted elements
- Type
- array
Example:
db.libs.pieChart(document.getElementById('pieChartDemo'), { series: [113,100,50,28,27,44,68,52] }); $('#pieChartDemo').pieChart({ series: [113,100,50,28,27,44,68,52] });
(static) render(id) → {external:jQuery}
Render the chart
Parameters:
Name | Type | Description |
---|---|---|
id | external:jQuery | string | Selector or jQuery element |
- Source:
Fires:
- event:rendered
Returns:
jQuery element
- Type
- external:jQuery
(static) series(id, data) → {external:jQuery}
Updates data series.
Parameters:
Name | Type | Description |
---|---|---|
id | external:jQuery | string | Selector or jQuery element |
data | array | string | Series data. Accepts array or string that can be parsed to array using JSON.parse |
- Source:
Returns:
jQuery element
- Type
- external:jQuery
(private, static) slice(value, total, rotation) → {object}
Returns values for a slice
Parameters:
Name | Type | Description |
---|---|---|
value | number | The value for the slice |
total | number | The total value for the chart |
rotation | number | The rotation for the slice |
- Source:
Returns:
object containing data needed to draw the slice
- Type
- object
(static) update(id) → {external:jQuery}
Animates chart to values to in series.
Parameters:
Name | Type | Description |
---|---|---|
id | external:jQuery | string | Selector or jQuery element |
- Source:
Returns:
jQuery element
- Type
- external:jQuery