public abstract class

Series

extends Object
java.lang.Object
   ↳ com.shinobicontrols.charts.Series<T extends com.shinobicontrols.charts.SeriesStyle>
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Abstract base class that represents series displayed on a chart.

Do not attempt to create your own direct subclasses of Series, but if you have a need for advanced customization you should start from one of the concrete series.

Summary

Nested Classes
enum Series.GestureSelectionMode What should be selected when the user taps the chart. 
enum Series.Orientation The orientation of a series  
enum Series.SelectionMode This enum is deprecated. as of version 1.8.3, replaced by Series.GestureSelectionMode  
Constants
int GONE Denotes that this series is invisible and that the ShinobiChart should not leave space for it in the plot area.
int INVISIBLE Denotes that this series is invisible but that the ShinobiChart should still leave space for it in the plot area.
int VISIBLE Denotes that this series is visible.
Public Methods
Animation<Float> createDefaultEntryAnimation()
Creates an entry Animation of the default type, applicable to the type of Series being used.
Animation<Float> createDefaultExitAnimation()
Creates an exit Animation of the default type, applicable to the type of Series being used.
SeriesStyleProvider<T> createDefaultSeriesStyleProvider()
Creates the default SeriesStyleProvider for this Series type.
void enableAnimation(boolean enabled)
This method is deprecated. as of version 1.9.1, use the SeriesAnimator or an Animation with a suitable Animation.Listener to animate a Series instead. Note: it is highly recommended that animations are not enabled for a Series; using the new Animation API will make the Series animate regardless of whether animations are enabled or not, and enabling animations will cause undesirable results
float getAlpha()
Returns the alpha value for this Series which determines its opacity.
final ShinobiChart getChart()
The chart this series is attached to.
final DataAdapter<?, ?> getDataAdapter()
Returns the DataAdapter for this series.
SeriesAnimation getEntryAnimation()
This method is deprecated. as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner
SeriesAnimation getExitAnimation()
This method is deprecated. as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner
Series.GestureSelectionMode getGestureSelectionMode()
Gets the Series.GestureSelectionMode representing what should be selected when the user taps the chart.
Float getPivotX()
Returns the point in the X direction around which this Series is scaled.
Float getPivotY()
Returns the point in the Y direction around which this Series is scaled.
float getScaleX()
Returns the value the Series is scaled in the X direction.
float getScaleY()
Returns the value the Series is scaled in the Y direction.
T getSelectedStyle()
Gets the style settings for this series when it is marked as selected (or a point within it is selected).
Series.SelectionMode getSelectionMode()
Gets the setting for what should be selected when the user taps the chart.
T getStyle()
Gets the style settings for this series.
String getTitle()
Returns the title of this series that is displayed in the legend.
int getVisibility()
Returns the current visibility status of this Series.
final Axis<?, ?> getXAxis()
The X axis this series is attached to.
final Axis<?, ?> getYAxis()
The Y axis this series is attached to.
boolean isAnimating()
This method is deprecated. as of version 1.9.1, the Series has no concept of whether it is animating or not; when using the SeriesAnimator, it can be queried to find out if it is currently animating a specific Series
boolean isAnimationEnabled()
This method is deprecated. as of version 1.9.1, use the SeriesAnimator or an Animation with a suitable Animation.Listener to animate a Series instead. Note: it is highly recommended that animations are not enabled for a Series; using the new Animation API will make the Series animate regardless of whether animations are enabled or not, and enabling animations will cause undesirable results
boolean isHidden()
This method is deprecated. as of version 1.9.1, use getVisibility() instead; note, a hidden series is equivalent to one set to INVISIBLE
boolean isPointSelected(int index)
Determines whether a point in the series is selected.
boolean isSelected()
Whether or not the series is currently selected.
boolean isShownInLegend()
Whether or not the series is represented in the legend
void setAlpha(float alpha)
Sets the opacity of this Series.
final void setDataAdapter(DataAdapter<?, ?> dataAdapter)
Sets the DataAdapter for the series.
void setEntryAnimation(SeriesAnimation seriesAnimation)
This method is deprecated. as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner
void setExitAnimation(SeriesAnimation seriesAnimation)
This method is deprecated. as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner
void setGestureSelectionMode(Series.GestureSelectionMode gestureSelectionMode)
Sets the Series.GestureSelectionMode representing what should be selected when the user taps the chart.
void setHidden(boolean hidden)
This method is deprecated. as of version 1.9.1, use setVisibility(int) instead; note, setting a Series as hidden is equivalent to calling setVisibility(int) with INVISIBLE
void setPivotX(Float pivotX)
Sets the point in the X direction around which this Series is scaled.
void setPivotY(Float pivotY)
Sets the point in the Y direction around which this Series is scaled.
void setPointSelected(boolean selected, int index)
Sets the selection state of a point in the series.
void setScaleX(float scaleX)
Sets the value the Series is scaled in the X direction.
void setScaleY(float scaleY)
Sets the value the Series is scaled in the Y direction.
void setSelected(boolean selected)
Sets whether or not the series is selected, without requiring a user gesture Note that this does not force an immediate chart redraw.
final void setSelectedStyle(T style)
Sets the style for this series when it is marked as selected (or a point within it is selected).
void setSelectionMode(Series.SelectionMode selectionMode)
This method is deprecated. as of version 1.8.3, replaced by setGestureSelectionMode(GestureSelectionMode)
void setShownInLegend(boolean shownInLegend)
Sets whether or not the series should be represented in the legend.
final void setStyle(T style)
Sets the style for this series.
void setTitle(String title)
Sets the title of this series to be displayed in the legend.
void setVisibility(int visibility)
Sets the visibility status for this Series.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int GONE

