CFXChart Class Reference

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

Overview

General chart properties are provided to set general attributes in the chart. For example, you may use properties to show or hide tools in the chart window or to apply a specific line style to all lines in a line chart.

The data is passed to the chart using the data property. Alternativelly, data binding is also available through the dataSource and dataSourceSettings properties.

There may be a case in which a general property is also found in a specific object. For example, you may use a general property called gallery to change the chart type displayed for all series in the chart, but if you use the gallery property supported by the series object you will change the chart type for a particular series (thus creating a multi type chart) instead of all series in the chart. You may even go a step further by assigning properties directly to specific points rather than series using the points object.

Some properties of the Chart class act as a mechanism for assigning attributes directly to other objects that exist in the chart, such as legendBox, among others. If you want to assign individual properties to elements in the chart, you may refer to the different objects available.

The chart can be rendered in 3D. The view3D property provides access the 3D customization of the chart.

Properties

allSeries

Gets the global attributes which are shared across the series of the chart.

@property(nonatomic) CFXGlobalAttributes allSeries
Discussion

For performance reasons, the series and the points related to the series share the same visual attributes. Those visual attributes are stored in the CFXGlobalAttributes class. Therefore, to set a attribute common to all the points of the chart, AllSeries should be used. If the user wants to change a visual attribute for a particular series, series should be used. Similarly, if the user wants to change a visual attribute for a particular point, points should be used.

Declared In
ChartFX.h

axesStyle

Used to change the style of the axes.

@property(nonatomic) CFXAxesStyle axesStyle
Discussion

Toggling the chart from 2D and 3D modes will produce different effects.

Declared In
ChartFX.h

axesX

Returns the collection of the X axes of the chart.

@property(nonatomic) AxisXCollection axesX
Parameters
index
Returns the indexed x axis.
Discussion

The first element of the collection is the primary X axis of the chart.

Declared In
ChartFX.h

axesY

Returns the collection of the Y axes of the chart.

@property(nonatomic) AxisYCollection axesY
Parameters
index
Returns the indexed y-axis.
Discussion

The first element of the collection is the primary Y axis of the chart. Similarly, the second element of the collection is the secondary Y axis of the chart.

Declared In
ChartFX.h

axisX

Assigns properties specifically to the primary X axis.

@property(nonatomic) CFXAxisX axisX
Declared In
ChartFX.h

axisY

Assigns properties specifically to the primary Y axis of the chart.

@property(nonatomic) CFXAxisY axisY
Declared In
ChartFX.h

axisY2

Assigns properties specifically to the secondary Y axis of the chart.

@property(nonatomic) CFXAxisY axisY2
Discussion

By default, the secondary Y axis is not visible. This axis needs to be associated to a series in order to be rendered by the chart.

Declared In
ChartFX.h

background

Allows you to assign a gradient or an image to the background of a chart.

@property(nonatomic) CFXIBackgroundAdornment background
Discussion

Each chart has only one background. Gradients and images may be applied to the background of both 2D and 3D charts.

The plot area color must be set to transparent if you want the gradient or image to be shown in the whole chart.

For a solid color background you must assign the Background property to NULL and use the BackColor property.

You can use the plotAreaBackground property to assign a gradient or an image to the inside chart area. However it is only supported in 2D charts.

Declared In
ChartFX.h

border

Gets or sets a border to the chart.

@property(nonatomic) CFXIBorderAdornment border
Discussion

The Border property is used when setting a vector border to the chart. In order to assign a vector border, you must create a new CFXCFXVectorBorder object and assign it to the Border property.

Declared In
ChartFX.h

conditionalAttributes

Returns the collection of CFXConditionalAttributes objects.

@property(nonatomic) ConditionalAttributesCollection conditionalAttributes
Parameters
n
Zero based index specifying the ConditionalAttributes item.
Discussion

This property exposes the members of the Condition and ConditionalAttributes classes. Please see the CFXCondition and CFXConditionalAttributesclasses for additional information regarding those supported members.

Declared In
ChartFX.h

culture

Allows you to localize charts for a specific language and region.

@property(nonatomic) CultureInfo culture
Declared In
ChartFX.h

data

