|
Chart FX for Java 6.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSoftwareFX.ChartFX.LegendBox
Provides access to the LegendBox object.
A legend box is a tool within a chart that contains relevant information to explain what is being depicted in a chart. The members of the LegendBox class are used to assign attributes to legend box objects in Chart FX.
Constructor Summary | |
LegendBox()
|
|
LegendBox(boolean values)
|
Method Summary | |
int |
getAlignment()
Allows you to align the selected legend box object. |
java.awt.Color |
getBackColor()
Allows you to set the background color for the selected legend box. |
IAdornment |
getBorderObject()
Gets or sets a default or image border to the legend. |
int |
getDocked()
Sets the position for the selected legend box. |
int |
getFlags()
Allows you to assign style attributes to a selected legend box object. |
java.awt.Font |
getFont()
Allows you to set the font for a selected legend box text. |
int |
getHeight()
Sets the height for a selected legend box object when it is docked or fixed in the chart. |
HighlightToolSettings |
getHighlight()
Returns a HighlightToolSettings object for a selected legend. |
java.awt.Color |
getTextColor()
Used to change the text color for the selected legend box object. |
TitleDockable |
getTitle(int n)
Deprecated. You should use getTitles() instead. |
TitleCollection |
getTitles()
Returns or sets a title object for the selected legend box. |
TitleDockable |
getTitles(int n)
Deprecated. You should use getTitles() instead. |
int |
getToolBorder()
Used to specify the style of the border for the selected legend box object. |
int |
getWidth()
Allows you to set the width for a selected legend box object. |
void |
invalidate()
Invalidates the selected legend and causes a paint message to be sent to the legend. |
boolean |
isAutoSize()
Allows Chart FX to calculate the best-fit size according to the selected legend box position. |
boolean |
isDrawingArea()
Allows the legend box margins to go outside of the chart's drawing area. |
boolean |
isVisible()
Shows or hides a selected legend box object. |
void |
setAlignment(int value)
Allows you to align the selected legend box object. |
void |
setAutoSize(boolean value)
Allows Chart FX to calculate the best-fit size according to the selected legend box position. |
void |
setBackColor(java.awt.Color value)
Allows you to set the background color for the selected legend box. |
void |
setBorderObject(IAdornment value)
Gets or sets a default or image border to the legend. |
void |
setDocked(int value)
Sets the position for the selected legend box. |
void |
setDrawingArea(boolean value)
Allows the legend box margins to go outside of the chart's drawing area. |
void |
setFlags(int value)
Allows you to assign style attributes to a selected legend box object. |
void |
setFont(java.awt.Font value)
Allows you to set the font for a selected legend box text. |
void |
setHeight(int value)
Sets the height for a selected legend box object when it is docked or fixed in the chart. |
void |
setTextColor(java.awt.Color value)
Used to change the text color for the selected legend box object. |
void |
setToolBorder(int value)
Used to specify the style of the border for the selected legend box object. |
void |
setVisible(boolean value)
Shows or hides a selected legend box object. |
void |
setWidth(int value)
Allows you to set the width for a selected legend box object. |
void |
sizeToFit()
Calculates and sets the best-fit size for the selected legend. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LegendBox()
public LegendBox(boolean values)
Method Detail |
public int getAlignment()
Allows you to align the selected legend box object.
ToolAlignment :
Defines the alignment of the selected Chart FX tool in the chart.Value | Description |
SPREAD | Stretches the selected tool in the configured position. |
NEAR | Left justifies the selected tool in the configured position. |
CENTER | Centers the selected tool in the configured position. |
FAR | Right justifies the selected tool in the configured position. |
You must make selected legend box object visible in order to see any of the visual attributes added using the properties of the LegendBox class.
The background color of the selected legend box may be modified using the setBackColor(java.awt.Color)
property.
Using the setDocked(int)
property, you can dock the selected legend box in different areas of the chart.
setAutoSize(boolean)
,
setBackColor(java.awt.Color)
,
setDocked(int)
,
setTextColor(java.awt.Color)
,
getTitles()
,
setWidth(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public java.awt.Color getBackColor()
Allows you to set the background color for the selected legend box.
When using a background image, you may want to assign a transparent BackColor to the selected legend box object.
For more information regarding the Color type, please refer to the Java API Documentation.
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public IAdornment getBorderObject()
Gets or sets a default or image border to the legend.
This property allows users to assign attributes directly to the border object of the legend.
The Chart FX ImageBorders use shading to give a multidimensional effect. The Chart.setPageColor(java.awt.Color)
property can be used to modify the background color of the shaded area around ImageBorders.
The DataEditor
and Chart
classes also support this property for border assignment to those objects.
Chart.setPageColor(java.awt.Color)
,
DataEditor
,
Chart
public int getDocked()
Sets the position for the selected legend box.
Docked :
Define how to set the selected tool position (docked, floating or fixed).Value | Description |
TOP | Docks the selected tool to the top margin. |
BOTTOM | Docks the selected tool to the bottom margin. |
LEFT | Docks the selected tool to the left margin. |
RIGHT | Docks the selected tool to the right margin. |
When a selected legend box is docked to a margin you can use the setToolBorder(int)
property to set the border style.
You may change the size of a tool with the setWidth(int)
and setHeight(int)
properties.
You can also change the alignment of the selected legend box using the setAlignment(int)
property.
setAutoSize(boolean)
,
setToolBorder(int)
,
setWidth(int)
,
setHeight(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Toolbar
,
DataEditor
public int getFlags()
Allows you to assign style attributes to a selected legend box object.
LegendBoxFlag :
Allows you to specify the style for a legend.Value | Description |
WORD_BREAK | Wraps text when the legend alignment is set to spread. |
SKIP_EMPTY | Prevents from displaying empty legends. |
SHOW_MENU | Enables the context menu for the legend. |
RIGHT_ALIGN | Right aligns the text in the legend. Used with Languages written from right to left. |
NO_COLOR | No Colors are used for markers in legend. |
INVERTED | Switches the order of the keys in legend. |
DEFAULT | Default legend settings. |
This property uses bitwise operators to turn on and off the Flags settings. To combine two flags for a selected legend use the 'Or' bitwise operator:
chart1.getLegendBoxObj().setFlags(chart1.getLegendBoxObj().getFlags() | LegendBoxFlag.INVERTED | LegendBoxFlag.RIGHT_ALIGN);
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public java.awt.Font getFont()
Allows you to set the font for a selected legend box text.
You can set the font for the entire chart using the Chart.setFont(java.awt.Font)
property.
When setting a font in Chart FX, you must create a new font object with the desired attributes and assign that object to the desired chart element every time you want to change the font.
For more information regarding the Font type, please refer to the Java API Documentation.
getTitles()
,
setTextColor(java.awt.Color)
,
Chart.setFont(java.awt.Font)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public int getHeight()
Sets the height for a selected legend box object when it is docked or fixed in the chart.
For a docked legend, the Height property applies only when it is docked to the top or bottom margin. The height can always be modified when the legend is fixed inside the chart area.
When you modify the height of a particular legend the setAutoSize(boolean)
property will be set to False and even if you move the legend from a docked to a fixed position or viceversa, Chart FX will not recalculate the best-fit height for the legend unless the AutoSize property is set to True.
setDocked(int)
,
setAutoSize(boolean)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
DataEditor
public HighlightToolSettings getHighlight()
Returns a HighlightToolSettings object for a selected legend.
This property returns a HighlightToolSettings object, so you may customize how the Legend displays a highlighted chart element. Please see the supported members of the HighlightToolSettings
class for more information.
HighlightToolSettings
public java.awt.Color getTextColor()
Used to change the text color for the selected legend box object.
Before you can see the text color assignments, the selected legend box must be visible.Axis.getLabel(int)
Chart.getLegend(int)
You can assign the text for the values legend box using the Axis.getLabel(int)
or Chart.getLegend(int)
properties. The Chart.getSerLeg(int)
property allows you to add keys to a series legend box, and the UserLegendBoxItem.setLabel(java.lang.String)
property allows you to set keys for the user legend box.
This property does not change the color of legend box titles, please refer to the Title
members.
For more information regarding the Color type, please refer to the Java API Documentation.
setFont(java.awt.Font)
,
Axis.getLabel(int)
,
Chart.getLegend(int)
,
getTitles()
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Axis
,
Chart
,
Title
public TitleDockable getTitle(int n)
getTitles()
instead.
public TitleCollection getTitles()
Returns or sets a title object for the selected legend box.
Please refer to Title
class members to modify other attributes of the title object.
Title.setTextColor(java.awt.Color)
,
Title.setText(java.lang.String)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Title
,
Chart
public TitleDockable getTitles(int n)
getTitles()
instead.
public int getToolBorder()
Used to specify the style of the border for the selected legend box object.
ToolBorder :
Set the border style for the tool object selected.Value | Description |
NONE | No border used. |
EXTERNAL | External border used for the tool object. |
INTERNAL | Internal border used for the tool object. |
Allows you to specify the border for a selected legend box to be External, Internal or none.
setDocked(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
DataEditor
public int getWidth()
Allows you to set the width for a selected legend box object.
The setHeight(int)
property will allow you to manually adjust the height of the legend box. Both the Height and Width properties are configured in units of pixels.
You can use the setAutoSize(boolean)
property to allow Chart FX to calculate the best-fit size according to the selected legend box position. If this property is set to True, manual width adjustments will be ignored.
For a setDocked(int)
legend, the Width property applies only when it is docked to the right or left margin. The width can always be modified when the legend is fixed inside the chart area.
setAutoSize(boolean)
,
setDocked(int)
,
setHeight(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public void invalidate()
Invalidates the selected legend and causes a paint message to be sent to the legend.
When you modify a visual attribute of a selected legend, sometimes it requires that the legend be recalculated and repainted to display the legend as desired. Calling this method after customization will ensure new changes are visible.
Chart.setLegendBox(boolean)
,
Chart.setSerLegBox(boolean)
,
Chart.setUserLegendBox(boolean)
,
Chart
public boolean isAutoSize()
Allows Chart FX to calculate the best-fit size according to the selected legend box position.
When the user moves a legend from a docked position to another (e.g. Docked-Right to Docked-Top), The legend must be resized accordingly to fit all the labels associated with the legend being shown. When this property is set to True, you will not need to set the legend setWidth(int)
or setHeight(int)
as Chart FX will calculate those values for you.
setWidth(int)
,
setHeight(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
DataEditor
public boolean isDrawingArea()
Allows the legend box margins to go outside of the chart's drawing area.
By default the legends are drawn inside the chart drawing area, for example when the legend box is at the right, the first legend will be at the top of the chart area, it will not use the margin on top. If you set DrawingArea to false, the margins will also be available for the legend.
If there is enough space and the legend is centered (default), there will be no noticeable difference when this property is configured. The difference is visible when there are many legend values, the drawing area is too small, the opposite gaps (e.g. top and bottom) are different or the legend is not centered.
Chart.setLegendBox(boolean)
,
Chart.getLegendBoxObj()
,
Chart
public boolean isVisible()
Shows or hides a selected legend box object.
Hiding a tool does not destroy nor lose previous settings assigned by other properties.
You may also use the Chart.setLegendBox(boolean)
, Chart.setSerLegBox(boolean)
or Chart.setUserLegendBox(boolean)
properties to make the selected legend box visible.
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart.setLegendBox(boolean)
,
Chart.setSerLegBox(boolean)
,
Chart.setUserLegendBox(boolean)
,
Chart
,
Toolbar
,
DataEditor
public void setAlignment(int value)
Allows you to align the selected legend box object.
ToolAlignment :
Defines the alignment of the selected Chart FX tool in the chart.Value | Description |
SPREAD | Stretches the selected tool in the configured position. |
NEAR | Left justifies the selected tool in the configured position. |
CENTER | Centers the selected tool in the configured position. |
FAR | Right justifies the selected tool in the configured position. |
You must make selected legend box object visible in order to see any of the visual attributes added using the properties of the LegendBox class.
The background color of the selected legend box may be modified using the setBackColor(java.awt.Color)
property.
Using the setDocked(int)
property, you can dock the selected legend box in different areas of the chart.
setAutoSize(boolean)
,
setBackColor(java.awt.Color)
,
setDocked(int)
,
setTextColor(java.awt.Color)
,
getTitles()
,
setWidth(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public void setAutoSize(boolean value)
Allows Chart FX to calculate the best-fit size according to the selected legend box position.
When the user moves a legend from a docked position to another (e.g. Docked-Right to Docked-Top), The legend must be resized accordingly to fit all the labels associated with the legend being shown. When this property is set to True, you will not need to set the legend setWidth(int)
or setHeight(int)
as Chart FX will calculate those values for you.
setWidth(int)
,
setHeight(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
DataEditor
public void setBackColor(java.awt.Color value)
Allows you to set the background color for the selected legend box.
When using a background image, you may want to assign a transparent BackColor to the selected legend box object.
For more information regarding the Color type, please refer to the Java API Documentation.
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public void setBorderObject(IAdornment value)
Gets or sets a default or image border to the legend.
This property allows users to assign attributes directly to the border object of the legend.
The Chart FX ImageBorders use shading to give a multidimensional effect. The Chart.setPageColor(java.awt.Color)
property can be used to modify the background color of the shaded area around ImageBorders.
The DataEditor
and Chart
classes also support this property for border assignment to those objects.
Chart.setPageColor(java.awt.Color)
,
DataEditor
,
Chart
public void setDocked(int value)
Sets the position for the selected legend box.
Docked :
Define how to set the selected tool position (docked, floating or fixed).Value | Description |
TOP | Docks the selected tool to the top margin. |
BOTTOM | Docks the selected tool to the bottom margin. |
LEFT | Docks the selected tool to the left margin. |
RIGHT | Docks the selected tool to the right margin. |
When a selected legend box is docked to a margin you can use the setToolBorder(int)
property to set the border style.
You may change the size of a tool with the setWidth(int)
and setHeight(int)
properties.
You can also change the alignment of the selected legend box using the setAlignment(int)
property.
setAutoSize(boolean)
,
setToolBorder(int)
,
setWidth(int)
,
setHeight(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Toolbar
,
DataEditor
public void setDrawingArea(boolean value)
Allows the legend box margins to go outside of the chart's drawing area.
By default the legends are drawn inside the chart drawing area, for example when the legend box is at the right, the first legend will be at the top of the chart area, it will not use the margin on top. If you set DrawingArea to false, the margins will also be available for the legend.
If there is enough space and the legend is centered (default), there will be no noticeable difference when this property is configured. The difference is visible when there are many legend values, the drawing area is too small, the opposite gaps (e.g. top and bottom) are different or the legend is not centered.
Chart.setLegendBox(boolean)
,
Chart.getLegendBoxObj()
,
Chart
public void setFlags(int value)
Allows you to assign style attributes to a selected legend box object.
LegendBoxFlag :
Allows you to specify the style for a legend.Value | Description |
WORD_BREAK | Wraps text when the legend alignment is set to spread. |
SKIP_EMPTY | Prevents from displaying empty legends. |
SHOW_MENU | Enables the context menu for the legend. |
RIGHT_ALIGN | Right aligns the text in the legend. Used with Languages written from right to left. |
NO_COLOR | No Colors are used for markers in legend. |
INVERTED | Switches the order of the keys in legend. |
DEFAULT | Default legend settings. |
This property uses bitwise operators to turn on and off the Flags settings. To combine two flags for a selected legend use the 'Or' bitwise operator:
chart1.getLegendBoxObj().setFlags(chart1.getLegendBoxObj().getFlags() | LegendBoxFlag.INVERTED | LegendBoxFlag.RIGHT_ALIGN);
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public void setFont(java.awt.Font value)
Allows you to set the font for a selected legend box text.
You can set the font for the entire chart using the Chart.setFont(java.awt.Font)
property.
When setting a font in Chart FX, you must create a new font object with the desired attributes and assign that object to the desired chart element every time you want to change the font.
For more information regarding the Font type, please refer to the Java API Documentation.
getTitles()
,
setTextColor(java.awt.Color)
,
Chart.setFont(java.awt.Font)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public void setHeight(int value)
Sets the height for a selected legend box object when it is docked or fixed in the chart.
For a docked legend, the Height property applies only when it is docked to the top or bottom margin. The height can always be modified when the legend is fixed inside the chart area.
When you modify the height of a particular legend the setAutoSize(boolean)
property will be set to False and even if you move the legend from a docked to a fixed position or viceversa, Chart FX will not recalculate the best-fit height for the legend unless the AutoSize property is set to True.
setDocked(int)
,
setAutoSize(boolean)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
DataEditor
public void setTextColor(java.awt.Color value)
Used to change the text color for the selected legend box object.
Before you can see the text color assignments, the selected legend box must be visible.Axis.getLabel(int)
Chart.getLegend(int)
You can assign the text for the values legend box using the Axis.getLabel(int)
or Chart.getLegend(int)
properties. The Chart.getSerLeg(int)
property allows you to add keys to a series legend box, and the UserLegendBoxItem.setLabel(java.lang.String)
property allows you to set keys for the user legend box.
This property does not change the color of legend box titles, please refer to the Title
members.
For more information regarding the Color type, please refer to the Java API Documentation.
setFont(java.awt.Font)
,
Axis.getLabel(int)
,
Chart.getLegend(int)
,
getTitles()
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Axis
,
Chart
,
Title
public void setToolBorder(int value)
Used to specify the style of the border for the selected legend box object.
ToolBorder :
Set the border style for the tool object selected.Value | Description |
NONE | No border used. |
EXTERNAL | External border used for the tool object. |
INTERNAL | Internal border used for the tool object. |
Allows you to specify the border for a selected legend box to be External, Internal or none.
setDocked(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
DataEditor
public void setVisible(boolean value)
Shows or hides a selected legend box object.
Hiding a tool does not destroy nor lose previous settings assigned by other properties.
You may also use the Chart.setLegendBox(boolean)
, Chart.setSerLegBox(boolean)
or Chart.setUserLegendBox(boolean)
properties to make the selected legend box visible.
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart.setLegendBox(boolean)
,
Chart.setSerLegBox(boolean)
,
Chart.setUserLegendBox(boolean)
,
Chart
,
Toolbar
,
DataEditor
public void setWidth(int value)
Allows you to set the width for a selected legend box object.
The setHeight(int)
property will allow you to manually adjust the height of the legend box. Both the Height and Width properties are configured in units of pixels.
You can use the setAutoSize(boolean)
property to allow Chart FX to calculate the best-fit size according to the selected legend box position. If this property is set to True, manual width adjustments will be ignored.
For a setDocked(int)
legend, the Width property applies only when it is docked to the right or left margin. The width can always be modified when the legend is fixed inside the chart area.
setAutoSize(boolean)
,
setDocked(int)
,
setHeight(int)
,
Chart.getLegendBoxObj()
,
Chart.getSerLegBoxObj()
,
Chart.getUserLegendBoxObj()
,
Chart
public void sizeToFit()
Calculates and sets the best-fit size for the selected legend.
This method is particularly useful when the AutoSize property is set to False, as it will allow you to recalculate the best-fit size for the selected tool without setting the AutoSize property to True.
setAutoSize(boolean)
,
LegendBox
,
UserLegendBox
|
http://www.softwarefx.com | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |