CFXGradientBackground Class Reference

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

Overview

As opposed to marker gradients, background gradients are used for cosmetic purposes only. In other words, background gradients are only used to enhance the chart's visual appearance and have no direct relation to the data contained in the chart. When applied to the chart background, gradients can help you achieve a superior visual effect for your desktop and web applications.

In Chart FX, background gradients can be applied to two rectangular areas in the chart area: The chart's inside background (i.e., PlotAreaBackground) and the main background (i.e., background). Chart FX allows horizontal, vertical, diagonal and radial gradients when applying gradient fills to either of these areas of the chart.

To set the gradient colors, you can use the colors, colorFrom and colorTo properties. When creating two color gradients, you can control the gradient brush using the factor and position properties. The position property allows you to specify where each color will start and stop in a multicolor gradient background.

In order to use this functionality you must include jchartfx.advanced.js in your project.

Properties

angle

Sets the gradient angle when using the 'Angled' gradient background.

@property(nonatomic) Single angle
Discussion

The Angle method supports values ranging from 0 to 360 degrees.

You must select the 'Angled' type gradient when creating the GradientBackground object in order for this method to take effect.

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

colorFrom

Gets or sets the beginning color of a gradient.

@property(nonatomic) UIColor colorFrom
Discussion

This method sets the beginning color of a gradient. You can also set the beginning color of the gradient by utilizing the colors method using index zero.

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

colors

Gets or sets the colors to be used for a gradient background.

@property(nonatomic) ColorCollection colors
Parameters
n
A zero-based index indicating colors to be used in a gradient background.
Discussion

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

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

colorTo

Ending color of a gradient.

@property(nonatomic) UIColor colorTo
Discussion

This method sets the ending color of a gradient. You can also set the ending color of the gradient by setting the last index of the colors collection.

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

effectArea

Gets or sets a value indicating the percentage of chart area affected by a GradientBackground.

@property(nonatomic) int effectArea
Discussion

This method may be configured to a value between 0 and 100. The default value is 20, indicating that 20 percent of the chart is affected by a gradient background.

Specifying 100 indicates the entire chart background should be configured with a GradientBackground.

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

factor

Specifies the percentages of the starting color and the ending color to use at the corresponding position for two color gradients.

@property(nonatomic) FloatCollection factor
Parameters
n
A zero based index specifying the factor corresponding to a gradient position.
Discussion

The Factor property is only supported for two color gradients.

Each configured Factor of a gradient will have a corresponding position value.

The elements of this array property are a values ranging from 0.0 through 1.0.

Declared In
ChartFX.h

position

Gives access to a collection that allows you to specify positions along the gradient background to correspond with color and factor attributes.

@property(nonatomic) FloatCollection position
Parameters
n
A zero based index specifying the position in the gradient.
Discussion

The range of this array method is represented by values between 0.0 and 1.0; the first position value must be 0.0 and the last position value must be 1.0.

For two color gradients, each position value must have a corresponding factor value.

Declared In
ChartFX.h

type

Sets the style of the gradient for a selected gradient background.

@property(nonatomic) CFXGradientType type
Discussion

When using the 'Angled' gradient enumeration, you can set the desired angle for the gradient using the angle method.

Declared In
ChartFX.h

Constants

CFXGradientType

Gradient Types.

typedef enum {
   CFXHorizontal,
   CFXVertical,
   CFXBackwardDiagonal,
   CFXForwardDiagonal,
   CFXRadial,
   CFXAngled
} CFXGradientType;
Constants
CFXHorizontal
Gradient painted from left to right.
CFXVertical
Gradient painted from top to bottom.
CFXBackwardDiagonal
Gradient painted from top right to bottom left.
CFXForwardDiagonal
Gradient painted from top left to bottom right.
CFXRadial
Gradient painted in a circular manner from outside to inside.
CFXAngled
Gradient painted using the configured angle value.
Declared In
chartfx.h