APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javafx.scene.chart

public Class StackedAreaChart<X, Y>

extends XYChart<X, Y>
Class Inheritance
Type Parameters
<X>
the X axis value type
<Y>
the Y axis value type
Imports
java.util.ArrayList, .Arrays, .Collections, .HashMap, .Iterator, .List, .Map, .NavigableMap, .TreeMap, javafx.animation.FadeTransition, .Interpolator, .KeyFrame, .KeyValue, .Timeline, javafx.beans.NamedArg, javafx.beans.property.BooleanProperty, .DoubleProperty, .SimpleDoubleProperty, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, javafx.css.CssMetaData, .Styleable, .StyleableBooleanProperty, .StyleableProperty, javafx.css.converter.BooleanConverter, javafx.scene.AccessibleRole, .Group, .Node, javafx.scene.layout.StackPane, javafx.scene.shape.ClosePath, .LineTo, .MoveTo, .Path, .StrokeLineJoin, javafx.util.Duration, com.sun.javafx.charts.Legend.LegendItem

StackedAreaChart is a variation of AreaChart that displays trends of the contribution of each value. (over time e.g.) The areas are stacked so that each series adjoins but does not overlap the preceding series. This contrasts with the Area chart where each series overlays the preceding series. The cumulative nature of the StackedAreaChart gives an idea of the total Y data value at any given point along the X axis. Since data points across multiple series may not be common, StackedAreaChart interpolates values along the line joining the data points whenever necessary.
Since
JavaFX 2.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static enum
private static class

Field Summary

Modifier and TypeField and Description
private BooleanProperty
createSymbols

When true, CSS styleable symbols are created for any data items that don't have a symbol node specified.

private Map<XYChart.Series<X, Y>, DoubleProperty>
seriesYMultiplierMap

A multiplier for teh Y values that we store for each series, it is used to animate in a new series

private Timeline
Inherited from javafx.scene.chart.XYChart:
DEFAULT_COLORseriesColorMap

Constructor Summary

AccessConstructor and Description
public
StackedAreaChart(Axis<X>
The x axis to use
xAxis
,
Axis<Y>
The y axis to use
yAxis
)

Construct a new Area Chart with the given axis

public
StackedAreaChart(Axis<X>
The x axis to use
xAxis
,
Axis<Y>
The y axis to use
yAxis
,
ObservableList<XYChart.Series<X, Y>>
The data to use, this is the actual list used so any changes to it will be reflected in the chart
data
)

Construct a new Area Chart with the given axis and data.

Method Summary

Modifier and TypeMethod and Description
private void
addDropDown(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> currentSeriesData, XYChart.Data<X, Y> item, X xValue, Y yValue, double x, double y)

private void
addPoint(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> currentSeriesData, XYChart.Data<X, Y> item, X xValue, Y yValue, double x, double y, StackedAreaChart.PartOf partof, boolean symbol, boolean lineTo)

pack-priv Legend.LegendItem
createLegendItemForSeries(XYChart.Series<X, Y> series, int seriesIndex)

Overrides javafx.scene.chart.XYChart.createLegendItemForSeries.

Called by the updateLegend for each series in the chart in order to create new legend item

private Node
createSymbol(XYChart.Series<X, Y> series, int seriesIndex, final XYChart.Data<X, Y> item, int itemIndex)

public final BooleanProperty
protected void
dataItemAdded(XYChart.Series<X, Y> series, int itemIndex, XYChart.Data<X, Y> item)

Implements abstract javafx.scene.chart.XYChart.dataItemAdded.

Called when a data item has been added to a series.

protected void
dataItemChanged(XYChart.Data<X, Y> item)

Implements abstract javafx.scene.chart.XYChart.dataItemChanged.

Called when a data item has changed, ie its xValue, yValue or extraValue has changed.

protected void
dataItemRemoved(final XYChart.Data<X, Y> item, final XYChart.Series<X, Y> series)

Implements abstract javafx.scene.chart.XYChart.dataItemRemoved.

Called when a data item has been removed from data model but it is still visible on the chart.

private static double
private static double
doubleValue(Number number, double nullDefault)

private int
private int
private int
private int
public static List<CssMetaData<? extends Styleable, ?>>

Returns:

the CssMetaData
getClassCssMetaData
()

Hides javafx.scene.chart.XYChart.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public final boolean

Returns:

true if symbols for data points will be created and false otherwise.
getCreateSymbols
()

Indicates whether symbols for data points will be created or not.

public List<CssMetaData<? extends Styleable, ?>>
getCssMetaData()