Allows you to set the Y values. Alternatively, the Y values can be access through the y property of the CFXDataValues class.

@property(nonatomic) CFXDataValues data
Parameters
series
An integer specifying the series you want to set the y-value.
point
An integer specifying the point you want to set the y-value.
Discussion

Please note that instead of the Y value associated with the point, you can assign a hidden constant will cause the point to be hidden in the chart. Although a hidden point is physically in the data array, when you use this constant the marker will not appear in the chart, and if you have charts like a line or area chart, the line will break at that particular point.

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

dataSource

Gets or sets the source containing the values used to populate the chart.

@property(nonatomic) NSObject dataSource
Discussion

Chart FX supports three different types of data sources:

- You can pass a CFXChartDataSource protocol: you can pass any class that implements the CFXChartDataSource protocol. In many cases, it is the same class that creates the chart.

- You can pass a CoreData object: simply pass a NSFetchedResultsController instance.

- You can pass a collection of objects, such as an NSArray or NSSet.

This property is a shortcut to the dataSource property of the CFXDataSourceSettings class.

Once the DataSource has been configured using this property, the chart is automatically bound to the data. For further fields customization, you must use the fields property of the CFXDataSourceSettings class.

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

dataSourceSettings

Used to assign data related attributes to your chart applications.

@property(nonatomic) CFXDataSourceSettings dataSourceSettings
Discussion

You can use the dataSource property to define the chart datasource when passing data from databases, protocol or arrays.

Declared In
ChartFX.h

extensions

Collection used to add, clear and assign Chart FX for iOS extension objects.

@property(nonatomic) ExtensionCollection extensions
Parameters
n
Specifies the item as an object.
Discussion

Chart FX for iOS has been designed with extensibility in mind. Using this property, additional functionality can be added to the component such as the Annotation or Hand Drawn extensions.

Declared In
ChartFX.h

extraStyle

Allows you to set additional visual attributes in the chart.

@property(nonatomic) CFXChartStyles extraStyle
Discussion

This property is set using the bitwise operators (And, Or, Not, Xor) provided by Xcode and Objective-C .

Declared In
ChartFX.h

gallery

Sets the gallery type for the whole chart.

@property(nonatomic) CFXGallery gallery
Discussion

When you set the gallery with this property, it applies to all the series in the chart. If you want to create a Multitype (combination) chart you need to assign galleries individally for each series. Please refer to the gallery property of the CFXSeriesAttributes class.

galleryAttributes allows you to assign additional attributes to selected gallery types.

Declared In
ChartFX.h

galleryAttributes

Used to create a gallery object to assign additional attributes to the selected gallery type of the chart. The gallery attribute can also be accessed through the allSeries property.

@property(nonatomic) NSObject galleryAttributes
Discussion

This property returns an object which allows assignment of special properties to be set for the selected gallery. Note that not all gallery types support additional properties.

Declared In
ChartFX.h

legendBox

Allows you to acces the legend box of the chart.

@property(nonatomic) CFXLegendBox legendBox
Discussion

The values legend box is used to display legends associated with data points and is used to improve the chart's readability in charts like Pie, Doughnut and Pyramid where there's no axis, but point labels are still necessary in the chart.

Declared In
ChartFX.h

mainPane

Gets the default pane of the chart.

@property(nonatomic) CFXPane mainPane
Discussion

The default pane can also be accessed through the allSeries property.

Declared In
ChartFX.h

panes

Returns the collection of the defined panes of the chart.

@property(nonatomic) PaneCollection panes
Parameters
n
Zero based index specifying the Panes item.
Discussion

The main pane of the chart is the first indexed pane of the collection.

Declared In
ChartFX.h

plotAreaBackground

Allows you to assign a gradient or an image to the inside area of a chart.

@property(nonatomic) IAdornment plotAreaBackground
Discussion

You can use the background to assign a gradient or an image to the chart background area.

Gradients applied to the PlotAreaBackground of a chart will only be applied to 2D charts. Gradients applied to the PlotAreaBackground of 3D charts will be ignored, however gradients applied to the background of both 2D and 3D charts is supported.

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

plotAreaMargin

Gets and sets the top, bottom, left and right gaps of the chart.

