dc.js Class: pieChart (original) (raw)

dc. pieChart


new pieChart(parent [, chartGroup])

The pie chart implementation is usually used to visualize a small categorical distribution. The pie chart uses keyAccessor to determine the slices, and valueAccessor to calculate the size of each slice relative to the sum of all values. Slices are ordered by orderingwhich defaults to sorting by key.

Examples:

Parameters:
Name Type Argument Description
parent String|node d3.selection
chartGroup String The name of the chart group this chart instance should be placed in. Interaction with a chart will only trigger events and redraws within the chart's group.

Mixes In:

Source:

Returns:

Type

dc.pieChart

Example

// create a pie chart under #chart-container1 element using the default global chart group var chart1 = dc.pieChart('#chart-container1'); // create a pie chart under #chart-container2 element using chart group A var chart2 = dc.pieChart('#chart-container2', 'chartGroupA');

Methods


cx( [cx])

Get or set center x coordinate position. Default is center of svg.

Parameters:
Name Type Argument Description
cx Number

Source:

Returns:

Type

Number|dc.pieChart


cy( [cy])

Get or set center y coordinate position. Default is center of svg.

Parameters:
Name Type Argument Description
cy Number

Source:

Returns:

Type

Number|dc.pieChart


drawPaths( [drawPaths])

Get or set whether to draw lines from pie slices to their labels.

Parameters:
Name Type Argument Description
drawPaths Boolean

Source:

Returns:

Type

Boolean|dc.pieChart


emptyTitle( [title])

Title to use for the only slice when there is no data.

Parameters:
Name Type Argument Description
title String

Source:

Returns:

Type

String|dc.pieChart


externalLabels( [externalLabelRadius])

Position slice labels offset from the outer edge of the chart.

The argument specifies the extra radius to be added for slice labels.

Parameters:
Name Type Argument Description
externalLabelRadius Number

Source:

Returns:

Type

Number|dc.pieChart


externalRadiusPadding( [externalRadiusPadding])

Get or set the external radius padding of the pie chart. This will force the radius of the pie chart to become smaller or larger depending on the value.

Parameters:
Name Type Argument Default Description
externalRadiusPadding Number 0

Source:

Returns:

Type

Number|dc.pieChart


innerRadius( [innerRadius])

Get or set the inner radius of the pie chart. If the inner radius is greater than 0px then the pie chart will be rendered as a doughnut chart.

Parameters:
Name Type Argument Default Description
innerRadius Number 0

Source:

Returns:

Type

Number|dc.pieChart


minAngleForLabel( [minAngleForLabel])

Get or set the minimal slice angle for label rendering. Any slice with a smaller angle will not display a slice label.

Parameters:
Name Type Argument Default Description
minAngleForLabel Number 0.5

Source:

Returns:

Type

Number|dc.pieChart


radius( [radius])

Get or set the outer radius. If the radius is not set, it will be half of the minimum of the chart width and height.

Parameters:
Name Type Argument Description
radius Number

Source:

Returns:

Type

Number|dc.pieChart


slicesCap( [cap])

Get or set the maximum number of slices the pie chart will generate. The top slices are determined by value from high to low. Other slices exeeding the cap will be rolled up into one single Others slice.

Parameters:
Name Type Argument Description
cap Number

Source:

Returns:

Type

Number|dc.pieChart