org.swtchart
Interface ILegend

All Known Implementing Classes:
Legend

public interface ILegend

A legend for chart.


Method Summary
 Color getBackground()
          Gets the background color of legend.
 Rectangle getBounds(java.lang.String seriesId)
          Gets the rectangle associated with the given series id on legend.
 Font getFont()
          Gets the font.
 Color getForeground()
          Gets the foreground color of legend.
 int getPosition()
          Gets the position of legend.
 boolean isVisible()
          Gets the visibility state.
 void setBackground(Color color)
          Sets the background color of legend.
 void setFont(Font font)
          Sets the font.
 void setForeground(Color color)
          Sets the foreground color of legend.
 void setPosition(int position)
          Sets the position of legend.
 void setVisible(boolean visible)
          Sets legend visible.
 

Method Detail

setVisible

void setVisible(boolean visible)
Sets legend visible.

Parameters:
visible - the visibility state

isVisible

boolean isVisible()
Gets the visibility state.

Returns:
true if legend is visible

setBackground

void setBackground(Color color)
Sets the background color of legend.

Parameters:
color - the background color

getBackground

Color getBackground()
Gets the background color of legend.

Returns:
background color of legend.

setForeground

void setForeground(Color color)
Sets the foreground color of legend.

Parameters:
color - the foreground color

getForeground

Color getForeground()
Gets the foreground color of legend.

Returns:
foreground color of legend.

getFont

Font getFont()
Gets the font.

Returns:
the font

setFont

void setFont(Font font)
Sets the font.

Parameters:
font - the font

getPosition

int getPosition()
Gets the position of legend.

Returns:
the position of legend.

setPosition

void setPosition(int position)
Sets the position of legend. If the position is SWT.LEFT or SWT.RIGHT, the orientation of series on legend will be vertical. If the position is SWT.TOP or SWT.BOTTOM, the orientation will be horizontal.

Parameters:
position - the position of legend that can be SWT.LEFT, SWT.RIGHT, SWT.TOP or SWT.BOTTOM.

getBounds

Rectangle getBounds(java.lang.String seriesId)
Gets the rectangle associated with the given series id on legend. This method is typically used for mouse listener to check whether mouse cursor is on legend for a certain series.

Mouse listener can be added by casting ILegend to Control.

 Control legend = (Control) chart.getLegend();
 legend.addMouseListener(...);
 

Parameters:
seriesId - the series id
Returns:
the rectangle associated with the given series id in pixels.