CFXLegendBox Class Reference

Inherits from
Conforms to
Framework
Availability
Available in iOS 5.0 and later.
Companion guide
Declared in
ChartFX.h

Overview

A legend box is a tool within a chart that contains relevant information to explain what is being depicted in a chart.

The LegendBox can show legends from series, keyLabels, CFXConditional Attributes, CFXCustom Gridlines, etc.

You must make the legend box visible in order to see any of the visual attributes configured using the properties of the class.

The legend box inherits from CFXDockableBar. Therefore, some visual properties of the legend box can be accessed using the properties implemented by CFXDockableBar.

Properties

autoSize

Allows Chart FX for iOS to calculate the best size according to the tool position.

@property(nonatomic) BOOL autoSize
Discussion

The width and height properties may be used to manually control the size of a DockableBar, however they should only be used when the AutoSize is configured to NO.

The dock property may be used to position a DockableBar object in a chart.

Declared In
ChartFX.h

backColor

Gets or sets a value for the background color of a dockable bar.

@property(nonatomic) UIColor backColor
Discussion

The effect of this property is to change the background behind any dockable bar object such as the LegendBox.

For more information regarding the Color type, please refer to the Xcode and Objective-C Documentation.

Declared In
ChartFX.h

border

Allows the developer to specify the border style.

@property(nonatomic) CFXDockBorder border
Declared In
ChartFX.h

contentLayout

Allows you to align the content for the legend box.

@property(nonatomic) CFXContentLayout contentLayout
Discussion

When the Leyend box is docked at the left or right of the Chart, Near means Top, and Far means Bottom.

Declared In
ChartFX.h

customItems

Returns the collection of the custom items in the legend box.

@property(nonatomic) CustomLegendItemCollection customItems
Declared In
ChartFX.h

dock

Gets or sets the tool position.

@property(nonatomic) CFXDockArea dock
Availability
  • Available in iOS 5.0 and later.
Declared In
ChartFX.h

font

Gets or sets the font of the Legend Box.

@property(nonatomic) UIFont font
Discussion

You can set the font for the entire chart using the font property.

For more information regarding the Font type, please refer to the Xcode and Objective-C Documentation.

Declared In
ChartFX.h

height

Gets or sets the height of the dockable bar in pixels.

@property(nonatomic) int height
Discussion

When you modify the height, the autoSize property will be set to NO.

Use the Height property to configure the height for the dockable bar object.

Availability
  • Available in iOS 5.0 and later.
Declared In
ChartFX.h

itemAttributes

Allows you to configure the Legend Box Items in the chart.

@property(nonatomic) LegendItemAttributesCollection itemAttributes
Parameters
item
The object than contains the LegendBox member.
list
The list of objects that contains LegendBox members.
index
Zero base index to select the particular LegendBox member.
Discussion

Use the ItemAttributes property to configure the Legend Box Items for the chart.

By obtain a LegendItemAttributes object from the LegendItemAttributesCollection, developers may configure unique attributes for a selected legend item. Please see the CFXLegendItemAttributes class for information on supported members.

This property only returns the standard legend items added by Chart FX for iOS . Use the customItems property to return the collection of the custom items in the legend box.

Declared In
ChartFX.h

lineSpacing

Gets or sets a value indicating the LineSpacing for a LegendBox.

@property(nonatomic) double lineSpacing
Discussion

This property specifies the LineSpacing for a legend that is docked to the left or right only, not at the top or bottom.

Setting the LineSpacing property to 2 will instruct the legend to use double line spacing. Setting the value to 1 instructs the legend to use single line spacing. The default value is 2.

Declared In
ChartFX.h

marginX

Gets or sets a value specifying the margin width for a LegendBox.

@property(nonatomic) int marginX
Discussion

The marginY property may be used to control the margin height for a LegendBox.

The legendBox property of the CFXChart class is used to return the chart's LegendBox object.

Declared In
ChartFX.h

marginY

Gets or sets a value specifying the margin height for a LegendBox.

@property(nonatomic) int marginY
Discussion

The marginX property may be used to control the margin width for a LegendBox.

The legendBox property of the CFXChart class is used to return the chart's LegendBox object.

Declared In
ChartFX.h

textColor

Gets or sets the color used for the text in the legend box.

@property(nonatomic) UIColor textColor
Discussion

Before you can see the text color assignments, the selected legend box must be visible.

You can assign the text for the values legend box using the labels or text properties.

For more information regarding the Color type, please refer to the Xcode and Objective-C Documentation.

Declared In
ChartFX.h

visible

Gets or sets a value indicating the Dockablebar object should be shown or not.

@property(nonatomic) BOOL visible
Discussion

Hiding a DockableBar object not destroy or lose previous settings assigned by other properties.

Declared In
ChartFX.h

width

Sets the height in pixels.

@property(nonatomic) int width
Discussion

When you modify the width, the autoSize property will be set to NO.

Declared In
ChartFX.h

zOrder

Gets or sets the z-order for a dockable bar.

@property(nonatomic) int zOrder
Discussion

Using this property, developers can control the order of Dockable bar objects in a chart.

Declared In
ChartFX.h

Instance Methods

sizeToFit

Calculates and sets the best-fit size for the legend box.

- (void) sizeToFit
Discussion

This method is particularly useful when the autoSize property is set to False, as it will allow you to recalculate the best-fit size of the legend box.

Availability
  • Available in iOS 5.0 and later.
Declared In
ChartFX.h

Constants

CFXContentLayout

Defines the alignment of the selected object in the chart.

typedef enum {
   CFXSpread,
   CFXNear,
   CFXCenter,
   CFXFar
} CFXContentLayout;
Constants
CFXSpread
Stretches the selected object in the configured position.
CFXNear
Left justifies the selected object in the configured position.
CFXCenter
Centers the selected object in the configured position.
CFXFar
Right justifies the selected object in the configured position.
Declared In
chartfx.h

CFXDockArea

Define how to set the docked selected tool position.

typedef enum {
   CFXLeft,
   CFXTop,
   CFXRight,
   CFXBottom
} CFXDockArea;
Constants
CFXLeft
Docks the object to the left margin.
CFXTop
Docks the object to the top margin.
CFXRight
Docks the object to the right margin.
CFXBottom
Docks the object to the bottom margin.
Declared In
chartfx.h

CFXDockBorder

Sets the Docking style for Border of the selected object.

typedef enum {
   CFXNone,
   CFXExternal,
   CFXInternal
} CFXDockBorder;
Constants
CFXNone
No border used is used.
CFXExternal
External border used for the selected object.
CFXInternal
Internal border used for the selected object.
Declared In
chartfx.h