public class Legend extends TextShapePosition
Title: Legend class
Description: Accesses all Chart Legend characteristics
Copyright (c) 2005-2019 by Steema Software SL. All Rights Reserved.
Company: Steema Software SL
Modifier and Type | Field and Description |
---|---|
protected boolean |
columnWidthAuto |
protected int[] |
columnWidths |
protected int |
firstValue |
protected int |
iLastValue |
LegendStyle |
iLegendStyle |
bCustomPosition
defaultText, drawText
bBevel, bBorderRound, bBrush, bImageBevel, bTransparent, defaultVisible, pPen, shadow, shapeBounds, visible
chart, InternalUse
Constructor and Description |
---|
Legend(IBaseChart c) |
Modifier and Type | Method and Description |
---|---|
protected int |
calcItemHeight() |
int |
clicked(int x,
int y)
Returns the index of the clicked Legend Point.
|
int |
clicked(Point p)
Returns the index of the clicked Legend Point.
|
boolean |
doMouseDown(Point p) |
protected boolean |
drawTitle() |
java.lang.String |
formattedLegend(int seriesOrValueIndex)
Returns the text string corresponding to a Legend position.
The Legend position depends on Legend.LegendStyle. |
java.lang.String |
formattedValue(Series aSeries,
int valueIndex)
Returns the corresponding Legend text for the Series ValueIndex point.
|
LegendAlignment |
getAlignment()
Defines the Legend position.
Legend can be currently placed at Top, Left, Right and Bottom side of Chart. |
boolean |
getCheckBoxes()
Enables/Disables the display of Legend check boxes.
Default value: false |
int |
getColorWidth() |
int |
getColumnWidth(int column) |
boolean |
getColumnWidthAuto()
Automatically calculates best fit of legend columns.
When set to true, columnWidths control the legend width Default value: true |
boolean |
getCurrentPage()
Determines whether or not the Legend shows only the current page iItems
when the Chart is divided into pages.
Default value: true |
ChartPen |
getDividingLines()
Specifies the Pen attributes used to draw lines separating Legend iItems.
|
int |
getFirstValue()
Defines which is the first Legend item displayed.
Legend can display all active Series names or all points of a single Series. |
boolean |
getFontSeriesColor()
The legend text font color to that of the Series color.
Default value: false |
int |
getHorizMargin()
Speficies the number of screen pixels between Legend and Chart
rectangles.
By default it is 0, meaning Legend will calculate a predefined margin based on total Legend width. |
boolean |
getInverted()
Draws the Legend iItems in opposite direction when true.
Legend strings are displayed starting at top for Left and Right Aligment and starting at left for Top and Bottom Legend orientations. |
int |
getLastValue()
Returns the index of the first displayed value at legend.
|
LegendItems |
getLegendItems() |
LegendStyle |
getLegendStyle()
Defines which iItems will be displayed in the Chart Legend.
|
java.lang.String[] |
getLines()
Accesses the array of Text lines.
Use lines to add multiline text to TeeChart's text objects (TeeChart Header, TeeChart Axis Titles etc.). |
int |
getMaxNumRows()
The Maximum number of Legend Rows displayed for a horizontal Legend
(Chart Top or Bottom).
Default value: 10 |
boolean |
getResizeChart()
Automatically resizes Chart rectangle to prevent overlap with Legend.
When set to true, Legend.HorizMargin and Legend.VertMargin control the amount of pixels by which the Chart rectangle will be reduced. |
Series |
getSeries()
Determines which series is used as data for the Legend entries.
By default, the Legend chooses the first Active Series with ShowInLegend:=true. |
LegendSymbol |
getSymbol()
Controls the width and position of the color rectangle associated with
each Legend's item.
|
java.lang.String |
getText()
Adds text to the Legend.
|
LegendTextStyle |
getTextStyle()
Determines how Legend text iItems will be formatted.
Plain shows the point Label only. LeftValue shows the point Value and the point Label. |
int |
getTextSymbolGap() |
LegendTitle |
getTitle()
Sets the Title text and its characteristics at the top of the legend
|
int |
getTopLeftPos()
Specifies the Legend's top position in percent of total chart height.
It's used when Legend.Alignment is Left or Right only. |
boolean |
getUseMaxWidth() |
boolean |
getVertical()
Is read only and returns true only if the legend is left or right
aligned.
|
int |
getVertMargin()
The vertical margin in pixels between Legend and Chart
rectangle.
Legend.ResizeChart must be true and Legend.Alignment must be Top or Bottom. |
int |
getVertSpacing()
The vertical spacing between Legend iItems (pixels).
Default value: 0 |
boolean |
hasCheckBoxes()
Returns true when the legend displays checkboxes and it is showing
series names.
|
void |
paint(IGraphics3D g,
Rectangle rect)
Paints the TextShape object on the Chart Canvas.
|
protected java.lang.Object |
readResolve() |
Rectangle |
resizeChartRect(Rectangle rect)
Returns the chart rectangle minus the space occupied by the Legend.
|
void |
setAlignment(LegendAlignment value)
Defines the Legend position.
Default value: Right |
void |
setChart(IBaseChart c)
Chart associated with this object.
|
void |
setCheckBoxes(boolean value)
Displays the Legend check boxes when true.
Default value: false |
void |
setColorWidth(int value) |
void |
setColumnWidth(int column,
int value) |
void |
setColumnWidthAuto(boolean value)
Automatically calculates best fit of legend columns.
When set to true, columnWidths control the legend width Default value: true |
void |
setCurrentPage(boolean value)
When true, the Legend shows only the current page iItems when the Chart
is divided into pages.
Default value: true |
void |
setDividingLines(ChartPen value)
Internal use - serialization
|
void |
setFirstValue(int value)
Determines which is the first Legend item displayed.
Default value: 0 |
void |
setFontSeriesColor(boolean value)
Sets the legend text font color to that of the Series color.
Default value: false |
void |
setHorizMargin(int value)
Speficies the number of screen pixels between Legend and Chart
rectangles.
Default value: 0 |
void |
setInverted(boolean value)
Draws the Legend iItems in opposite direction when true.
Default value: false |
void |
setLegendStyle(LegendStyle value)
Defines which iItems will be displayed in the Chart Legend.
|
void |
setLines(java.lang.String[] value)
Accesses the array of Text lines.
Default value: null |
void |
setMaxNumRows(int value)
Sets the Maximum number of Legend Rows displayed for a horizontal Legend
(Chart Top or Bottom).
Default value: 10 |
void |
setResizeChart(boolean value)
Automatically resizes Chart rectangle to prevent overlap with Legend.
When set to true, Legend.HorizMargin and Legend.VertMargin control the amount of pixels by which the Chart rectangle will be reduced. |
void |
setSeries(Series value)
Determines which series is used as data for the Legend entries.
|
void |
setSymbol(LegendSymbol value) |
void |
setText(java.lang.String value)
Adds text to the Legend.
|
void |
setTextStyle(LegendTextStyle value)
Specifies how Legend text iItems will be formatted.
Default value: LeftValue |
void |
setTextSymbolGap(int value) |
void |
setTopLeftPos(int value)
Specifies the Legend's top position in percent of total chart height.
Default value: 10 |
void |
setUseMaxWidth(boolean value) |
void |
setVertMargin(int value)
Determines the vertical margin in pixels between Legend and Chart
rectangle.
Default value: 0 |
void |
setVertSpacing(int value)
Determines the vertical spacing between Legend iItems (pixels).
Default value: 0 |
getCustomPosition, setCustomPosition, shouldSerializeBottom, shouldSerializeLeft, shouldSerializeRight, shouldSerializeTop
assign, drawRectRotated, drawString, drawText, getAutoSize, getFont, getLinesLength, getShadowSize, getShapeStyle, getTextFormat, paint, paint, setAutoSize, setDrawText, setShadowSize, setShapeStyle, setTextFormat
assign, getBevel, getBevelInner, getBevelOuter, getBevelWidth, getBorderRound, getBottom, getBrush, getColor, getGradient, getHeight, getImage, getImageBevel, getImageMode, getImageTransparent, getLeft, getPen, getRight, getShadow, getShapeBounds, getTop, getTransparency, getTransparent, getVisible, getWidth, setBevel, setBevelInner, setBevelOuter, setBevelWidth, setBorderRound, setBottom, setBrush, setColor, setDefaultVisible, setHeight, setImage, setImageMode, setImageTransparent, setLeft, setPen, setRight, setShapeBounds, setTop, setTransparency, setTransparent, setVisible, setWidth
getChart, invalidate, setBooleanProperty, setColorProperty, setDoubleProperty, setIntegerProperty, setStringProperty
public transient LegendStyle iLegendStyle
protected boolean columnWidthAuto
protected int[] columnWidths
protected transient int firstValue
protected transient int iLastValue
public Legend(IBaseChart c)
protected java.lang.Object readResolve()
readResolve
in class TextShape
public LegendTextStyle getTextStyle()
public int getLastValue()
public void setTextStyle(LegendTextStyle value)
value
- LegendTextStylepublic int getTextSymbolGap()
public void setTextSymbolGap(int value)
public Series getSeries()
public void setSeries(Series value)
value
- Seriespublic boolean getCheckBoxes()
public void setChart(IBaseChart c)
Shape
public void setCheckBoxes(boolean value)
value
- booleanpublic boolean getCurrentPage()
public void setCurrentPage(boolean value)
value
- booleanpublic boolean getFontSeriesColor()
public void setFontSeriesColor(boolean value)
value
- booleanpublic ChartPen getDividingLines()
public void setDividingLines(ChartPen value)
public LegendSymbol getSymbol()
public void setSymbol(LegendSymbol value)
public boolean getInverted()
public void setInverted(boolean value)
value
- booleanpublic LegendAlignment getAlignment()
public void setAlignment(LegendAlignment value)
value
- LegendAlignmentpublic int getColumnWidth(int column)
public void setColumnWidth(int column, int value)
public boolean getColumnWidthAuto()
public void setColumnWidthAuto(boolean value)
value
- booleanpublic int getFirstValue()
public void setFirstValue(int value)
value
- intgetFirstValue()
public int getTopLeftPos()
public void setTopLeftPos(int value)
value
- intpublic int getMaxNumRows()
public void setMaxNumRows(int value)
value
- intpublic java.lang.String[] getLines()
TextShape
public void setLines(java.lang.String[] value)
TextShape
public java.lang.String getText()
public void setText(java.lang.String value)
public int getVertSpacing()
public void setVertSpacing(int value)
value
- intpublic int getHorizMargin()
public void setHorizMargin(int value)
value
- intpublic int getVertMargin()
public void setVertMargin(int value)
value
- intpublic boolean getResizeChart()
public void setResizeChart(boolean value)
value
- booleanpublic LegendStyle getLegendStyle()
public void setLegendStyle(LegendStyle value)
value
- LegendStylesgetLegendStyle()
public LegendTitle getTitle()
public boolean doMouseDown(Point p)
public int clicked(Point p)
p
- Pointpublic int clicked(int x, int y)
x
- inty
- intprotected int calcItemHeight()
protected boolean drawTitle()
public boolean hasCheckBoxes()
public boolean getVertical()
public int getColorWidth()
public void setColorWidth(int value)
public boolean getUseMaxWidth()
public void setUseMaxWidth(boolean value)
public Rectangle resizeChartRect(Rectangle rect)
rect
- Rectanglepublic void paint(IGraphics3D g, Rectangle rect)
TextShape
public java.lang.String formattedLegend(int seriesOrValueIndex)
seriesOrValueIndex
- intpublic java.lang.String formattedValue(Series aSeries, int valueIndex)
aSeries
- SeriesvalueIndex
- intpublic LegendItems getLegendItems()