Overrides javafx.scene.chart.XYChart.getCssMetaData.

Implements javafx.css.Styleable.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

private double
interpolate(double lowX, double lowY, double highX, double highY, double x)

protected void
layoutPlotChildren()

Implements abstract javafx.scene.chart.XYChart.layoutPlotChildren.

Called to update and layout the plot children.

protected void
seriesAdded(XYChart.Series<X, Y> series, int seriesIndex)

Implements abstract javafx.scene.chart.XYChart.seriesAdded.

A series has been added to the charts data model.

pack-priv void
seriesBeingRemovedIsAdded(XYChart.Series<X, Y> series)

Overrides javafx.scene.chart.XYChart.seriesBeingRemovedIsAdded.

This method is called when there is an attempt to add series that was set to be removed, and the removal might not have completed.

protected void
seriesChanged(ListChangeListener.Change<? extends XYChart.Series<X, Y>> c)

Overrides javafx.scene.chart.XYChart.seriesChanged.

Called when each atomic change is made to the list of series for this chart

protected void
seriesRemoved(final XYChart.Series<X, Y> series)

Implements abstract javafx.scene.chart.XYChart.seriesRemoved.

A series has been removed from the data model but it is still visible on the chart.

public final void
setCreateSymbols(boolean value)

private void
protected void
updateAxisRange()

Overrides javafx.scene.chart.XYChart.updateAxisRange.

This is called when the range has been invalidated and we need to update it.

Inherited from javafx.scene.chart.XYChart:
alternativeColumnFillVisiblePropertyalternativeRowFillVisiblePropertycreateSeriesRemoveTimeLinecurrentDisplayedExtraValuePropertycurrentDisplayedXValuePropertycurrentDisplayedYValuePropertydataBeingRemovedIsAddeddataPropertygetCurrentDisplayedExtraValuegetCurrentDisplayedXValuegetCurrentDisplayedYValuegetDatagetDataSizegetDisplayedDataIteratorgetDisplayedSeriesIteratorgetPlotChildrengetSeriesIndexgetSeriesSizegetVerticalGridLinesVisiblegetXAxisgetYAxishorizontalGridLinesVisiblePropertyhorizontalZeroLineVisiblePropertyisAlternativeColumnFillVisibleisAlternativeRowFillVisibleisHorizontalGridLinesVisibleisHorizontalZeroLineVisibleisVerticalZeroLineVisiblelayoutChartChildrenremoveDataItemFromDisplayremoveSeriesFromDisplaysetAlternativeColumnFillVisiblesetAlternativeRowFillVisiblesetCurrentDisplayedExtraValuesetCurrentDisplayedXValuesetCurrentDisplayedYValuesetDatasetHorizontalGridLinesVisiblesetHorizontalZeroLineVisiblesetSuppressAnimationsetVerticalGridLinesVisiblesetVerticalZeroLineVisibleshouldAnimateupdateLegendupdateSymbolFocusableverticalGridLinesVisiblePropertyverticalZeroLineVisibleProperty

Field Detail

createSymbolsback to summary
private BooleanProperty createSymbols

When true, CSS styleable symbols are created for any data items that don't have a symbol node specified.

Since
JavaFX 8.0
seriesYMultiplierMapback to summary
private Map<XYChart.Series<X, Y>, DoubleProperty> seriesYMultiplierMap

A multiplier for teh Y values that we store for each series, it is used to animate in a new series

timelineback to summary
private Timeline timeline

Constructor Detail

StackedAreaChartback to summary
public StackedAreaChart(Axis<X> xAxis, Axis<Y> yAxis)

Construct a new Area Chart with the given axis

Parameters
xAxis:Axis<X>

The x axis to use

yAxis:Axis<Y>

The y axis to use

StackedAreaChartback to summary
public StackedAreaChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<XYChart.Series<X, Y>> data)

Construct a new Area Chart with the given axis and data.

Note

yAxis must be a ValueAxis, otherwise IllegalArgumentException is thrown.

Parameters
xAxis:Axis<X>

The x axis to use

yAxis:Axis<Y>

The y axis to use

data:ObservableList<XYChart.Series<X, Y>>

The data to use, this is the actual list used so any changes to it will be reflected in the chart

Exceptions
IllegalArgumentException:
if yAxis is not a ValueAxis

Method Detail

