API: Donut

Reusable Donut Chart API class that renders a simple and configurable donut chart.

(require("Donut"))(_selection, _data)

This function creates the graph using the selection as container
Parameters:
Name Type Description
_selection D3Selection A d3 selection that represents the container(s) where the chart(s) will be rendered
_data DonutChartData The data to attach and generate the chart
Source:

Requires

  • module:d3-dispatch,

Methods


module:Donut(_selection, _data)

This function creates the graph using the selection as container
Parameters:
Name Type Description
_selection D3Selection A d3 selection that represents the container(s) where the chart(s) will be rendered
_data DonutChartData The data to attach and generate the chart
Source:

<static> colorSchema(_x)

Gets or Sets the colorSchema of the chart
Parameters:
Name Type Description
_x Array.<String> Desired colorSchema for the graph
Source:
Returns:
Current colorSchema or Chart module to chain calls
Type
String | module

<static> emptyDataConfig(_x)

Gets or Sets the emptyDataConfig of the chart. If set and data is empty (quantity adds up to zero or there are no entries), the chart will render an empty slice with a given color (light gray by default)
Parameters:
Name Type Description
_x Object emptyDataConfig object to get/set
Source:
Returns:
Current config for when chart data is an empty array
Type
Object | module
Example
donutChart.emptyDataConfig({showEmptySlice: true, emptySliceColor: '#000000'})

<static> exportChart(filename, title)

Chart exported to png and a download action is fired
Parameters:
Name Type Description
filename String File title for the resulting picture
title String Title to add at the top of the exported picture
Source:

<static> externalRadius(_x)

Gets or Sets the externalRadius of the chart
Parameters:
Name Type Description
_x Number ExternalRadius number to get/set
Source:
Returns:
Current externalRadius or Donut Chart module to chain calls
Type
Number | Module

<static> hasFixedHighlightedSlice(_x)

Gets or Sets the hasFixedHighlightedSlice property of the chart, making it to highlight the selected slice id set with `highlightSliceById` all the time.
Parameters:
Name Type Description
_x Boolean If we want to make the highlighted slice permanently highlighted
Source:
Returns:
Current hasFixedHighlightedSlice flag or Chart module
Type
Boolean | module

<static> height(_x)

Gets or Sets the height of the chart
Parameters:
Name Type Description
_x Number Desired width for the graph
Source:
Returns:
Current height or Donut Chart module to chain calls
Type
Number | Module

<static> highlightSliceById(_x)

Gets or Sets the id of the slice to highlight
Parameters:
Name Type Description
_x Number Slice id
Source:
Returns:
Current highlighted slice id or Donut Chart module to chain calls
Type
Number | Module

<static> internalRadius(_x)

Gets or Sets the internalRadius of the chart
Parameters:
Name Type Description
_x Number InternalRadius number to get/set
Source:
Returns:
Current internalRadius or Donut Chart module to chain calls
Type
Number | Module

<static> isAnimated(_x)

Gets or Sets the isAnimated property of the chart, making it to animate when render. By default this is 'false'
Parameters:
Name Type Description
_x Boolean Desired animation flag
Source:
Returns:
Current isAnimated flag or Chart module
Type
Boolean | module

<static> loadingState(markup)

Gets or Sets the loading state of the chart
Parameters:
Name Type Description
markup string Desired markup to show when null data
Source:
Returns:
Current loading state markup or Chart module to chain calls
Type
loadingState | module

<static> margin(_x)

Gets or Sets the margin of the chart
Parameters:
Name Type Description
_x Object Margin object to get/set
Source:
Returns:
Current margin or Donut Chart module to chain calls
Type
Object | Module

<static> numberFormat(_x)

Gets or Sets the number format of the donut chart
Parameters:
Name Type Description
_x string Desired number format for the donut chart
Source:
Returns:
Current numberFormat or Chart module to chain calls
Type
numberFormat | module

<static> on()

Exposes an 'on' method that acts as a bridge with the event dispatcher We are going to expose this events: customMouseOver, customMouseMove, customMouseOut and customClick
Source:
Returns:
Bar Chart
Type
module

<static> orderingFunction(_x)

Changes the order of items given custom function
Parameters:
Name Type Description
_x function A custom function that sets logic for ordering
Source:
Returns:
Void function with no return
Type
function | Module

<static> percentageFormat(_x)

Gets or Sets the percentage format for the percentage label
Parameters:
Name Type Description
_x String Format for the percentage label (e.g. '.1f')
Source:
Returns:
Current format or Donut Chart module to chain calls
Type
Number | Module

<static> radiusHoverOffset(_x)

Gets or Sets the radiusHoverOffset of the chart
Parameters:
Name Type Description
_x Number Desired offset for the hovered slice
Source:
Returns:
Current offset or Donut Chart module to chain calls
Type
Number | Module

<static> width(_x)

Gets or Sets the width of the chart
Parameters:
Name Type Description
_x Number Desired width for the graph
Source:
Returns:
Current width or Donut Chart module to chain calls
Type
Number | Module