@property(nonatomic) CFXMargins plotAreaMargin
Discussion

A gap is defined as the margin between the chart and the bounding rectangle in pixels. Each chart has a top, bottom, left and right gaps.

The lowest value for the each gap is 1, which sets it to one pixel. Setting a gap to 0 will reset it to default values.

Declared In
ChartFX.h

points

Assigns properties directly to a specific point in the chart.

@property(nonatomic) PointAttributesCollection points
Parameters
series
A zero based index indicating the data series in a chart.
point
A zero based index indicating the data point in a chart.
point
A zero based index indicating the data point in a chart. When a chart only has one series, only a point index is required.
Discussion

Allows you to assign supported properties directly to the specified data point. For supported properties, please see the CFXCFXPoint class.

If you want to change the markers and the labels for all the points of the same series, please refer to the series property.

Declared In
ChartFX.h

realTime

Allows access to the CFXRealTimeSettings class supported members used to create real-time charts.

@property(nonatomic) CFXRealTimeSettings realTime
Discussion

You can set a buffer size to allocate memory for the realtime chart using the bufferSize property. Setting a buffer will create a Limited real-time chart which is the fastest real-time chart. Excluding the buffer will instruct Chart FX for iOS to create an unlimited real-time chart.

The loop marker may be customized using the loopMarker property in conjunction with the supported CFXLine class properties.The color, style, width, endCap and startCap attributes may be assigned using the CFXLine class.

Declared In
ChartFX.h

series

Assigns properties directly to the selected series in the chart.

@property(nonatomic) SeriesAttributesCollection series
Parameters
n
A zero based index indicating the data series in the chart.
Discussion

Allows you to assign supported properties directly to the specified data series. For supported properties, please see the CFXSeriesAttributes class.

allSeries allows to set properties common to all the Series or/and points of the chart.

The Series property allows you to create charts with mixed gallery types and assign specific colors to each series.

Declared In
ChartFX.h

titles

Returns the collection of titles defined in the chart.

@property(nonatomic) TitleCollection titles
Parameters
n
A zero based index indicating the title index.
Discussion

Using the numerical index, you can access multiple items of this collection.

The textColor property may be used to get or set the color of the title text; the font Property can be used to configure a new font object for the title.

Declared In
ChartFX.h

toolTipFormat

Allows you to control the information to be displayed in the tooltip when the user positions the mouse over a particular data point in the chart.

@property(nonatomic) NSString *toolTipFormat
Discussion

toolTips toggle on/off the tooltip in the chart.

The syntax for this property is the same as the one used in the format property. Variables can be accessed using the % following the variable you want to include:

l Shows X-Axis Legend.

k Shows X-Axis Key Legend.

s Shows Series Legend.

S Shows the Series Index.

x Shows XValue (XY charts, when they were set with X values).

i Shows IniValues (Gantt).

v Shows Data Value.

v <n> For types that require more than one series, these are replaced by the value of each one. (n represents an index).

t Series Total (Sum of all points in this series).

p Percentage of total this point represents (Pie).

T Point Total (Sum of all series for this point).

P Percentage of total this series represents (Used in stacked charts).

X displays the marker X value for any chart type including those that do not support X values such as bar.

N Shows the index for the point.

L Shows the Text property of the CFXPoint object.

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

toolTips

Allows you to enable or disable tooltips over a particular element in the chart.

@property(nonatomic) BOOL toolTips
Declared In
ChartFX.h

view3D

Allows you to enable or disable 3D view of the chart. Also used to customize the 3D view.

@property(nonatomic) CFXAttributes3D view3D
Discussion

When this property is set to True, you can apply a rotation angle or perspective with the angleX, angleY and perspective properties of the CFXAttributes3D class.

Declared In
ChartFX.h

Instance Methods

convertDoubleToDate:

Converts a Chart FX internal Format date to an NSDate

- (NSDate)convertDoubleToDate:(double *)d
Parameters
d
Double to convert
Discussion

When a chart contains X values representing dates, Chart FX uses an internal format. Use this method if you want to obtain the corresponding date for a specific double representation.

Declared In
ChartFX.h

convertDateToDouble:

Converts a NSDate to Chart FX internal Format.