addDropDownback to summary
private void addDropDown(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> currentSeriesData, XYChart.Data<X, Y> item, X xValue, Y yValue, double x, double y)
addPointback to summary
private void addPoint(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> currentSeriesData, XYChart.Data<X, Y> item, X xValue, Y yValue, double x, double y, StackedAreaChart.PartOf partof, boolean symbol, boolean lineTo)
createLegendItemForSeriesback to summary
pack-priv Legend.LegendItem createLegendItemForSeries(XYChart.Series<X, Y> series, int seriesIndex)

Overrides javafx.scene.chart.XYChart.createLegendItemForSeries.

Doc from javafx.scene.chart.XYChart.createLegendItemForSeries.

Called by the updateLegend for each series in the chart in order to create new legend item

Annotations
@Override
createSymbolback to summary
private Node createSymbol(XYChart.Series<X, Y> series, int seriesIndex, final XYChart.Data<X, Y> item, int itemIndex)
createSymbolsPropertyback to summary
public final BooleanProperty createSymbolsProperty()
dataItemAddedback to summary
protected void dataItemAdded(XYChart.Series<X, Y> series, int itemIndex, XYChart.Data<X, Y> item)

Implements abstract javafx.scene.chart.XYChart.dataItemAdded.

Doc from javafx.scene.chart.XYChart.dataItemAdded.

Called when a data item has been added to a series. This is where implementations of XYChart can create/add new nodes to getPlotChildren to represent this data item. They also may animate that data add with a fade in or similar if animated = true.

Annotations
@Override
dataItemChangedback to summary
protected void dataItemChanged(XYChart.Data<X, Y> item)

Implements abstract javafx.scene.chart.XYChart.dataItemChanged.

Doc from javafx.scene.chart.XYChart.dataItemChanged.

Called when a data item has changed, ie its xValue, yValue or extraValue has changed.

Annotations
@Override
dataItemRemovedback to summary
protected void dataItemRemoved(final XYChart.Data<X, Y> item, final XYChart.Series<X, Y> series)

Implements abstract javafx.scene.chart.XYChart.dataItemRemoved.

Doc from javafx.scene.chart.XYChart.dataItemRemoved.

Called when a data item has been removed from data model but it is still visible on the chart. Its still visible so that you can handle animation for removing it in this method. After you are done animating the data item you must call removeDataItemFromDisplay() to remove the items node from being displayed on the chart.

Annotations
@Override
doubleValueback to summary
private static double doubleValue(Number number)
doubleValueback to summary
private static double doubleValue(Number number, double nullDefault)
findNextCurrentback to summary
private int findNextCurrent(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> points, int index)
findNextPreviousback to summary
private int findNextPrevious(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> points, int index)
findPreviousCurrentback to summary
private int findPreviousCurrent(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> points, int index)
findPreviousPreviousback to summary
private int findPreviousPrevious(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> points, int index)
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.chart.XYChart.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

Returns:List<CssMetaData<? extends Styleable, ?>>

the CssMetaData

Since
JavaFX 8.0
getCreateSymbolsback to summary
public final boolean getCreateSymbols()

Indicates whether symbols for data points will be created or not.

Returns:boolean

true if symbols for data points will be created and false otherwise.

Since
JavaFX 8.0
getCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getCssMetaData()

Overrides javafx.scene.chart.XYChart.getCssMetaData.

Implements javafx.css.Styleable.getCssMetaData.

Doc from javafx.scene.chart.XYChart.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

Annotations
@Override
Since
JavaFX 8.0
interpolateback to summary
private double interpolate(double lowX, double lowY, double highX, double highY, double x)
layoutPlotChildrenback to summary
protected void layoutPlotChildren()

Implements abstract javafx.scene.chart.XYChart.layoutPlotChildren.

Doc from javafx.scene.chart.XYChart.layoutPlotChildren.

Called to update and layout the plot children. This should include all work to updates nodes representing the plot on top of the axis and grid lines etc. The origin is the top left of the plot area, the plot area with can be got by getting the width of the x axis and its height from the height of the y axis.

Annotations
@Override
seriesAddedback to summary
protected void seriesAdded(XYChart.Series<X, Y> series, int seriesIndex)

Implements abstract javafx.scene.chart.XYChart.seriesAdded.

Doc from javafx.scene.chart.XYChart.seriesAdded.

A series has been added to the charts data model. This is where implementations of XYChart can create/add new nodes to getPlotChildren to represent this series. Also you have to handle adding any data items that are already in the series. You may simply call dataItemAdded() for each one or provide some different animation for a whole series being added.

Annotations
@Override
seriesBeingRemovedIsAddedback to summary
pack-priv void seriesBeingRemovedIsAdded(XYChart.Series<X, Y> series)

Overrides javafx.scene.chart.XYChart.seriesBeingRemovedIsAdded.

