M
- the data type used by this seriespublic class AreaSeries<M> extends MultipleColorSeries<M>
Creates a Stacked Area Chart. The stacked area chart is useful when displaying multiple aggregated layers of information.
Here is an example area configuration:
AreaSeries<Data> series = new AreaSeries<Data>();
series.setYAxisPosition(Position.LEFT);
series.addYField(dataAccess.data1());
series.addYField(dataAccess.data2());
series.addYField(dataAccess.data3());
series.addYField(dataAccess.data4());
series.addYField(dataAccess.data5());
series.addYField(dataAccess.data6());
series.addYField(dataAccess.data7());
series.addColor(new RGB(148, 174, 10));
series.addColor(new RGB(17, 95, 166));
series.addColor(new RGB(166, 17, 32));
series.addColor(new RGB(255, 136, 9));
series.addColor(new RGB(255, 209, 62));
series.addColor(new RGB(166, 17, 135));
series.addColor(new RGB(36, 173, 154));
chart.addSeries(series);
First the series is created with its associated data type. The y-axis position is set to tell the series the scale of the displayed axis. Otherwise the series will use its own internal scale. Next the value provider fields are added, which represent each layer of the area. A color is also added to represent each field in the area. Finally the series is added to the chart where it will be displayed.
Series.LabelPosition
colors
bbox, chart, handlerManager, highlighter, highlighting, labelConfig, labels, lastDisplayedTooltipIndex, lastHighlighted, legendNames, legendTitles, renderer, shadowAttributes, shadowed, shadowGroups, shadowRenderer, shownInLegend, sprites, stroke, strokeWidth, toolTip, toolTipConfig, xField
Constructor and Description |
---|
AreaSeries()
Creates an area
Series . |
Modifier and Type | Method and Description |
---|---|
void |
addYField(int index,
ValueProvider<? super M,? extends Number> yField)
Adds a data field for the y axis of the series.
|
void |
addYField(ValueProvider<? super M,? extends Number> yField)
Adds a data field for the y axis of the series.
|
void |
drawSeries()
Draws the series for the current chart.
|
Set<Integer> |
getExcluded()
Returns the fields that have been hidden from the series using
hide(int) . |
PathSprite |
getHighlightLineConfig()
Returns the configuration sprite for the highlighting line.
|
protected int |
getIndex(PrecisePoint point)
Returns the series index from the given point.
|
ArrayList<String> |
getLegendTitles()
Returns the list of titles used in the legend of the series.
|
protected int |
getStoreIndex(int index)
Returns the appropriate index on the store for the given series index.
|
protected ValueProvider<? super M,? extends Number> |
getValueProvider(int index)
Returns the value at the given series index.
|
Chart.Position |
getXAxisPosition()
Returns the x axis position of the series.
|
Chart.Position |
getYAxisPosition()
Returns the y axis position of the series.
|
ValueProvider<? super M,? extends Number> |
getYField(int index)
Returns the value provider for the y-axis of the series at the given index.
|
List<ValueProvider<? super M,? extends Number>> |
getYFields()
Returns the list of value providers for the y-axis of the series.
|
void |
hide(int yFieldIndex)
Hides the given y field index from the series.
|
void |
highlight(int yFieldIndex)
Highlights the series at the given series index.
|
void |
highlightAll(int index)
Highlights all of the items in the series.
|
ValueProvider<? super M,? extends Number> |
removeYField(int index)
Removes a data field for the y axis of the series.
|
boolean |
removeYField(ValueProvider<? super M,? extends Number> yField)
Removes a data field for the y axis of the series.
|
void |
setHighlightLineConfig(PathSprite highlightLineConfig)
Sets the configuration sprite for the highlighting line.
|
void |
setLegendTitles(List<String> legendTitles)
Sets the list of labels used by the legend.
|
void |
setXAxisPosition(Chart.Position xAxisPosition)
Sets the position of the x axis on the chart to be used by the series.
|
void |
setYAxisPosition(Chart.Position yAxisPosition)
Sets the position of the y axis on the chart to be used by the series.
|
void |
show(int yFieldIndex)
Shows the given y field index from the series.
|
void |
unHighlight(int yFieldIndex)
Removes highlighting from the given series index.
|
void |
unHighlightAll(int index)
UnHighlights all items in the series.
|
boolean |
visibleInLegend(int index)
Returns whether or not the given series index is visible in legend.
|
addColor, addColor, getColor, getColors, removeColor, removeColor, setColor
addSeriesHandler, addSeriesItemOutHandler, addSeriesItemOverHandler, addSeriesItemUpHandler, addSeriesSelectionHandler, calculateBBox, clear, ensureHandlers, getBBox, getChart, getGutters, getHighlighter, getLabelConfig, getLegendNames, getPointFromCommand, getRenderer, getShadowRenderer, getStroke, getStrokeWidth, getToolTip, getToolTipConfig, getValueProviderName, getXField, hideAllOtherSeriesTooltips, hideShadows, hideToolTip, highlightedState, isHighlighting, isShownInLegend, onMouseDown, onMouseMove, onMouseOut, onMouseUp, removeToolTip, setChart, setHighlighter, setHighlighting, setLabelConfig, setLabelContrast, setLabelText, setRenderer, setShadowRenderer, setShownInLegend, setStroke, setStrokeWidth, setToolTipConfig, setXField, showTooltip
public AreaSeries()
Series
.public void addYField(int index, ValueProvider<? super M,? extends Number> yField)
index
- the index to have the yField insertedyField
- the value provider for the data on the y axispublic void addYField(ValueProvider<? super M,? extends Number> yField)
yField
- the value provider for the data on the y axispublic void drawSeries()
Series
drawSeries
in class Series<M>
public Set<Integer> getExcluded()
hide(int)
.public PathSprite getHighlightLineConfig()
public ArrayList<String> getLegendTitles()
Series
getLegendTitles
in class Series<M>
public Chart.Position getXAxisPosition()
public Chart.Position getYAxisPosition()
public ValueProvider<? super M,? extends Number> getYField(int index)
index
- the index of the value providerpublic List<ValueProvider<? super M,? extends Number>> getYFields()
public void hide(int yFieldIndex)
Series
public void highlight(int yFieldIndex)
Series
public void highlightAll(int index)
Series
highlightAll
in class Series<M>
index
- the index of the seriespublic ValueProvider<? super M,? extends Number> removeYField(int index)
index
- the index of the data field to removepublic boolean removeYField(ValueProvider<? super M,? extends Number> yField)
yField
- the value provider for the data on the y axispublic void setHighlightLineConfig(PathSprite highlightLineConfig)
highlightLineConfig
- the configuration sprite for the highlighting
linepublic void setLegendTitles(List<String> legendTitles)
legendTitles
- the list of labelspublic void setXAxisPosition(Chart.Position xAxisPosition)
xAxisPosition
- the position of the x axis on the chart to be used by
the seriespublic void setYAxisPosition(Chart.Position yAxisPosition)
yAxisPosition
- the position of the y axis on the chart to be used by
the seriespublic void show(int yFieldIndex)
Series
public void unHighlight(int yFieldIndex)
Series
unHighlight
in class Series<M>
yFieldIndex
- the index to have its highlighting removedpublic void unHighlightAll(int index)
Series
unHighlightAll
in class Series<M>
index
- the index of the seriespublic boolean visibleInLegend(int index)
Series
visibleInLegend
in class Series<M>
index
- the series index to determine visibleprotected int getIndex(PrecisePoint point)
Series
protected int getStoreIndex(int index)
Series
getStoreIndex
in class Series<M>
index
- the series indexprotected ValueProvider<? super M,? extends Number> getValueProvider(int index)
Series
getValueProvider
in class Series<M>
index
- the series indexCopyright © 2018. All rights reserved.