- (double)convertDateToDouble:(NSDate *)date
Parameters
date
Date to convert
Discussion

When loading X values which are dates to a Chart, they must be converted to an internal format for Chart FX to properly handle labeling and scaling.

Declared In
ChartFX.h

expandMacrosWithMask:forSeries:andPoint:inMarker:

Returns the mask string for a selected point or line in a chart.

- (NSString *)expandMacrosWithMask:(NSString *)mask forSeries(int *)series: andPoint(int *)point: inMarker(BOOL *)marker
Parameters
mask
Speicifies the mask string. (May be null value.)
forSeries
Specifies the Series.
andPoint
Specifies the Point.
inMarker
Specifies to return the mask of the Point or the line between the Points.
Discussion

This method is useful when you would like to return the configured mask string for a selected point label.

You may set the mask string for a selected chart element using the format property of the CFXPointLabelAttributes class, or the toolTipFormat property.

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

getMessageText:

Allows you to obtain default Chart FX stings which are displayed in the chart.

- (NSString *)getMessageText:(NSString *)key
Parameters
key
Pre-defined message identifier.
Discussion

The key parameter is case sensitive, therefore you must use the exact pre-defined key value string.

You can use the Culture property to fully localize your charts. Elements that can be modified include the names of the culture, the writing system, and the calendar used, as well as formatting dates and strings.

The culture property of the CFXValueFormat class allow you to assign culture specific formatting to labels and numbers for a selected axis.

Pre-defined message identifiers with the defualt values for each key (key=value):

NoData=No Data Available
LicDownloading=Downloading License ...
DataDownloading=Downloading Chart ...
DataFailed=Failed to download Chart\n{0}
Mask.Percentage=%s\n%l\n%v out of %t\n(%p%%)
Mask.OHLC=%l\nOpen: %v2\nHigh: %v4 - Low: %v1\nClose: %v3
Mask.HLC=%l\nHigh: %v3 - Low: %v1\nClose %v2
Mask.Ini=%s\n%l\nFrom %i to\n%v
Mask.XY=%s\n%l\nX: %x, Y: %v
Mask.Between=%s\n%l - %l\n%v - %v
Mask.Default=%s\n%l\n%v
LegMask.Series=Series #{0}
LegMask.Values=Value #{0}
CFX61B0=A temporary file on {0} could not be created
XAxis=X Axis
YAxis=Y Axis
General=General
Series=Series
Chart=Chart Area
Draw=Drawing Area
AllSeries=All Series
Auto=Auto
None=None
Raised=Raised
Light=Light
Dark=Dark
Opposite=Opposite
Shadow=Shadow
Number=Number
Currency=Currency
Scientific=Scientific
Percentage=Percentage
Date=Short Date
LongDate=Long Date
Time=Time
DateTime=Date-Time
Label0=Horizontal
Label1=Vertical
Label2=45 Degrees
Inside=Inside
Outside=Outside
Cross=Across
ExportFilter=ChartFX File (*.cfx)|*.cfx|Text File (data only)|*.txt|XML File (properties only)|*.xml|Bitmap Image (*.bmp)|*.bmp|Metafile Picture (*.emf)|*.emf
ImportFilter=ChartFX Files (*.cfx)|*.cfx|Text Files (data only)|*.txt|XML Files(properties only)|*.xml
NoPermission=The application does not have enough permissions to execute this operation.

Declared In
ChartFX.h

getMessageText:

Allows you to obtain default Chart FX stings which are displayed in the chart.

- (NSString *)getMessageText:(NSString *)key
Parameters
key
Pre-defined message identifier.
Discussion

The key parameter is case sensitive, therefore you must use the exact pre-defined key value string.

You can use the Culture property to fully localize your charts. Elements that can be modified include the names of the culture, the writing system, and the calendar used, as well as formatting dates and strings.

The culture property of the CFXValueFormat class allow you to assign culture specific formatting to labels and numbers for a selected axis.

Pre-defined message identifiers with the defualt values for each key (key=value):