Denotes that this series is invisible and that the ShinobiChart should not leave space for it in the plot area.

This is a valid value for the getVisibility() and setVisibility(int) methods.

Constant Value: 2 (0x00000002)

public static final int INVISIBLE

Denotes that this series is invisible but that the ShinobiChart should still leave space for it in the plot area.

This is a valid value for the getVisibility() and setVisibility(int) methods.

Constant Value: 1 (0x00000001)

public static final int VISIBLE

Denotes that this series is visible.

This is a valid value for the getVisibility() and setVisibility(int) methods.

Constant Value: 0 (0x00000000)

Public Methods

public Animation<Float> createDefaultEntryAnimation ()

Creates an entry Animation of the default type, applicable to the type of Series being used.

Returns
  • an entry Animation of the default type, applicable to the type of Series being used

public Animation<Float> createDefaultExitAnimation ()

Creates an exit Animation of the default type, applicable to the type of Series being used.

Returns
  • an exit Animation of the default type, applicable to the type of Series being used

public SeriesStyleProvider<T> createDefaultSeriesStyleProvider ()

Creates the default SeriesStyleProvider for this Series type.

Note, currently only the LineSeries, ColumnSeries, BarSeries, CandlestickSeries and OHLCSeries utilize the SeriesStyleProvider. All other Series types return null.

Returns

public void enableAnimation (boolean enabled)

This method is deprecated.
as of version 1.9.1, use the SeriesAnimator or an Animation with a suitable Animation.Listener to animate a Series instead. Note: it is highly recommended that animations are not enabled for a Series; using the new Animation API will make the Series animate regardless of whether animations are enabled or not, and enabling animations will cause undesirable results

Sets whether or not animations are enabled on the series. Note that series must have non-null entry or exit animations in order for them to play

Parameters
enabled Whether or not animations are enabled on the series

public float getAlpha ()

Returns the alpha value for this Series which determines its opacity. The value will be between 0.0 and 1.0 (inclusive) where 0.0 equates to the Series being fully transparent and 1.0 is fully opaque.

By default this is set to 1.0.

Returns
  • the alpha value for this Series which determines its opacity
See Also

public final ShinobiChart getChart ()

The chart this series is attached to.

Returns
  • The chart this series is attached to.

public final DataAdapter<?, ?> getDataAdapter ()

Returns the DataAdapter for this series. It holds all of the series's Data objects and allows values to be added or removed.

Returns
  • The data adapter for this series which holds all of its data points

public SeriesAnimation getEntryAnimation ()

This method is deprecated.
as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner

Gets the animation which may be played when the series is added or shown. Note that animations must be enabled in order to play.

Returns
  • The animation which may be played when the series is added or shown.

public SeriesAnimation getExitAnimation ()

This method is deprecated.
as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner

Gets the animation which may be played when the series is removed or hidden. Note that animations must be enabled in order to play.

Returns
  • The animation which may be played when the series is removed or hidden.

public Series.GestureSelectionMode getGestureSelectionMode ()

Gets the Series.GestureSelectionMode representing what should be selected when the user taps the chart.

Returns

public Float getPivotX ()

Returns the point in the X direction around which this Series is scaled. For CartesianSeries, which have axes, this value is a normalized point along the X-axis, and is normalized with the axis' currently visible range. Note, PieDonutSeries will only ever scale from the center of the plot area.

A pivotX of 0.0 will cause the Series to be scaled from its left-most point. Conversely, a pivotX of 1.0 will cause the Series to be scaled from its right-most point.

The pivotX value may also be null. In this case the Series' baseline is used as the pivot point. This is particularly useful for BarSeries.

Returns
  • the point in the X direction around which this Series is scaled
See Also

public Float getPivotY ()

Returns the point in the Y direction around which this Series is scaled. For CartesianSeries, which have axes, this value is a normalized point along the Y-axis, and is normalized with the axis' currently visible range. Note, PieDonutSeries will only ever scale from the center of the plot area.

A pivotY of 0.0 will cause the Series to be scaled from its bottom-most point. Conversely, a pivotY of 1.0 will cause the Series to be scaled from its top-most point.

The pivotY value may also be null. In this case the Series' baseline is used as the pivot point. This is particularly useful for ColumnSeries.

Returns
  • the point in the Y direction around which this Series is scaled
See Also

public float getScaleX ()

Returns the value the Series is scaled in the X direction. This value is a proportion of the Series' unscaled width. Therefore, a scaleX value of 1.0 will cause the Series to be rendered with no scaling applied.

By default this is set to 1.0.

Note, this scaling has no connection with the associated X-axis; the axis will only consider the unscaled width of the Series.

Returns
  • the amount the Series is scaled in the X direction.
See Also

public float getScaleY ()

Returns the value the Series is scaled in the Y direction. This value is a proportion of the Series' unscaled height. Therefore, a scaleY value of 1.0 will cause the Series to be rendered with no scaling applied.

By default this is set to 1.0.

Note, this scaling has no connection with the associated Y-axis; the axis will only consider the unscaled height of the Series.

Returns
  • the amount the Series is scaled in the Y direction.
See Also

public T getSelectedStyle ()

Gets the style settings for this series when it is marked as selected (or a point within it is selected). Override any default settings or theme settings on a per series basis by editing the values in these style objects. Any changes to properties on the style are not reflected visually until redrawChart() is called.

Returns
  • The style settings for this series when it is selected

public Series.SelectionMode getSelectionMode ()

Gets the setting for what should be selected when the user taps the chart.

Returns
  • The setting for what should be selected when the user taps the chart.

public T getStyle ()

Gets the style settings for this series. Override any default settings or theme settings on a per series basis by editing the values in these style objects. Any changes to properties on the style are not reflected visually until redrawChart() is called.

Returns
  • The style settings for this series.

public String getTitle ()

Returns the title of this series that is displayed in the legend.

Returns
  • the title of this series that is displayed in the legend
See Also

public int getVisibility ()

Returns the current visibility status of this Series. One of VISIBLE, INVISIBLE and GONE.

Returns
  • the current visibility status of this Series

public final Axis<?, ?> getXAxis ()

The X axis this series is attached to.

Returns
  • The X axis this series is attached to.

public final Axis<?, ?> getYAxis ()

The Y axis this series is attached to.

Returns
  • The Y axis this series is attached to.

public boolean isAnimating ()

This method is deprecated.
as of version 1.9.1, the Series has no concept of whether it is animating or not; when using the SeriesAnimator, it can be queried to find out if it is currently animating a specific Series

Whether the series is currently doing an entry/exit animation.

Returns
  • Whether the series is currently doing an entry/exit animation.

public boolean isAnimationEnabled ()

This method is deprecated.
as of version 1.9.1, use the SeriesAnimator or an Animation with a suitable Animation.Listener to animate a Series instead. Note: it is highly recommended that animations are not enabled for a Series; using the new Animation API will make the Series animate regardless of whether animations are enabled or not, and enabling animations will cause undesirable results

