public class

Legend

extends LinearLayout
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.LinearLayout
         ↳ com.shinobicontrols.charts.Legend

Class Overview

Series data can be displayed in a legend on a ShinobiChart. The Legend is a View-based object that represents the legend as a visual item on the chart. The legend may appear in a number of preset positions within the chart. The placement of the legend inside or outside the plot area, or on its border, has different effects. See the setPlacement(Placement) for more information. Irrespective of how the plot area behaves, we can anchor the legend to several preset positions in the chart area. See the setPosition(Position) for more information.

Summary

Nested Classes
enum Legend.Placement How the legend is placed on its chart relative to the chart's plot area. 
enum Legend.Position The position of the legend relative to its chart. 
enum Legend.SymbolAlignment The alignment of the symbols representing a Series in the Legend, in relation to the text label for the series title. 
Constants
int ALL Use with setMaxSeriesPerRow(int) to show all series in this legend on the same row.
int VARIABLE Use with setMaxSeriesPerRow(int) to show all series in this legend on the same row when it is in the TOP_CENTER or BOTTOM_CENTER, or to show one series per row when it is in any other position.
[Expand]
Inherited Constants
From class android.widget.LinearLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Methods
int getMaxSeriesPerRow()
Returns the maximum number of series which are shown per row in this legend.
Legend.Placement getPlacement()
Returns where this legend is placed relative to the chart's plot area.
Legend.Position getPosition()
Returns the position of this legend on the chart.
LegendStyle getStyle()
Gets the LegendStyle object that manages the style for this legend.
String getTitle()
Returns the title for this legend.
void setMaxSeriesPerRow(int maxSeriesPerRow)
Sets the maximum number of series which are shown per row in this legend.
void setPlacement(Legend.Placement placement)
Sets where this legend is placed relative to the chart's plot area.
void setPosition(Legend.Position position)
Sets the position of this legend on the chart.
void setStyle(LegendStyle style)
Sets the LegendStyle object that manages the style for this legend.
void setTitle(String title)
Sets the title for this legend.
void setVisibility(int visibility)
[Expand]
Inherited Methods
From class android.widget.LinearLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

Constants

public static final int ALL

Use with setMaxSeriesPerRow(int) to show all series in this legend on the same row.

Constant Value: -1 (0xffffffff)

public static final int VARIABLE

Use with setMaxSeriesPerRow(int) to show all series in this legend on the same row when it is in the TOP_CENTER or BOTTOM_CENTER, or to show one series per row when it is in any other position.

Constant Value: -2 (0xfffffffe)

Public Methods

public int getMaxSeriesPerRow ()

Returns the maximum number of series which are shown per row in this legend.

Returns
  • the maximum number of series which are shown per row in this legend

public Legend.Placement getPlacement ()

Returns where this legend is placed relative to the chart's plot area. The options available are defined by Legend.Placement.

If the legend is drawn outside of the plot area, the plot area will shrink to accommodate the legend without obscuring the chart plot. If the legend is drawn inside the plot area, the plot area will expand as though the legend is not there - with the legend displaying over it.

If the legend is drawn on the plot area border, the plot area will shrink to accommodate half of the legend. In this case, the legend will half overlap with the chart, and half be drawn outside the plot area.

Returns
  • where this legend is placed, relative to the chart's plot area

public Legend.Position getPosition ()

Returns the position of this legend on the chart. The options available are defined by Legend.Position.

Returns
  • the position of this legend on the chart

public LegendStyle getStyle ()

Gets the LegendStyle object that manages the style for this legend. Setting these values will override any values set by the theme. Any changes to properties on the style are not reflected visually until redrawChart() is called.

Returns
  • The legend's style

public String getTitle ()

Returns the title for this legend.

Returns
  • the title for this legend
See Also

public void setMaxSeriesPerRow (int maxSeriesPerRow)

Sets the maximum number of series which are shown per row in this legend.

Parameters
maxSeriesPerRow the maximum number of series to show per row in this legend

public void setPlacement (Legend.Placement placement)

Sets where this legend is placed relative to the chart's plot area. The options available are defined by Legend.Placement.

If the legend is drawn outside of the plot area, the plot area will shrink to accommodate the legend without obscuring the chart plot. If the legend is drawn inside the plot area, the plot area will expand as though the legend is not there - with the legend displaying over it.

If the legend is drawn on the plot area border, the plot area will shrink to accommodate half of the legend. In this case, the legend will half overlap with the chart, and half be drawn outside the plot area.

Parameters
placement where to place this legend, relative to the chart's plot area
See Also

public void setPosition (Legend.Position position)

Sets the position of this legend on the chart. The options available are defined by Legend.Position.

Parameters
position the position at which to set this legend
See Also

public void setStyle (LegendStyle style)

Sets the LegendStyle object that manages the style for this legend. Values in style will override any values set by the theme. The new style is not reflected visually until redrawChart() is called.

Parameters
style The style for this legend.
See Also

public void setTitle (String title)

Sets the title for this legend.

Parameters
title the title for this legend
See Also

public void setVisibility (int visibility)