NoData=No Data Available
LicDownloading=Downloading License ...
DataDownloading=Downloading Chart ...
DataFailed=Failed to download Chart\n{0}
Mask.Percentage=%s\n%l\n%v out of %t\n(%p%%)
Mask.OHLC=%l\nOpen: %v2\nHigh: %v4 - Low: %v1\nClose: %v3
Mask.HLC=%l\nHigh: %v3 - Low: %v1\nClose %v2
Mask.Ini=%s\n%l\nFrom %i to\n%v
Mask.XY=%s\n%l\nX: %x, Y: %v
Mask.Between=%s\n%l - %l\n%v - %v
Mask.Default=%s\n%l\n%v
LegMask.Series=Series #{0}
LegMask.Values=Value #{0}
CFX61B0=A temporary file on {0} could not be created
XAxis=X Axis
YAxis=Y Axis
General=General
Series=Series
Chart=Chart Area
Draw=Drawing Area
AllSeries=All Series
Auto=Auto
None=None
Raised=Raised
Light=Light
Dark=Dark
Opposite=Opposite
Shadow=Shadow
Number=Number
Currency=Currency
Scientific=Scientific
Percentage=Percentage
Date=Short Date
LongDate=Long Date
Time=Time
DateTime=Date-Time
Label0=Horizontal
Label1=Vertical
Label2=45 Degrees
Inside=Inside
Outside=Outside
Cross=Across
ExportFilter=ChartFX File (*.cfx)|*.cfx|Text File (data only)|*.txt|XML File (properties only)|*.xml|Bitmap Image (*.bmp)|*.bmp|Metafile Picture (*.emf)|*.emf
ImportFilter=ChartFX Files (*.cfx)|*.cfx|Text Files (data only)|*.txt|XML Files(properties only)|*.xml
NoPermission=The application does not have enough permissions to execute this operation.

Declared In
ChartFX.h

recalculateScale

Resets and recalculates all scale values.

- (void) recalculateScale
Discussion

This method should be invoked to force Chart FX to calculate the Min, Max and Step for the axes.

Please keep in mind that this method reads the entire data array, so abusing this method could affect the performance of your application, as Chart FX will read the entire data array every time this method is called.

This method will not affect the step and minorStep if they have been previously set. To make sure they respond to this method make sure the Step and MinorStep properties are set to zero (0).

A typical case of when to use this method is when you disable the autoScale property to calculate your min and max and you set new data to the chart that causes the scale values to be recalculated to show the appropriate data.

When using a stacked style chart, recalculating the scale will sometimes make the chart more readable.

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

setMessageText:forKey:

Allows you to customize default Chart FX strings which are displayed in the chart.

- (void) setMessageText:(NSString *)message forKey(NSString *)key
Parameters
message
The new string value for the message.
forKey
Pre-defined message identifier.
Declared In
ChartFX.h

setMessageText:forKey:

Allows you to customize default Chart FX strings which are displayed in the chart.

- (void) setMessageText:(NSString *)message forKey(NSString *)key
Parameters
message
The new string value for the message.
forKey
Pre-defined message identifier.
Declared In
ChartFX.h

updateSizeNow

Allows you to force a scale calculation before the chart is drawn.

- (void) updateSizeNow
Declared In
ChartFX.h

Constants

CFXAxesStyle

Define the style for the axes surround the chart area.

typedef enum {
   CFXNone,
   CFXFrame3D,
   CFXMath,
   CFXFlatFrame,
   CFXX,
   CFXY
} CFXAxesStyle;
Constants
CFXNone
No frame is displayed around the axis.
CFXFrame3D
A 3D frame will be shown as the axis.
CFXMath
Only tickmarks will be shown as the axis.
CFXFlatFrame
A single, flat frame is displayed in the axis.
CFXX
Description goes here
CFXY
Description goes here
Declared In
chartfx.h

CFXChartStyles

Define end user access to several functions provided through the Chart FX end user interface.

