public final class

ChartLegend

extends ChartLayoutElement
com.artfulbits.aiCharts.Base.ChartLayoutElement
   ↳ com.artfulbits.aiCharts.Base.ChartLegend

Class Overview

Represents chart legend class.

XML Attributes
nameDefines legend name
visibleDefines legend visibility
dockDefines legend dock
backgroundDefines background

Summary

Nested Classes
enum ChartLegend.LayoutMode Represents legend items layout mode. 
Public Constructors
ChartLegend()
Initializes a new instance of legend with default smart items provider.
ChartLegend(String name)
Initializes a new instance of legend with default smart items provider.
ChartLegend(ChartLegendAdapter itemsProvider)
Initializes a new instance of legend.
ChartLegend(String name, ChartLegendAdapter itemsProvider)
Initializes a new instance of legend.
Public Methods
void draw(Canvas canvas)
Draws the legend on the specified canvas.
ChartLegendAdapter getAdapter()
Gets legend items provider.
Drawable getBackDrawable()
Gets the Drawable that is be used to draw the legend.
ChartLegend.LayoutMode getLayoutMode()
Gets layout mode applied to this legend.
String getName()
void getSpacing(Point spacing)
Gets spacing between items.
TextPaint getTextPaint()
Gets paint object used to draw legend's text.
void layout(Rect inOutBounds)
Sets bounds for this element.
void measure(Point inOutSize)
Measures the element.
void setAdapter(ChartLegendAdapter provider)
Sets legend items provider.
void setBackDrawable(Drawable drawable)
Sets the Drawable that will be used to draw the legend.
void setLayoutMode(ChartLegend.LayoutMode mode)
Sets layout mode applied to this legend.
void setName(String name)
void setSpacing(int spacingX, int spacingY)
Sets spacing between items.
void setSpacing(int spacing)
Sets spacing between items.
[Expand]
Inherited Methods
From class com.artfulbits.aiCharts.Base.ChartLayoutElement
From interface com.artfulbits.aiCharts.Base.ILayout.IElement

Public Constructors

public ChartLegend ()

Initializes a new instance of legend with default smart items provider.

public ChartLegend (String name)

Initializes a new instance of legend with default smart items provider.

Parameters
name - legend name

public ChartLegend (ChartLegendAdapter itemsProvider)

Initializes a new instance of legend.

Parameters
itemsProvider instance of ChartLegendAdapter class that is responsible for legend items generation.

public ChartLegend (String name, ChartLegendAdapter itemsProvider)

Initializes a new instance of legend.

Parameters
name - legend name
itemsProvider instance of ChartLegendAdapter class that is responsible for legend items generation.

Public Methods

public void draw (Canvas canvas)

Draws the legend on the specified canvas.

Parameters
canvas instance of Canvas class.

public ChartLegendAdapter getAdapter ()

Gets legend items provider. Legend will use this provider to build its items.

Returns

public Drawable getBackDrawable ()

Gets the Drawable that is be used to draw the legend.

Returns

public ChartLegend.LayoutMode getLayoutMode ()

Gets layout mode applied to this legend.

Returns

public String getName ()

public void getSpacing (Point spacing)

Gets spacing between items.

Parameters
spacing output value to collect spacing

public TextPaint getTextPaint ()

Gets paint object used to draw legend's text.

Returns
  • value of currently applied text paint.

public void layout (Rect inOutBounds)

Sets bounds for this element.

Parameters
inOutBounds instance of Rect representing bounds for element.

public void measure (Point inOutSize)

Measures the element.

Parameters
inOutSize available size to contains the element. This parameter have to be used to return the desired size of element.

public void setAdapter (ChartLegendAdapter provider)

Sets legend items provider. Legend will use this provider to build its items.

Parameters
provider instance of ChartLegendAdapter.

public void setBackDrawable (Drawable drawable)

Sets the Drawable that will be used to draw the legend.

Parameters
drawable instance of Drawable.

public void setLayoutMode (ChartLegend.LayoutMode mode)

Sets layout mode applied to this legend.

Parameters
mode instance of ChartLegend.LayoutMode representing currently applied items layout mode.

public void setName (String name)

public void setSpacing (int spacingX, int spacingY)

Sets spacing between items.

Parameters
spacingX horizontal spacing
spacingY vertical spacing

public void setSpacing (int spacing)

Sets spacing between items.