M
- the data type used by the seriespublic class LineSeries<M> extends ScatterSeries<M>
Creates a Line Chart. A Line Chart is a useful visualization technique to
display quantitative information for different categories or other real
values (as opposed to the BarSeries
), that can show some progression
(or regression) in the data set.
Here is an example line configuration:
LineSeries<Data> series = new LineSeries<Data>();
series.setYAxisPosition(Position.LEFT);
series.setYField(dataAccess.data1());
series.setStroke(new RGB(194,0,36));
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 field is set, which provides the value of each point on the line. The stroke is set to represent the color of the line. Finally the series is added to the chart where it will be displayed.
Series.LabelPosition
coordinates, hidden, markerConfig, max, min, scale, selectionTolerance, xAxisPosition, yAxisPosition, yField
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 |
---|
LineSeries()
Creates a line
Series . |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all the sprites of the series from the surface.
|
protected void |
drawLabels()
Draws the labels on the series.
|
void |
drawSeries()
Draws the series for the current chart.
|
Color |
getFill()
Returns the fill color of the line.
|
SeriesRenderer<M> |
getFillRenderer()
Returns the
SeriesRenderer used on the fill sprite. |
protected int |
getIndex(PrecisePoint point)
Returns the series index from the given point.
|
SeriesHighlighter |
getLineHighlighter() |
SeriesRenderer<M> |
getLineRenderer()
Returns the
SeriesRenderer used on the line sprite. |
double |
getMarkerIndex()
Returns the marker index of the series.
|
int |
getSegments()
Returns the number of segments of the smoothed line.
|
protected int |
getStoreIndex(int index)
Returns the appropriate index on the store for the given series index.
|
void |
hide(int yFieldIndex)
Hides the given y field index from the series.
|
protected void |
hideShadows() |
void |
highlight(int yFieldIndex)
Highlights the series at the given series index.
|
void |
highlightAll(int index)
Highlights all of the items in the series.
|
boolean |
isGapless()
Returns whether the line is drawn over gaps in field.
|
boolean |
isShowMarkers()
Returns whether or not markers are shown.
|
boolean |
isSmooth()
Returns whether or not the line is smoothed or straight.
|
int |
onMouseMove(PrecisePoint point,
Event event)
Method used when the series is moused over.
|
void |
setFill(Color fill)
Sets the fill color of the line.
|
void |
setFillRenderer(SeriesRenderer<M> fillRenderer)
Sets the
SeriesRenderer used on the fill sprite. |
void |
setGapless(boolean gapless)
Sets whether the line is drawn over gaps in field.
|
void |
setLineHighlighter(SeriesHighlighter lineHighlighter) |
void |
setLineRenderer(SeriesRenderer<M> lineRenderer)
Sets the
SeriesRenderer used on the line sprite |
void |
setMarkerIndex(double markerIndex)
Sets the marker index.
|
void |
setSegments(int segments)
Sets the number of segments of the smoothed line.
|
void |
setShowMarkers(boolean showMarkers)
Sets whether or not to show markers.
|
void |
setSmooth(boolean smooth)
Sets whether or not the line is smoothed or straight.
|
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.
|
calculateBounds, drawMarkers, drawShadows, getMarkerConfig, getSelectionTolerance, getTitle, getValueProvider, getXAxisPosition, getYAxisPosition, getYField, setLegendTitle, setMarkerConfig, setSelectionTolerance, setXAxisPosition, setYAxisPosition, setYField, shrink
addSeriesHandler, addSeriesItemOutHandler, addSeriesItemOverHandler, addSeriesItemUpHandler, addSeriesSelectionHandler, calculateBBox, ensureHandlers, getBBox, getChart, getGutters, getHighlighter, getLabelConfig, getLegendNames, getLegendTitles, getPointFromCommand, getRenderer, getShadowRenderer, getStroke, getStrokeWidth, getToolTip, getToolTipConfig, getValueProviderName, getXField, hideAllOtherSeriesTooltips, hideToolTip, highlightedState, isHighlighting, isShownInLegend, onMouseDown, onMouseOut, onMouseUp, removeToolTip, setChart, setHighlighter, setHighlighting, setLabelConfig, setLabelContrast, setLabelText, setRenderer, setShadowRenderer, setShownInLegend, setStroke, setStrokeWidth, setToolTipConfig, setXField, showTooltip
public LineSeries()
Series
.public void clear()
Series
public void drawSeries()
Series
drawSeries
in class ScatterSeries<M>
public Color getFill()
public SeriesRenderer<M> getFillRenderer()
SeriesRenderer
used on the fill sprite.public SeriesHighlighter getLineHighlighter()
public SeriesRenderer<M> getLineRenderer()
SeriesRenderer
used on the line sprite.public double getMarkerIndex()
public int getSegments()
public void hide(int yFieldIndex)
Series
hide
in class ScatterSeries<M>
yFieldIndex
- the index of the y fieldpublic void highlight(int yFieldIndex)
Series
highlight
in class ScatterSeries<M>
yFieldIndex
- the series index to be highlightedpublic void highlightAll(int index)
Series
highlightAll
in class ScatterSeries<M>
index
- the index of the seriespublic boolean isGapless()
public boolean isShowMarkers()
public boolean isSmooth()
public int onMouseMove(PrecisePoint point, Event event)
Series
onMouseMove
in class Series<M>
point
- the point moused overevent
- the event being handledpublic void setFill(Color fill)
fill
- the color of the fillpublic void setFillRenderer(SeriesRenderer<M> fillRenderer)
SeriesRenderer
used on the fill sprite.fillRenderer
- the series renderer used on the fill spritepublic void setGapless(boolean gapless)
setFill(Color)
.gapless
- whether the line is drawn over gaps in fieldpublic void setLineHighlighter(SeriesHighlighter lineHighlighter)
public void setLineRenderer(SeriesRenderer<M> lineRenderer)
SeriesRenderer
used on the line spritelineRenderer
- the series renderer used on the line spritepublic void setMarkerIndex(double markerIndex)
markerIndex
- the marker indexpublic void setSegments(int segments)
setSmooth(boolean)
.segments
- the number of segments of the smoothed linepublic void setShowMarkers(boolean showMarkers)
showMarkers
- whether or not to show markerspublic void setSmooth(boolean smooth)
smooth
- true if smoothpublic void show(int yFieldIndex)
Series
show
in class ScatterSeries<M>
yFieldIndex
- the index of the y fieldpublic void unHighlight(int yFieldIndex)
Series
unHighlight
in class ScatterSeries<M>
yFieldIndex
- the index to have its highlighting removedpublic void unHighlightAll(int index)
Series
unHighlightAll
in class ScatterSeries<M>
index
- the index of the seriespublic boolean visibleInLegend(int index)
Series
visibleInLegend
in class ScatterSeries<M>
index
- the series index to determine visibleprotected void drawLabels()
drawLabels
in class ScatterSeries<M>
protected int getIndex(PrecisePoint point)
Series
getIndex
in class ScatterSeries<M>
point
- the point get the series indexprotected int getStoreIndex(int index)
Series
getStoreIndex
in class ScatterSeries<M>
index
- the series indexprotected void hideShadows()
hideShadows
in class Series<M>
Copyright © 2018. All rights reserved.