typedef enum {
   CFXTrackMouse,
   CFXDoubleBuffer,
   CFXGetTipDrag,
   CFXNoLegInvalidate,
   CFXPaintMarker,
   CFXOnlyChart,
   CFXSideBySide,
   CFXMonochrome,
   CFXCacheImage,
   CFXExportXValues,
   CFXFastLegends,
   CFXCrosshairs,
   CFXToolTips,
   CFXMenusOnDemand,
   CFXDefault,
   CFXScrollBars,
   CFXAllowScroll,
   CFXForceDataDriven,
   CFXAssemblyNameOnly,
   CFXNoTextSmoothing,
   CFXPaintNoChart,
   CFXHideZLabels,
   CFXUseCallbacksForEvents
} CFXChartStyles;
Constants
CFXTrackMouse
This constant has to be included for those charts you want to capture mouse tracking.
CFXDoubleBuffer
The chart will refresh itself using a double buffering technique. The effect will be a less flickering.
CFXGetTipDrag
Will get the toolltip even while dragging the mouse
CFXNoLegInvalidate
Useful for RealTime charts. Is this flag is ON, the chart will not be invalidated when the legends are set.
CFXPaintMarker
This constant will turn on message event for customize chart drawing process.
CFXOnlyChart
Makes the chart to hide everything outside the chart area such a axis,titles,etc.This feature is very useful when you want to overlap charts.
CFXSideBySide
For 2D MultiType charts, makes the bars to be side-by-side instead of overlapped.
CFXMonochrome
Turn ON will show a Black & White chart and it won't be possible to change chart colors.
CFXCacheImage
Keeps a snapshot of the chart, as it was painted the last time, into an image in memory. When a paint message is received due to some external action (e.g. a window is moved on top of the chart and then away from it or closed), the image is painted into the graphics instead of drawing the chart again, this improves performace and provides a smooth experience. When the chart is changed through any of its properties a new image is generated.
CFXExportXValues
If this flag is ON, the X values are exported to the clipboard every time you export the chart as data.
CFXFastLegends
Disable the legend size computation. Use this flag to improve speed on setting the legends. You must set this flag on BEFORE setting any legend. You can not show a legend box if the legends are set while this flag is on. If you are going to set a new set of legends you must call the ClearLegend property before starting to set the legends in order to get the best performance.
CFXCrosshairs
Turn on or off the cross-hairs feature.
CFXToolTips
Turn on or off the tool-tips feature.
CFXMenusOnDemand
See ContextMenus property.
CFXDefault
Sets default settings.
CFXScrollBars
When OFF, it will hide the Scrollbars.
CFXAllowScroll
When OFF, none of the Axes will allow scroll.
CFXForceDataDriven
ForceDataDriven
CFXAssemblyNameOnly
Assembly name only
CFXNoTextSmoothing
When ON, it will not be smootihing for the text.
CFXPaintNoChart
When ON, the chart will not be painted.
CFXHideZLabels
When ON, the z labels will be hidden.
CFXUseCallbacksForEvents
Instructs the charts to use callbacks instead of PostBacks for the chart's events
Declared In
chartfx.h

CFXGallery

Available chart types

typedef enum {
   CFXNone,
   CFXLines,
   CFXBar,
   CFXArea,
   CFXScatter,
   CFXPie,
   CFXCurve,
   CFXPareto,
   CFXStep,
   CFXHighLowClose,
   CFXSurface,
   CFXRadar,
   CFXPolar,
   CFXCube,
   CFXDoughnut,
   CFXPyramid,
   CFXBubble,
   CFXOpenHighLowClose,
   CFXCandlestick,
   CFXContour,
   CFXCurveArea,
   CFXGantt
} CFXGallery;
Constants
CFXNone
None
CFXLines
Line Chart
CFXBar
Bar Chart
CFXArea
Area Chart
CFXScatter
Scatter Chart
CFXPie
Pie Chart
CFXCurve
Curve Chart
CFXPareto
Pareto Chart
CFXStep
Step Chart
CFXHighLowClose
Hi-Low-Close Chart
CFXSurface
Surface Chart
CFXRadar
Radar Chart
CFXPolar
Polar Chart.
CFXCube
Cube Chart
CFXDoughnut
Doughnut Chart
CFXPyramid
Pyramid Chart
CFXBubble
Bubble Chart
CFXOpenHighLowClose
Open-High-Low-Close Chart
CFXCandlestick
Candlestick Chart
CFXContour
Countour Chart
CFXCurveArea
Curve Area Chart
CFXGantt
Gantt Chart
Declared In
chartfx.h