Summ:  Fields Constr. Methods    Details:  Fields Constr. Methods      Class:  Constants Prev Next
com.artfulbits.aiCharts.Base
Class ChartLegend

java.lang.Object com.artfulbits.aiCharts.Base.ChartLayoutElement com.artfulbits.aiCharts.Base.ChartLegend

Declaration: public final class ChartLegend extends ChartLayoutElement
All Interfaces: ILayout.IElement

 

Represents chart legend class.

 

Since: 1.0

 

 

Fields Summary
static int LAYOUT_AUTO
    
Legend items layout will be determined automatically.
static int LAYOUT_HORIZONTAL
    
Legend items will be rendered horizontally.
static int LAYOUT_VERTICAL
    
Legend items will be rendered vertically.

 

Fields inherited from class: com.artfulbits.aiCharts.Base.ChartLayoutElement
ALIGNMENT_CENTER, ALIGNMENT_FAR, ALIGNMENT_NEAR, ALIGNMENT_STRETCH, DOCK_BOTTOM, DOCK_LEFT, DOCK_RIGHT, DOCK_TOP

 

 

Constructors Summary
ChartLegend()
    
Initializes a new instance of legend with default smart items provider.
ChartLegend(LegendItemsProvider itemsProvider)
    
Initializes a new instance of legend.

 

 

Methods Summary
void draw(Graphics g)
    
Draws the legend on the specified graphics.
Background getBackground()
    
Gets Background object used to draw background of element.
Border getBorder()
    
Gets Border object used to draw border of element.
Font getFont()
    
Gets font of items.
LegendItemsProvider getItemsProvider()
    
Gets legend items provider.
int getLayoutMode()
    
Gets layout mode applied to this legend.
java.lang.String getName()
    
int getTextColor()
    
Gets color of text cells.
void measure(XYDimension inOutSize)
    
Measures the element.
void setBackground(Background background)
    
Sets Background used to draw background of element.
void setBorder(Border border)
    
Sets Border object used to draw border of element.
void setFont(Font font)
    
Sets items font.
void setItemsProvider(LegendItemsProvider provider)
    
Sets legend items provider.
void setLayoutMode(int mode)
    
Sets layout mode applied to this legend.
void setName(java.lang.String name)
    
void setTextColor(int color)
    
Sets color of text cells.

 

Methods inherited from class: com.artfulbits.aiCharts.Base.ChartLayoutElement
getAlignment, getBounds, getDock, getMeasuredHeight, getMeasureWidth, isVisible, layout, setAlignment, setDock, setVisible

 

Methods inherited from class: java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

 

 

 

LAYOUT_VERTICAL

 

public static final int LAYOUT_VERTICAL

 

Legend items will be rendered vertically.

 

Since: 1.0
See also: Constants

 

 

 

LAYOUT_HORIZONTAL

 

public static final int LAYOUT_HORIZONTAL

 

Legend items will be rendered horizontally.

 

Since: 1.0
See also: Constants

 

 

 

LAYOUT_AUTO

 

public static final int LAYOUT_AUTO

 

Legend items layout will be determined automatically.

 

Since: 1.0
See also: Constants

 

 

 

 

ChartLegend

 

public ChartLegend( )

 

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

 

Since: 1.0

 

 

 

ChartLegend

 

public ChartLegend( LegendItemsProvider itemsProvider)

 

Initializes a new instance of legend.

 

Parameters:
itemsProvider-
instance of LegendItemsProvider class that is responsible for legend items generation.

 

Since: 1.0

 

 

 

 

setLayoutMode

 

public void setLayoutMode( int mode)

 

Sets layout mode applied to this legend.

 

Parameters:
mode-
one of LAYOUT_VERTICAL, LAYOUT_HORIZONTAL, LAYOUT_AUTO representing currently applied items layout mode.

 

Since: 1.0

 

 

 

getLayoutMode

 

public int getLayoutMode( )

 

Gets layout mode applied to this legend.

 

Returns:
value of layout mode representing currently applied items layout mode.

 

Since: 1.0
See also: setLayoutMode(int)

 

 

 

setItemsProvider

 

public void setItemsProvider( LegendItemsProvider provider)

 

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

 

Parameters:
provider-
instance of LegendItemsProvider.

 

Since: 1.0

 

 

 

getItemsProvider

 

public LegendItemsProvider getItemsProvider( )

 

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

 

Returns:
instance of LegendItemsProvider.

 

Since: 1.0

 

 

 

getName

 

public java.lang.String getName( )

 

 

 

setName

 

public void setName( java.lang.String name)

 

 

 

setBackground

 

public void setBackground( Background background)

 

Sets Background used to draw background of element.

 

Parameters:
background-
instance of Background class.

 

Since: 1.0

 

 

 

getBackground

 

public Background getBackground( )

 

Gets Background object used to draw background of element.

 

Returns:
instance of Background class.

 

Since: 1.0

 

 

 

getBorder

 

public Border getBorder( )

 

Gets Border object used to draw border of element.

 

Returns:
instance of Border class.

 

Since: 1.0

 

 

 

setBorder

 

public void setBorder( Border border)

 

Sets Border object used to draw border of element.

 

Parameters:
border-
instance of Border class.

 

Since: 1.0

 

 

 

setFont

 

public void setFont( Font font)

 

Sets items font.

 

Parameters:
font-
instance of Font.

 

 

 

getFont

 

public Font getFont( )

 

Gets font of items.

 

Returns:
instance of Font.

 

Since: 1.0

 

 

 

setTextColor

 

public void setTextColor( int color)

 

Sets color of text cells.

 

Parameters:
color-
value of text color.

 

 

 

getTextColor

 

public int getTextColor( )

 

Gets color of text cells.

 

Returns:
color of text.

 

Since: 1.0

 

 

 

measure

 

public void measure( XYDimension inOutSize)

 

[ description from ILayout.IElement.measure(XYDimension) ]
 
Measures the element.

 

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

 

Overrides: ChartLayoutElement.measure(XYDimension)
Implements: ILayout.IElement.measure(XYDimension)

 

 

 

draw

 

public void draw( Graphics g)

 

Draws the legend on the specified graphics.

 

Parameters:
g-
instance of Canvas class.

 

Since: 1.0

 

 

© 2005 - 2010 ArtfulBits. All rights reserved.