Doc from javafx.scene.chart.XYChart.seriesBeingRemovedIsAdded.

This method is called when there is an attempt to add series that was set to be removed, and the removal might not have completed.

Annotations
@Override
seriesChangedback to summary
protected void seriesChanged(ListChangeListener.Change<? extends XYChart.Series<X, Y>> c)

Overrides javafx.scene.chart.XYChart.seriesChanged.

Doc from javafx.scene.chart.XYChart.seriesChanged.

Called when each atomic change is made to the list of series for this chart

Annotations
@Override
seriesRemovedback to summary
protected void seriesRemoved(final XYChart.Series<X, Y> series)

Implements abstract javafx.scene.chart.XYChart.seriesRemoved.

Doc from javafx.scene.chart.XYChart.seriesRemoved.

A series has been removed from the data model but it is still visible on the chart. Its still visible so that you can handle animation for removing it in this method. After you are done animating the data item you must call removeSeriesFromDisplay() to remove the series from the display list.

Annotations
@Override
setCreateSymbolsback to summary
public final void setCreateSymbols(boolean value)
sortAggregateListback to summary
private void sortAggregateList(ArrayList<StackedAreaChart.DataPointInfo<X, Y>> aggregateList)
updateAxisRangeback to summary
protected void updateAxisRange()

Overrides javafx.scene.chart.XYChart.updateAxisRange.

Doc from javafx.scene.chart.XYChart.updateAxisRange.

This is called when the range has been invalidated and we need to update it. If the axis are auto ranging then we compile a list of all data that the given axis has to plot and call invalidateRange() on the axis passing it that data.

Annotations
@Override
javafx.scene.chart back to summary

pack-priv final Class StackedAreaChart.DataPointInfo<X, Y>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv XYChart.Data<X, Y>
pack-priv double
pack-priv double
pack-priv boolean
pack-priv boolean
pack-priv StackedAreaChart.PartOf
pack-priv boolean
pack-priv X
x

pack-priv Y
y

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
DataPointInfo(XYChart.Data<X, Y> item, X x, Y y, StackedAreaChart.PartOf partOf)

pack-priv
DataPointInfo(boolean dropDown)

Method Summary

Modifier and TypeMethod and Description
public final X
getX()

public final Y
getY()

pack-priv void
setValues(XYChart.Data<X, Y> item, X x, Y y, double dx, double dy, StackedAreaChart.PartOf partOf, boolean skipSymbol, boolean lineTo)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataItemback to summary
pack-priv XYChart.Data<X, Y> dataItem
displayXback to summary
pack-priv double displayX
displayYback to summary
pack-priv double displayY
dropDownback to summary
pack-priv boolean dropDown
lineToback to summary
pack-priv boolean lineTo
partOfback to summary
pack-priv StackedAreaChart.PartOf partOf
skipSymbolback to summary
pack-priv boolean skipSymbol
xback to summary
pack-priv X x
yback to summary
pack-priv Y y

Constructor Detail

DataPointInfoback to summary
pack-priv DataPointInfo()
DataPointInfoback to summary
pack-priv DataPointInfo(XYChart.Data<X, Y> item, X x, Y y, StackedAreaChart.PartOf partOf)
DataPointInfoback to summary
pack-priv DataPointInfo(boolean dropDown)

Method Detail

getXback to summary
public final X getX()
getYback to summary
public final Y getY()
setValuesback to summary
pack-priv void setValues(XYChart.Data<X, Y> item, X x, Y y, double dx, double dy, StackedAreaChart.PartOf partOf, boolean skipSymbol, boolean lineTo)
javafx.scene.chart back to summary

private final Enum StackedAreaChart.PartOf

extends Enum<StackedAreaChart.PartOf>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final StackedAreaChart.PartOf
public static final StackedAreaChart.PartOf

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static StackedAreaChart.PartOf
public static StackedAreaChart.PartOf[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CURRENTback to summary
public static final StackedAreaChart.PartOf CURRENT
PREVIOUSback to summary
public static final StackedAreaChart.PartOf PREVIOUS

Constructor Detail

PartOfback to summary
private PartOf()

Method Detail

valueOfback to summary
public static StackedAreaChart.PartOf valueOf(String name)
valuesback to summary
public static StackedAreaChart.PartOf[] values()
javafx.scene.chart back to summary

private Class StackedAreaChart.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<StackedAreaChart<?, ?>, Boolean>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CREATE_SYMBOLSback to summary
private static final CssMetaData<StackedAreaChart<?, ?>, Boolean> CREATE_SYMBOLS
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()