CFXFieldMap Class Reference

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

Overview

The FieldMap class allows you to configure how a specific field of the data source will be bound to the Chart. The FieldMap objects are stored in the FieldMapCollection which can be accessed through the fields property of the CFXDataSourceSettings class.

Use the name property to configure the name of the corresponding field in the data source. If the displayName property is not configured, the chart will display the value of the name property. The usage property is the most important property since it allows you to configure how the column will be bound. For example, the column can represent Y values, X values, and categorical labels which will be used by the X axis.

Properties

displayName

Gets or sets the name of the field which will be displayed by the Chart.

@property(nonatomic) NSString *displayName
Discussion

Sometimes, the name of the field as defined in the DataSource is not very explicit. This property allows you to modify how the field's name will be displayed by the chart. Depending on the usage of the field, the value of the DisplayName property can be rendered as a series legend, a axis title, a label, or a key label.

If this property is not initialized, the chart wil render information based on the value of the name property.

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

name

Gets or sets the name of the DataSource's field related to the FieldMap.

@property(nonatomic) NSString *name
Discussion

If the displayName property is not initialized, the chart wil render information based on the value of the Name property. Depending on the usage of the field, the value of the Name property can be rendered as a series legend, a axis title, a label, or a key label.

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

usage

Gets or sets the usage of the related column of the ResultSet.

@property(nonatomic) CFXFieldUsage usage
Discussion

The Usage property should be configured BEFORE a DataSource is passed to the chart.

This property is used to control how Chart FX will use individual fields of a resultset. Using the supported FieldUsage enumerations, developers my specify exactly how each column of data in a dataset should be used, if used at all.

This property is very useful when it is required to change the default rules Chart FX applies to retrieve data from a data control. The following are the default rules:

1) Series Legends will be taken from the numerical field names.

2) All numerical columns will be plotted as different series and all string and/or date columns will be plotted as point legends (joined by the '-' character).

3) All string and numerical fields specified in the SELECT statement will be plot.

Sometimes, the name of the field as defined in the DataSource is not very explicit. The displayName property allows you to modify how the field's name will be displayed by the Chart. Depending on the Usage of the field, the value of the displayName property can be rendered as a series legend, a axis title, a label, or a key label.

See the documentation of the fields property of the CFXDataSourceSettings class for more information.

Declared In
ChartFX.h

Constants

CFXFieldUsage

Define how Chart FX should treat the different fields available in the data set.

typedef enum {
   CFXDefault,
   CFXLabel,
   CFXValue,
   CFXXValue,
   CFXKeyLabel,
   CFXFromValue,
   CFXColumnHeading,
   CFXRowHeading,
   CFXNotUsed
} CFXFieldUsage;
Constants
CFXDefault
If the field is numeric use it as an additional data series. If the field is a string or text use it as a legend.
CFXLabel
Instructs Chart FX to treat the selected field as a string. Therefore a legend.
CFXValue
Instructs Chart FX to treat the selected field as a number. Therefore an additional data series.
CFXXValue
Instructs Chart FX to treat the selected field as a number to be used as the X axis coordinate. Use this option if you are creating XY Plots.
CFXKeyLabel
Instructs Chart FX to treat the selected field as a string that will be used as the key label for the X Axis.
CFXFromValue
Instructs Chart FX to treat the selected field as a number to be used to set initial values for data points to achieve floating bars and area charts.
CFXColumnHeading
Instructs Chart FX to treat the selected field as a ColumnHeading. (For use only with the CrossTab provider. ColumnHeadings relate to Series in CrossTab.)
CFXRowHeading
Instructs Chart FX to treat the selected field as a Row Heading. (For use only with the CrossTab provider. Row Headings relate to Points in CrossTab.)
CFXNotUsed
Instructs Chart FX to ignore this field from the result set.
Declared In
chartfx.h