|
Chart FX 7 for Java Server | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.softwarefx.chartfx.server.LegendItemAttributes
public class LegendItemAttributes
Provides access to the customization of a specific item in the LegendBox.
The LegendItemAttributes
Class
allows you to configure how SeriesAttributes
, ConditionalAttributes
, CustomGridLine
, or Axis.getKeyLabels()
of the Axis
Class
are rendered in the LegendBox
.SeriesAttributes
First, a new LegendItemAttributes object needs to be created. Next, this object needs to be mapped to the specific object it will customize. The final stage consists of modifing properties of the LegendItemAttributes object such as setFontStyle(java.util.EnumSet
and setTextColor(java.awt.Color)
. Notice that the setVisible(boolean)
property is usefull if you do not want a specific object being displayed in the LegendBox
. For example, the following piece of code makes the first Chart.getSeries()
of the Chart
invisble in the LegendBox
:
LegendItemAttributes item = new LegendItemAttributes();
item.setVisible(false);
chart1.getLegendBox().getItemAttributes().set(chart1.getSeries(), 0, item);
Constructor Summary | |
---|---|
LegendItemAttributes()
|
Method Summary | |
---|---|
EnumSet<FontStyle> |
getFontStyle()
Gets the FontStyle. |
int |
getOrderIndex()
Gets the OrderIndex. |
Color |
getTextColor()
Gets the TextColor. |
boolean |
isInverted()
Gets the Inverted. |
boolean |
isVisible()
Gets the Visible. |
void |
setFontStyle(EnumSet<FontStyle> value)
Sets the font style for the legend box item. |
void |
setInverted(boolean value)
Sets a value allowing you to invert the order of the LegendBox Items. |
void |
setOrderIndex(int value)
Sets the index for ordering the legend box items. |
void |
setTextColor(Color value)
Sets a value allowing you to set the text color for the legend item. |
void |
setVisible(boolean value)
Sets a value allowing you hide or show the legend item. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LegendItemAttributes()
Method Detail |
---|
public EnumSet<FontStyle> getFontStyle()
Gets the FontStyle. For more detail see setFontStyle(java.util.EnumSet
.
public int getOrderIndex()
Gets the OrderIndex. For more detail see setOrderIndex(int)
.
public Color getTextColor()
Gets the TextColor. For more detail see setTextColor(java.awt.Color)
.
public boolean isInverted()
Gets the Inverted. For more detail see setInverted(boolean)
.
public boolean isVisible()
Gets the Visible. For more detail see setVisible(boolean)
.
public void setFontStyle(EnumSet<FontStyle> value)
Sets the font style for the legend box item.
For more information regarding the FontStyle type, please refer to the Java API Documentation.
setInverted(boolean)
,
setOrderIndex(int)
,
setTextColor(java.awt.Color)
,
setVisible(boolean)
,
LegendBox
public void setInverted(boolean value)
Sets a value allowing you to invert the order of the LegendBox Items.
When set to true, all the selected items in the LegendBox will ve inverted.
setFontStyle(java.util.EnumSet)
,
setOrderIndex(int)
,
setTextColor(java.awt.Color)
,
setVisible(boolean)
,
LegendBox
public void setOrderIndex(int value)
Sets the index for ordering the legend box items.
The LegendBox can contain diferente legend items (e.g. Series Legends and Custom Gridlines Legends), which will be automatically grouped and sorted as shown in the folowing picture:
The order in which the legend groups are sorted can be changed by setting the OrderIndex:
LegendItemAttributes lia1 = new LegendItemAttributes();
LegendItemAttributes lia2 = new LegendItemAttributes();
LegendItemAttributes lia3 = new LegendItemAttributes();
LegendItemAttributes lia4 = new LegendItemAttributes();
lia1.setOrderIndex(2);
lia2.setOrderIndex(4);
lia3.setOrderIndex(1);
lia4.setOrderIndex(3);
chart1.getLegendBox().getItemAttributes().set(chart1.getSeries(), lia1);
chart1.getLegendBox().getItemAttributes().set(chart1.getAxisY().getCustomGridLines(), lia2);
chart1.getLegendBox().getItemAttributes().set(chart1.getAxisX().getCustomGridLines(), lia3);
chart1.getLegendBox().getItemAttributes().set(chart1.getLegendBox().getCustomItems(), lia4);
Which will produce the following:
When you use this feature, you must set an OrderIndex value to all the items in the LegendBox, or you will get unexpected results.
Chart FX will reorder the items in the LegenBox by sorting them by the assigned OrderIndex values. This values do not have to be correlative values. The above example would have produced the same results if the values 1, 10, 50, 200 were used.
setFontStyle(java.util.EnumSet)
,
setInverted(boolean)
,
setTextColor(java.awt.Color)
,
setVisible(boolean)
,
LegendBox
public void setTextColor(Color value)
Sets a value allowing you to set the text color for the legend item.
For more information regarding the Color type, please refer to the Java API Documentation
setFontStyle(java.util.EnumSet)
,
setInverted(boolean)
,
setOrderIndex(int)
,
setVisible(boolean)
,
LegendBox
public void setVisible(boolean value)
Sets a value allowing you hide or show the legend item.
When a legend item is hidden in the legend, the chart element will still be displayed in the chart.
LegendBox
|
http://www.softwarefx.com | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |