public class PieChart extends Chart
The clockwise property is set to true by default, which means slices are placed in the clockwise order. The labelsVisible property is used to either display pie slice labels or not.
Type | Property and Description |
---|---|
BooleanProperty |
clockwise
When true we start placing slices clockwise from the startAngle
|
<any> |
data
PieCharts data
|
DoubleProperty |
labelLineLength
The length of the line from the outside of the pie to the slice labels.
|
BooleanProperty |
labelsVisible
When true pie slice labels are drawn
|
DoubleProperty |
startAngle
The angle to start the first pie slice at
|
animatedProperty, legendProperty, legendSideProperty, legendVisibleProperty, titleProperty, titleSideProperty
Modifier and Type | Class and Description |
---|---|
static class |
PieChart.Data
PieChart Data Item, represents one slice in the PieChart
|
private static class |
PieChart.LabelLayoutInfo |
private static class |
PieChart.StyleableProperties |
Modifier and Type | Field and Description |
---|---|
private PieChart.Data |
begin |
private BooleanProperty |
clockwise
When true we start placing slices clockwise from the startAngle
|
private java.util.BitSet |
colorBits |
private <any> |
data
PieCharts data
|
private <any> |
dataChangeListener |
private PieChart.Data |
dataItemBeingRemoved |
private Timeline |
dataRemoveTimeline |
private static double |
LABEL_BALL_RADIUS |
private static double |
LABEL_TICK_GAP |
private java.util.List<PieChart.LabelLayoutInfo> |
labelLayoutInfos |
private DoubleProperty |
labelLineLength
The length of the line from the outside of the pie to the slice labels.
|
private Path |
labelLinePath |
private BooleanProperty |
labelsVisible
When true pie slice labels are drawn
|
private Legend |
legend |
private static int |
MIN_PIE_RADIUS |
private double |
pieRadius |
private DoubleProperty |
startAngle
The angle to start the first pie slice at
|
useChartContentMirroring
Constructor and Description |
---|
PieChart()
Construct a new empty PieChart.
|
PieChart(<any> data)
Construct a new PieChart with the given data
|
Modifier and Type | Method and Description |
---|---|
private static double |
calcX(double angle,
double radius,
double centerX) |
private static double |
calcY(double angle,
double radius,
double centerY) |
BooleanProperty |
clockwiseProperty()
When true we start placing slices clockwise from the startAngle
|
private Node |
createArcRegion(PieChart.Data item) |
private Timeline |
createDataRemoveTimeline(PieChart.Data item) |
private Text |
createPieLabel(PieChart.Data item) |
private void |
dataItemAdded(PieChart.Data item,
int index) |
private void |
dataItemRemoved(PieChart.Data item) |
private void |
dataNameChanged(PieChart.Data item) |
private void |
dataPieValueChanged(PieChart.Data item) |
<any> |
dataProperty()
PieCharts data
|
private void |
drawLabelLinePath(PieChart.LabelLayoutInfo info) |
private int |
fuzzyCompare(double o1,
double o2) |
private boolean |
fuzzyGT(double o1,
double o2) |
private boolean |
fuzzyLT(double o1,
double o2) |
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<<any>> |
getCssMetaData() |
<any> |
getData()
Gets the value of the property data.
|
private int |
getDataSize() |
double |
getLabelLineLength()
Gets the value of the property labelLineLength.
|
boolean |
getLabelsVisible()
Indicates whether pie slice labels are drawn or not
|
double |
getStartAngle()
Gets the value of the property startAngle.
|
boolean |
isClockwise()
Gets the value of the property clockwise.
|
DoubleProperty |
labelLineLengthProperty()
The length of the line from the outside of the pie to the slice labels.
|
BooleanProperty |
labelsVisibleProperty()
When true pie slice labels are drawn
|
protected void |
layoutChartChildren(double top,
double left,
double contentWidth,
double contentHeight)
Called to update and layout the chart children available from getChartChildren()
|
private static double |
normalizeAngle(double angle)
Normalize any angle into -180 to 180 deg range
|
private void |
removeDataItemRef(PieChart.Data item) |
private void |
resolveCollision(java.util.List<PieChart.LabelLayoutInfo> list) |
void |
setClockwise(boolean value)
Sets the value of the property clockwise.
|
void |
setData(<any> value)
Sets the value of the property data.
|
void |
setLabelLineLength(double value)
Sets the value of the property labelLineLength.
|
void |
setLabelsVisible(boolean value)
Sets the value of the property labelsVisible.
|
void |
setStartAngle(double value)
Sets the value of the property startAngle.
|
DoubleProperty |
startAngleProperty()
The angle to start the first pie slice at
|
private void |
updateDataItemStyleClass(PieChart.Data item,
int index) |
private void |
updateLegend()
This is called whenever a series is added or removed and the legend needs to be updated
|
animate, animate, animatedProperty, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getAnimated, getChartChildren, getLegend, getLegendSide, getTitle, getTitleSide, isLegendVisible, layoutChildren, legendProperty, legendSideProperty, legendVisibleProperty, requestChartLayout, setAnimated, setLegend, setLegendSide, setLegendVisible, setTitle, setTitleSide, shouldAnimate, titleProperty, titleSideProperty
public final <any> dataProperty
getData()
,
#setData()
public final DoubleProperty startAngleProperty
getStartAngle()
,
setStartAngle(double)
public final BooleanProperty clockwiseProperty
isClockwise()
,
setClockwise(boolean)
public final DoubleProperty labelLineLengthProperty
getLabelLineLength()
,
setLabelLineLength(double)
public final BooleanProperty labelsVisibleProperty
getLabelsVisible()
,
setLabelsVisible(boolean)
private static final int MIN_PIE_RADIUS
private static final double LABEL_TICK_GAP
private static final double LABEL_BALL_RADIUS
private java.util.BitSet colorBits
private double pieRadius
private PieChart.Data begin
private final Path labelLinePath
private java.util.List<PieChart.LabelLayoutInfo> labelLayoutInfos
private Legend legend
private PieChart.Data dataItemBeingRemoved
private Timeline dataRemoveTimeline
private final <any> dataChangeListener
private <any> data
private DoubleProperty startAngle
private BooleanProperty clockwise
private DoubleProperty labelLineLength
private BooleanProperty labelsVisible
public PieChart()
public PieChart(<any> data)
data
- The data to use, this is the actual list used so any changes to it will be reflected in the chartpublic final <any> getData()
public final void setData(<any> value)
public final <any> dataProperty()
getData()
,
#setData()
public final double getStartAngle()
public final void setStartAngle(double value)
public final DoubleProperty startAngleProperty()
getStartAngle()
,
setStartAngle(double)
public final void setClockwise(boolean value)
public final boolean isClockwise()
public final BooleanProperty clockwiseProperty()
isClockwise()
,
setClockwise(boolean)
public final double getLabelLineLength()
public final void setLabelLineLength(double value)
public final DoubleProperty labelLineLengthProperty()
getLabelLineLength()
,
setLabelLineLength(double)
public final void setLabelsVisible(boolean value)
public final boolean getLabelsVisible()
public final BooleanProperty labelsVisibleProperty()
getLabelsVisible()
,
setLabelsVisible(boolean)
private void dataNameChanged(PieChart.Data item)
private void dataPieValueChanged(PieChart.Data item)
private Node createArcRegion(PieChart.Data item)
private Text createPieLabel(PieChart.Data item)
private void updateDataItemStyleClass(PieChart.Data item, int index)
private void dataItemAdded(PieChart.Data item, int index)
private void removeDataItemRef(PieChart.Data item)
private Timeline createDataRemoveTimeline(PieChart.Data item)
private void dataItemRemoved(PieChart.Data item)
protected void layoutChartChildren(double top, double left, double contentWidth, double contentHeight)
layoutChartChildren
in class Chart
top
- The top offset from the origin to account for any padding on the chart contentleft
- The left offset from the origin to account for any padding on the chart contentcontentWidth
- The width of the area to layout the chart withincontentHeight
- The height of the area to layout the chart withinprivate void resolveCollision(java.util.List<PieChart.LabelLayoutInfo> list)
private int fuzzyCompare(double o1, double o2)
private boolean fuzzyGT(double o1, double o2)
private boolean fuzzyLT(double o1, double o2)
private void drawLabelLinePath(PieChart.LabelLayoutInfo info)
private void updateLegend()
private int getDataSize()
private static double calcX(double angle, double radius, double centerX)
private static double calcY(double angle, double radius, double centerY)
private static double normalizeAngle(double angle)
public static java.util.List<<any>> getClassCssMetaData()
public java.util.List<<any>> getCssMetaData()
getCssMetaData
in class Chart