Whether or not the animations are enabled on the series. Note that series must have non-null entry or exit animations in order for them to play.

Returns
  • Whether or not animations are enabled on the series.

public boolean isHidden ()

This method is deprecated.
as of version 1.9.1, use getVisibility() instead; note, a hidden series is equivalent to one set to INVISIBLE

Whether or not the series is currently hidden. When hidden, the Series will still take up space on the chart but will not be displayed.

Note: for the old, now deprecated Animation API, it is possible that the series may be in the process of animating in or out. If this is the case isHidden() will only report true when the animation has finished.

Returns
  • whether or not the series is hidden

public boolean isPointSelected (int index)

Determines whether a point in the series is selected.

The given index refers to the index of the point in the list returned by getDataPointsForDisplay() rather than the indices of the points directly added to the DataAdapter. In most cases these will be the same but for certain scenarios, such as sampling for example, they may differ.

Querying for the selection status of an index that does not exist in the data points list will return false.

Parameters
index the index of the point in the list returned by getDataPointsForDisplay()
Returns
  • whether the point at the given index is selected

public boolean isSelected ()

Whether or not the series is currently selected. This method currently only has meaning for cartesian series.

Returns
  • Whether or not the series is selected

public boolean isShownInLegend ()

Whether or not the series is represented in the legend

Returns
  • whether or not the series is represented in the legend

public void setAlpha (float alpha)

Sets the opacity of this Series. The alpha value should be between 0.0 and 1.0 (inclusive) where 0.0 equates to the Series being fully transparent and 1.0 is fully opaque.

Values less than 0.0 will be coerced to 0.0. Similarly values greater than 1.0 will be coerced to 1.0.

Parameters
alpha the alpha value to apply to this Series which determines its opacity
See Also

public final void setDataAdapter (DataAdapter<?, ?> dataAdapter)

Sets the DataAdapter for the series. This is created independently from, and holds all of the data for, a series. A series must be given a data adapter in order to be displayed on a chart. The DataAdapter cannot be set to null; trying to set a null DataAdapter will result in an java.lang.IllegalArgumentException being thrown.

Parameters
dataAdapter The data adapter to set for this series, cannot be null
See Also

public void setEntryAnimation (SeriesAnimation seriesAnimation)

This method is deprecated.
as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner

Sets the animation which may be played when the series is added or shown. Note that animations must be enabled in order to play.

Parameters
seriesAnimation The animation which may be played when the series is removed or hidden.

public void setExitAnimation (SeriesAnimation seriesAnimation)

This method is deprecated.
as of version 1.9.1, use the new Animation API instead - see SeriesAnimator, SeriesAnimationCreator, Animation, Animation.Listener and AnimationRunner

Sets the animation which may be played when the series is removed or hidden. Note that animations must be enabled in order to play.

Parameters
seriesAnimation The animation which may be played when the series is removed or hidden.

public void setGestureSelectionMode (Series.GestureSelectionMode gestureSelectionMode)

Sets the Series.GestureSelectionMode representing what should be selected when the user taps the chart.

Parameters
gestureSelectionMode the Series.GestureSelectionMode representing what should be selected when the user taps the chart

public void setHidden (boolean hidden)

This method is deprecated.
as of version 1.9.1, use setVisibility(int) instead; note, setting a Series as hidden is equivalent to calling setVisibility(int) with INVISIBLE

Sets whether or not the series is hidden or shown. When hidden, the Series will still take up space on the chart but will not be displayed.

Note: for the old, now deprecated Animation API, this method may trigger an entry or exit animation, if animation is enabled on this series.

If animation is enabled and the Series is currently animating, any subsequent calls to this method will be ignored. To be notified of the end of a Series' animation you can use the ShinobiChart.OnSeriesAnimationListener callback interface.

If the series is stacked, then all other series with the same stackId will first animate out before the change takes place, and afterwards will all animate back in. To show or hide a number of Series at the same time use setHidden(List, boolean).

Also note that if the series has animations enabled, it will not actually be hidden until the animation has finished.

Parameters
hidden whether or not the series is to be hidden

public void setPivotX (Float pivotX)

Sets the point in the X direction around which this Series is scaled. For CartesianSeries, which have axes, this value is a normalized point along the X-axis, and is normalized with the axis' currently visible range. Note, PieDonutSeries will only ever scale from the center of the plot area.

