public abstract class XYChart<X,Y> extends Chart
It is possible to install Tooltips on data items / symbols. For example the following code snippet installs Tooltip on the 1st data item.
XYChart.Data item = ( XYChart.Data)series.getData().get(0);
Tooltip.install(item.getNode(), new Tooltip("Symbol-0"));
Type | Property and Description |
---|---|
BooleanProperty |
alternativeColumnFillVisible
If true then alternative vertical columns will have fills
|
BooleanProperty |
alternativeRowFillVisible
If true then alternative horizontal rows will have fills
|
<any> |
data
XYCharts data
|
BooleanProperty |
horizontalGridLinesVisible
True if horizontal grid lines should be drawn
|
BooleanProperty |
horizontalZeroLineVisible
If this is true and the horizontal axis has both positive and negative values then a additional axis line
will be drawn at the zero point
|
BooleanProperty |
verticalGridLinesVisible
True if vertical grid lines should be drawn
|
BooleanProperty |
verticalZeroLineVisible
If this is true and the vertical axis has both positive and negative values then a additional axis line
will be drawn at the zero point
|
animatedProperty, legendProperty, legendSideProperty, legendVisibleProperty, titleProperty, titleSideProperty
Modifier and Type | Class and Description |
---|---|
static class |
XYChart.Data<X,Y>
A single data item with data for 2 axis charts
|
static class |
XYChart.Series<X,Y>
A named series of data items
|
private static class |
XYChart.StyleableProperties |
Modifier and Type | Field and Description |
---|---|
private BooleanProperty |
alternativeColumnFillVisible
If true then alternative vertical columns will have fills
|
private BooleanProperty |
alternativeRowFillVisible
If true then alternative horizontal rows will have fills
|
private java.util.BitSet |
colorBits |
private <any> |
data
XYCharts data
|
(package private) static java.lang.String |
DEFAULT_COLOR |
private java.util.List<XYChart.Series<X,Y>> |
displayedSeries |
private Path |
horizontalGridLines |
private BooleanProperty |
horizontalGridLinesVisible
True if horizontal grid lines should be drawn
|
private Path |
horizontalRowFill |
private Line |
horizontalZeroLine |
private BooleanProperty |
horizontalZeroLineVisible
If this is true and the horizontal axis has both positive and negative values then a additional axis line
will be drawn at the zero point
|
private Legend |
legend |
private Group |
plotArea |
private Rectangle |
plotAreaClip |
private Region |
plotBackground |
private Group |
plotContent |
private boolean |
rangeValid |
private <any> |
seriesChanged
This is called when a series is added or removed from the chart
|
(package private) java.util.Map<XYChart.Series<X,Y>,java.lang.Integer> |
seriesColorMap |
private Path |
verticalGridLines |
private BooleanProperty |
verticalGridLinesVisible
True if vertical grid lines should be drawn
|
private Path |
verticalRowFill |
private Line |
verticalZeroLine |
private BooleanProperty |
verticalZeroLineVisible
If this is true and the vertical axis has both positive and negative values then a additional axis line
will be drawn at the zero point
|
private Axis<X> |
xAxis |
private Axis<Y> |
yAxis |
useChartContentMirroring
Constructor and Description |
---|
XYChart(Axis<X> xAxis,
Axis<Y> yAxis)
Constructs a XYChart given the two axes.
|
Modifier and Type | Method and Description |
---|---|
BooleanProperty |
alternativeColumnFillVisibleProperty()
If true then alternative vertical columns will have fills
|
BooleanProperty |
alternativeRowFillVisibleProperty()
If true then alternative horizontal rows will have fills
|
(package private) Legend.LegendItem |
createLegendItemForSeries(XYChart.Series<X,Y> series,
int seriesIndex)
Called by the updateLegend for each series in the chart in order to
create new legend item
|
(package private) KeyFrame[] |
createSeriesRemoveTimeLine(XYChart.Series<X,Y> series,
long fadeOutTime)
Creates an array of KeyFrames for fading out nodes representing a series
|
protected <any> |
currentDisplayedExtraValueProperty(XYChart.Data<X,Y> item)
The current displayed extra value property.
|
protected <any> |
currentDisplayedXValueProperty(XYChart.Data<X,Y> item)
The current displayed data value property that is plotted on X axis.
|
protected <any> |
currentDisplayedYValueProperty(XYChart.Data<X,Y> item)
The current displayed data value property that is plotted on Y axis.
|
(package private) void |
dataBeingRemovedIsAdded(XYChart.Data<X,Y> item,
XYChart.Series<X,Y> series)
This method is called when there is an attempt to add a Data item that was
set to be removed, and the removal might not have completed.
|
protected abstract void |
dataItemAdded(XYChart.Series<X,Y> series,
int itemIndex,
XYChart.Data<X,Y> item)
Called when a data item has been added to a series.
|
protected abstract void |
dataItemChanged(XYChart.Data<X,Y> item)
Called when a data item has changed, ie its xValue, yValue or extraValue has changed.
|
protected abstract void |
dataItemRemoved(XYChart.Data<X,Y> item,
XYChart.Series<X,Y> series)
Called when a data item has been removed from data model but it is still visible on the chart.
|
private void |
dataItemsChanged(XYChart.Series<X,Y> series,
java.util.List<XYChart.Data<X,Y>> removed,
int addedFrom,
int addedTo,
boolean permutation) |
<any> |
dataProperty()
XYCharts data
|
private <T> void |
dataValueChanged(XYChart.Data<X,Y> item,
T newValue,
<any> currentValueProperty) |
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<<any>> |
getCssMetaData() |
protected java.lang.Object |
getCurrentDisplayedExtraValue(XYChart.Data<X,Y> item)
The current displayed data extra value.
|
protected X |
getCurrentDisplayedXValue(XYChart.Data<X,Y> item)
The current displayed data value plotted on the X axis.
|
protected Y |
getCurrentDisplayedYValue(XYChart.Data<X,Y> item)
The current displayed data value plotted on the Y axis.
|
<any> |
getData()
Gets the value of the property data.
|
(package private) int |
getDataSize()
Gets the size of the data returning 0 if the data is null
|
protected java.util.Iterator<XYChart.Data<X,Y>> |
getDisplayedDataIterator(XYChart.Series<X,Y> series)
XYChart maintains a list of all items currently displayed this includes all current data + any data items
recently deleted that are in the process of being faded out.
|
protected java.util.Iterator<XYChart.Series<X,Y>> |
getDisplayedSeriesIterator()
XYChart maintains a list of all series currently displayed this includes all current series + any series that
have recently been deleted that are in the process of being faded(animated) out.
|
protected <any> |
getPlotChildren()
Modifiable and observable list of all content in the plot.
|
(package private) int |
getSeriesIndex(XYChart.Series<X,Y> series)
Get the index of the series in the series linked list.
|
(package private) int |
getSeriesSize()
Computes the size of series linked list
|
boolean |
getVerticalGridLinesVisible()
Indicates whether vertical grid lines are visible or not.
|
Axis<X> |
getXAxis()
Get the X axis, by default it is along the bottom of the plot
|
Axis<Y> |
getYAxis()
Get the Y axis, by default it is along the left of the plot
|
BooleanProperty |
horizontalGridLinesVisibleProperty()
True if horizontal grid lines should be drawn
|
BooleanProperty |
horizontalZeroLineVisibleProperty()
If this is true and the horizontal axis has both positive and negative values then a additional axis line
will be drawn at the zero point
|
private void |
invalidateRange()
This is called when a data change has happened that may cause the range to be invalid.
|
boolean |
isAlternativeColumnFillVisible()
Gets the value of the property alternativeColumnFillVisible.
|
boolean |
isAlternativeRowFillVisible()
Gets the value of the property alternativeRowFillVisible.
|
boolean |
isHorizontalGridLinesVisible()
Gets the value of the property horizontalGridLinesVisible.
|
boolean |
isHorizontalZeroLineVisible()
Gets the value of the property horizontalZeroLineVisible.
|
boolean |
isVerticalZeroLineVisible()
Gets the value of the property verticalZeroLineVisible.
|
protected void |
layoutChartChildren(double top,
double left,
double width,
double height)
Called to update and layout the chart children available from getChartChildren()
|
protected abstract void |
layoutPlotChildren()
Called to update and layout the plot children.
|
protected void |
removeDataItemFromDisplay(XYChart.Series<X,Y> series,
XYChart.Data<X,Y> item)
This should be called from dataItemRemoved() when you are finished with any animation for deleting the item from the
chart.
|
protected void |
removeSeriesFromDisplay(XYChart.Series<X,Y> series)
This should be called from seriesRemoved() when you are finished with any animation for deleting the series from
the chart.
|
protected abstract void |
seriesAdded(XYChart.Series<X,Y> series,
int seriesIndex)
A series has been added to the charts data model.
|
(package private) void |
seriesBeingRemovedIsAdded(XYChart.Series<X,Y> series)
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(<any> c)
Called when each atomic change is made to the list of series for this chart
|
private void |
seriesNameChanged()
Called when a series's name has changed
|
protected abstract void |
seriesRemoved(XYChart.Series<X,Y> series)
A series has been removed from the data model but it is still visible on the chart.
|
void |
setAlternativeColumnFillVisible(boolean value)
Sets the value of the property alternativeColumnFillVisible.
|
void |
setAlternativeRowFillVisible(boolean value)
Sets the value of the property alternativeRowFillVisible.
|
protected void |
setCurrentDisplayedExtraValue(XYChart.Data<X,Y> item,
java.lang.Object value)
Set the current displayed data extra value.
|
protected void |
setCurrentDisplayedXValue(XYChart.Data<X,Y> item,
X value)
Set the current displayed data value plotted on X axis.
|
protected void |
setCurrentDisplayedYValue(XYChart.Data<X,Y> item,
Y value)
Set the current displayed data value plotted on Y axis.
|
void |
setData(<any> value)
Sets the value of the property data.
|
void |
setHorizontalGridLinesVisible(boolean value)
Sets the value of the property horizontalGridLinesVisible.
|
void |
setHorizontalZeroLineVisible(boolean value)
Sets the value of the property horizontalZeroLineVisible.
|
void |
setVerticalGridLinesVisible(boolean value)
Sets the value of the property verticalGridLinesVisible.
|
void |
setVerticalZeroLineVisible(boolean value)
Sets the value of the property verticalZeroLineVisible.
|
protected void |
updateAxisRange()
This is called when the range has been invalidated and we need to update it.
|
protected void |
updateLegend()
This is called whenever a series is added or removed and the legend needs to be updated
|
BooleanProperty |
verticalGridLinesVisibleProperty()
True if vertical grid lines should be drawn
|
BooleanProperty |
verticalZeroLineVisibleProperty()
If this is true and the vertical axis has both positive and negative values then a additional axis line
will be drawn at the zero point
|
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 BooleanProperty verticalGridLinesVisibleProperty
public final BooleanProperty horizontalGridLinesVisibleProperty
public final BooleanProperty alternativeColumnFillVisibleProperty
public final BooleanProperty alternativeRowFillVisibleProperty
public final BooleanProperty verticalZeroLineVisibleProperty
public final BooleanProperty horizontalZeroLineVisibleProperty
private final java.util.BitSet colorBits
static java.lang.String DEFAULT_COLOR
final java.util.Map<XYChart.Series<X,Y>,java.lang.Integer> seriesColorMap
private boolean rangeValid
private final Line verticalZeroLine
private final Line horizontalZeroLine
private final Path verticalGridLines
private final Path horizontalGridLines
private final Path horizontalRowFill
private final Path verticalRowFill
private final Region plotBackground
private final Group plotArea
private final Group plotContent
private final Rectangle plotAreaClip
private final java.util.List<XYChart.Series<X,Y>> displayedSeries
private Legend legend
private final <any> seriesChanged
private <any> data
private BooleanProperty verticalGridLinesVisible
private BooleanProperty horizontalGridLinesVisible
private BooleanProperty alternativeColumnFillVisible
private BooleanProperty alternativeRowFillVisible
private BooleanProperty verticalZeroLineVisible
private BooleanProperty horizontalZeroLineVisible
public XYChart(Axis<X> xAxis, Axis<Y> yAxis)
xAxis
- X Axis for this XY chartyAxis
- Y Axis for this XY chartpublic Axis<X> getXAxis()
public Axis<Y> getYAxis()
public final <any> getData()
public final void setData(<any> value)
public final <any> dataProperty()
getData()
,
#setData()
public final boolean getVerticalGridLinesVisible()
verticalGridLinesVisibleProperty()
public final void setVerticalGridLinesVisible(boolean value)
public final BooleanProperty verticalGridLinesVisibleProperty()
public final boolean isHorizontalGridLinesVisible()
public final void setHorizontalGridLinesVisible(boolean value)
public final BooleanProperty horizontalGridLinesVisibleProperty()
public final boolean isAlternativeColumnFillVisible()
public final void setAlternativeColumnFillVisible(boolean value)
public final BooleanProperty alternativeColumnFillVisibleProperty()
public final boolean isAlternativeRowFillVisible()
public final void setAlternativeRowFillVisible(boolean value)
public final BooleanProperty alternativeRowFillVisibleProperty()
public final boolean isVerticalZeroLineVisible()
public final void setVerticalZeroLineVisible(boolean value)
public final BooleanProperty verticalZeroLineVisibleProperty()
public final boolean isHorizontalZeroLineVisible()
public final void setHorizontalZeroLineVisible(boolean value)
public final BooleanProperty horizontalZeroLineVisibleProperty()
protected <any> getPlotChildren()
final int getDataSize()
private void seriesNameChanged()
private void dataItemsChanged(XYChart.Series<X,Y> series, java.util.List<XYChart.Data<X,Y>> removed, int addedFrom, int addedTo, boolean permutation)
private <T> void dataValueChanged(XYChart.Data<X,Y> item, T newValue, <any> currentValueProperty)
protected void updateLegend()
Legend.LegendItem createLegendItemForSeries(XYChart.Series<X,Y> series, int seriesIndex)
series
- the series for this legend itemseriesIndex
- the index of the seriesvoid seriesBeingRemovedIsAdded(XYChart.Series<X,Y> series)
series
- void dataBeingRemovedIsAdded(XYChart.Data<X,Y> item, XYChart.Series<X,Y> series)
data
- protected abstract void dataItemAdded(XYChart.Series<X,Y> series, int itemIndex, XYChart.Data<X,Y> item)
series
- The series the data item was added toitemIndex
- The index of the new item within the seriesitem
- The new data item that was addedprotected abstract void dataItemRemoved(XYChart.Data<X,Y> item, XYChart.Series<X,Y> series)
item
- The item that has been removed from the seriesseries
- The series the item was removed fromprotected abstract void dataItemChanged(XYChart.Data<X,Y> item)
item
- The data item who was changedprotected abstract void seriesAdded(XYChart.Series<X,Y> series, int seriesIndex)
series
- The series that has been addedseriesIndex
- The index of the new seriesprotected abstract void seriesRemoved(XYChart.Series<X,Y> series)
series
- The series that has been removedprotected void seriesChanged(<any> c)
c
- a Change instance representing the changes to the seriesprivate void invalidateRange()
protected void updateAxisRange()
protected abstract void layoutPlotChildren()
protected final void layoutChartChildren(double top, double left, double width, double height)
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 contentwidth
- The width of the area to layout the chart withinheight
- The height of the area to layout the chart withinint getSeriesIndex(XYChart.Series<X,Y> series)
series
- The series to find index forint getSeriesSize()
protected final void removeSeriesFromDisplay(XYChart.Series<X,Y> series)
series
- The series to removeprotected final java.util.Iterator<XYChart.Series<X,Y>> getDisplayedSeriesIterator()
final KeyFrame[] createSeriesRemoveTimeLine(XYChart.Series<X,Y> series, long fadeOutTime)
series
- The series to removefadeOutTime
- Time to fade out, in millisecondsprotected final X getCurrentDisplayedXValue(XYChart.Data<X,Y> item)
item
- The XYChart.Data item from which the current X axis data value is obtainedprotected final void setCurrentDisplayedXValue(XYChart.Data<X,Y> item, X value)
item
- The XYChart.Data item from which the current X axis data value is obtained.value
- The X axis data valuegetCurrentDisplayedXValue(Data)
protected final <any> currentDisplayedXValueProperty(XYChart.Data<X,Y> item)
item
- The XYChart.Data item from which the current X axis data value property object is obtained.getCurrentDisplayedXValue(Data)
protected final Y getCurrentDisplayedYValue(XYChart.Data<X,Y> item)
item
- The XYChart.Data item from which the current Y axis data value is obtainedprotected final void setCurrentDisplayedYValue(XYChart.Data<X,Y> item, Y value)
item
- The XYChart.Data item from which the current Y axis data value is obtained.value
- The Y axis data valuegetCurrentDisplayedYValue(Data)
protected final <any> currentDisplayedYValueProperty(XYChart.Data<X,Y> item)
item
- The XYChart.Data item from which the current Y axis data value property object is obtained.getCurrentDisplayedYValue(Data)
protected final java.lang.Object getCurrentDisplayedExtraValue(XYChart.Data<X,Y> item)
item
- The XYChart.Data item from which the current extra value is obtainedprotected final void setCurrentDisplayedExtraValue(XYChart.Data<X,Y> item, java.lang.Object value)
item
- The XYChart.Data item from which the current extra value is obtained.value
- The extra valuegetCurrentDisplayedExtraValue(Data)
protected final <any> currentDisplayedExtraValueProperty(XYChart.Data<X,Y> item)
item
- The XYChart.Data item from which the current extra value property object is obtained.getCurrentDisplayedExtraValue(Data)
protected final java.util.Iterator<XYChart.Data<X,Y>> getDisplayedDataIterator(XYChart.Series<X,Y> series)
series
- The series to get displayed data forprotected final void removeDataItemFromDisplay(XYChart.Series<X,Y> series, XYChart.Data<X,Y> item)
series
- The series to removeitem
- The item to remove from series's display listpublic static java.util.List<<any>> getClassCssMetaData()
public java.util.List<<any>> getCssMetaData()
getCssMetaData
in class Chart