A pivotX of 0.0 will cause the Series to be scaled from its left-most point. Conversely, a pivotX of 1.0 will cause the Series to be scaled from its right-most point.

The pivotX value may also be null. In this case the Series' baseline is used as the pivot point. This is particularly useful for BarSeries.

Parameters
pivotX the point in the X direction around which this Series is scaled
See Also

public void setPivotY (Float pivotY)

Sets the point in the Y direction around which this Series is scaled. For CartesianSeries, which have axes, this value is a normalized point along the Y-axis, and is normalized with the axis' currently visible range. Note, PieDonutSeries will only ever scale from the center of the plot area.

A pivotY of 0.0 will cause the Series to be scaled from its bottom-most point. Conversely, a pivotY of 1.0 will cause the Series to be scaled from its top-most point.

The pivotY value may also be null. In this case the Series' baseline is used as the pivot point. This is particularly useful for ColumnSeries.

Parameters
pivotY the point in the Y direction around which this Series is scaled
See Also

public void setPointSelected (boolean selected, int index)

Sets the selection state of a point in the series.

The given index refers to the index of the point in the list returned by getDataPointsForDisplay() rather than the indices of the points directly added to the DataAdapter. In most cases these will be the same but for certain scenarios, such as sampling for example, they may differ.

Attempting to select or deselect an index that does not exist in the data points list will be ignored.

Note that this does not force an immediate chart redraw. If you require one, call it explicitly. Note also, that this method overrides the selection mode.

Parameters
selected whether the point should be selected
index the index of the point in the list returned by getDataPointsForDisplay()

public void setScaleX (float scaleX)

Sets the value the Series is scaled in the X direction. This value is a proportion of the Series' unscaled width. Therefore, a scaleX value of 1.0 will cause the Series to be rendered with no scaling applied.

Note, this scaling has no connection with the associated X-axis; the axis will only consider the unscaled width of the Series.

Parameters
scaleX the amount to scale the Series in the X direction.
See Also

public void setScaleY (float scaleY)

Sets the value the Series is scaled in the Y direction. This value is a proportion of the Series' unscaled height. Therefore, a scaleY value of 1.0 will cause the Series to be rendered with no scaling applied.

Note, this scaling has no connection with the associated Y-axis; the axis will only consider the unscaled height of the Series.

Parameters
scaleY the amount to scale the Series in the Y direction.
See Also

public void setSelected (boolean selected)

Sets whether or not the series is selected, without requiring a user gesture Note that this does not force an immediate chart redraw. If you require one, call it explicitly. Note also, that this method overrides the selection mode. This method currently only has meaning for cartesian series.

Parameters
selected Whether or not the series is to be selected
See Also

public final void setSelectedStyle (T style)

Sets the style for this series when it is marked as selected (or a point within it is selected). Override any default settings or theme settings on a per series basis by editing the values in these style objects. The new style is not reflected visually until redrawChart() is called.

Parameters
style The object containing the style settings for this series when it is selected

public void setSelectionMode (Series.SelectionMode selectionMode)

This method is deprecated.
as of version 1.8.3, replaced by setGestureSelectionMode(GestureSelectionMode)

Sets what should be selected when the user taps the chart.

Parameters
selectionMode The setting for what should be selected when the user taps the chart.

public void setShownInLegend (boolean shownInLegend)

Sets whether or not the series should be represented in the legend.

Parameters
shownInLegend whether or not the series should be represented in the legend

public final void setStyle (T style)

Sets the style for this series. Override any default settings or theme settings on a per series basis by editing the values in these style objects. The new style is not reflected visually until redrawChart() is called.

Parameters
style The object containing the style settings for this series
See Also

public void setTitle (String title)

Sets the title of this series to be displayed in the legend.

Parameters
title the title of this series to be displayed in the legend

public void setVisibility (int visibility)

Sets the visibility status for this Series. Valid values are:

VISIBLE
Denotes that this series is visible.
INVISIBLE
Denotes that this series is invisible but that the ShinobiChart should still leave space for it in the plot area.
GONE
Denotes that this series is invisible and that the ShinobiChart should not leave space for it in the plot area.

Parameters
visibility the visibility status to set for the Series