SChartTheme Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in SChartTheme.h
Availability Standard
Premium
Related samples ColumnChart
PieChart
FinancialChart

Overview

The SChartTheme class is responsible for storing styling information for the chart’s visual components, such as its titles, axes & tickmarks, and series.

Each theme contains a number of style objects that affect the look of certain aspects of the chart such as its axis, its title or its crosshair. These style objects are exposed as properties on the theme. There are also a number of style objects for each series type - for most series, six different styles are provided per theme. Radial and financial (ohlc, candlestick) series only have a one style per theme. These are accessed via a method on the theme, for example line series styles are returned by:

 SChartLineSeriesStyle *thirdSelectedLineSeriesStyle = [theme lineSeriesStyleForSeriesAtIndex: 2 selected: YES];
 SChartColumnSeriesStyle *secondUnselectedColumnSeriesStyle = [theme columnSeriesStyleForSeriesAtIndex: 2 selected: NO];

Note that if there are more series on the chart than there are series styles provided by the theme, the chart will loop through the style objects it has, using the first style object again once it has cycled through its available styles.

A theme is applied to a chart via the applyTheme: method. For example:

 [chart applyTheme: theme];

The applyTheme: message is passed to the chart upon the initialisation of the chart, applying either the theme you provided to the chart via initWithFrame:withTheme: (or initWithFrame:withTheme:withPrimaryXAxisType:withPrimaryYAxisType:) or the default theme. Applying a theme to a chart will overwrite any changes to any of the style objects on the chart or its series previously - you should make any further customisations after applying the theme.

ShinobiCharts comes with several pre-created subclasses of SChartTheme:

  • iOS Seven Theme: Solid colors without gradients, crisp & clear text (default iOS 7+)
  • Light Theme: Brighter colors based on a white background (default pre-iOS 7)
  • Dark Theme: Softer colors on a black background

A chart running on a version of iOS older than iOS 7 will use the light theme by default, whereas a chart running on iOS 7 or later will default to using our SChartiOS7Theme All themes are, however, available to all versions of iOS - just use them as normal. For example, you could use SChartiOS7Theme on iOS 5.

There are two recommended ways to provide your own custom theme:

  • You can use one of the provided SChartTheme classes and customise the style objects provided on it.
  • You can subclass one of the SChartTheme classes, customise the style objects provided, and override the ‘{line, band, bar, column, donut, ohlc}SeriesStyleForSeriesAtIndex:selected:’ method to return your own series styles.

    More information about using SChartTheme can be found in the user guide.

Tasks

Initializing a theme

Individual style objects

Colors for this theme

Fonts

Managing series styles

Series styles

Properties

barLineWidth

Default line width for all bar series

@property (nonatomic, retain) NSNumber *barLineWidth

Discussion

Use this setting to apply a consistent line width across all bar series. After setting this value call [ShinobiChart applyTheme] on your chart. This value will be used by default. If you have explicitly set the bar width on your series, that value will take precedence over the default. By default, this property is set to 1.

Declared In

SChartTheme.h

blackColor

Black palette color.

@property (nonatomic, retain) UIColor *blackColor

Discussion

This is used for:

  • The color of the box displayed during box gestures.
  • The text color on the chart title and the axis titles.
  • The color of the legend text and border.
  • The color of axis tick marks and labels.
  • The outline drawn for candlestick chart series.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

blackColorLowAlpha

Black palette color with reduced alpha.

@property (nonatomic, retain) UIColor *blackColorLowAlpha

Discussion

This is used for tracking lines on box gestures, and for the major grid lines on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

blueColorDark

Blue palette color.

@property (nonatomic, retain) UIColor *blueColorDark

Discussion

This is used for:

  • The area fill color underneath the third line series on the chart.
  • The color of the third bar/column series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

blueColorLight

Blue palette color with increased brightness.

@property (nonatomic, retain) UIColor *blueColorLight

Discussion

This is used for:

  • The color of the third line series on the chart.
  • The color of the lower limiting line in the second band series on the chart.
  • The color of the third bar/column series on the chart.
  • The color of points in the third scatter series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

boldFontName

The name of the bold font to use within the theme.

@property (nonatomic, retain) NSString *boldFontName

Declared In

SChartTheme.h

boxGestureStyle

Style options relating to the box gesture.

@property (nonatomic, retain) SChartBoxGestureStyle *boxGestureStyle

Discussion

This includes properties such as:

  • The color of the box which is displayed.
  • The color of tracking lines.
  • The width of the lines on the box.
  • The width of the tracking lines.

Declared In

SChartTheme.h

chartStyle

Style options relating to the overall chart for cartesian charts.

@property (nonatomic, retain) SChartStyle *chartStyle

Discussion

This includes properties such as:

  • The background color of the chart.
  • The border of the chart.

See Also

Declared In

SChartTheme.h

chartTitleStyle

Style options relating to the chart title.

@property (nonatomic, retain) SChartMainTitleStyle *chartTitleStyle

Discussion

This includes properties such as:

  • The color, font and alignment of the title.
  • Whether the title overlaps with the chart.

Declared In

SChartTheme.h

columnLineWidth

Default line width for all column series

@property (nonatomic, retain) NSNumber *columnLineWidth

Discussion

Use this setting to apply a consistent line width across all column series. After setting this value call [ShinobiChart applyTheme] on your chart. This value will be used by default. If you have explicitly set the column line width on your series, that value will take precedence over the default. By default, this property is set to 1.

Declared In

SChartTheme.h

crosshairStyle

Style options relating to the chart crosshair.

@property (nonatomic, retain) SChartCrosshairStyle *crosshairStyle

Discussion

This includes properties such as:

  • The color and width of crosshair lines.
  • The color and font of the crosshair tooltip.
  • The width and color of the crosshair tooltip border.

Declared In

SChartTheme.h

donutCrustThickness

Default outline or ‘crust’ thickness for all donut series

Use this setting to apply a consistent crust thickness across all donut series. After setting this value call [ShinobiChart applyTheme] on your chart. This value will be used by default. If you have explicitly set the donut crust thickness on your series, that value will take precedence over the default. By default, this property is set to 5.

@property (nonatomic, retain) NSNumber *donutCrustThickness

Declared In

SChartTheme.h

greenColorBrightLight

Green palette color with increased brightness.

@property (nonatomic, retain) UIColor *greenColorBrightLight

Discussion

This is used for the color of rising data points in the first candlestick series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

greenColorDark

Green palette color.

@property (nonatomic, retain) UIColor *greenColorDark

Discussion

This is used for:

  • The area fill color underneath the second line series on the chart.
  • The color of the second bar/column series on the chart.
  • The color of rising data points in the first OHLC series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

greenColorLight

Green palette color with increased brightness.

@property (nonatomic, retain) UIColor *greenColorLight

Discussion

This is used for:

  • The line color of the second line series on the chart.
  • The color of the upper limiting line in the first band series on the chart.
  • The color of points in the first band series on the chart.
  • The color of the second bar/column series on the chart.
  • The color of points in the second scatter series on the chart.
  • The color of rising data points in the first OHLC series on the chart.
  • The color of rising data points in the first candlestick series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

legendStyle

Style options relating to the chart legend.

@property (nonatomic, retain) SChartLegendStyle *legendStyle

Discussion

This includes properties such as:

  • The color and font of text in the legend.
  • The alignment of symbols in the legend.
  • The color of the legend border.
  • The corner radius of the legend.
  • The background color of the legend.
  • The padding around the legend.

Declared In

SChartTheme.h

lightFontName

The name of the light font to use within the theme.

@property (nonatomic, retain) NSString *lightFontName

Discussion

This is used for labels on major axis ticks.

Declared In

SChartTheme.h

lineWidth

Default line width for all line series

@property (nonatomic, retain) NSNumber *lineWidth

Discussion

Use this setting to apply a consistent line width across all line series. After setting this value call [ShinobiChart applyTheme] on your chart. This value will be used by default. If you have explicitly set the line width on a line series, that value will take precedence over the default. By default, this property is set to 1.

Declared In

SChartTheme.h

orangeColorDark

Orange palette color.

@property (nonatomic, retain) UIColor *orangeColorDark

Discussion

This is used for:

  • The area fill color underneath the fourth line series on the chart.
  • The color of the fourth bar/column series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

orangeColorLight

Orange palette color with increased brightness.

@property (nonatomic, retain) UIColor *orangeColorLight

Discussion

This is used for:

  • The color of the fourth line series on the chart.
  • The color of the upper limiting line in the second band series on the chart.
  • The color of points in the second band series on the chart.
  • The color of the fourth bar/column series on the chart.
  • The color of the fourth scatter series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

pieCrustThickness

Default outline or ‘crust’ thickness for all pie series

@property (nonatomic, retain) NSNumber *pieCrustThickness

Discussion

Use this setting to apply a consistent crust thickness across all pie series. After setting this value call [ShinobiChart applyTheme] on your chart. This value will be used by default. If you have explicitly set the pie crust thickness on your series, that value will take precedence over the default. By default, this property is set to 1.

Declared In

SChartTheme.h

purpleColorDark

Purple palette color.

@property (nonatomic, retain) UIColor *purpleColorDark

Discussion

This is used for:

  • The area fill color below the fifth line series on the chart.
  • The color of the fifth bar/column series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

purpleColorLight

Purple palette color with increased brightness.

@property (nonatomic, retain) UIColor *purpleColorLight

Discussion

This is used for:

  • The color of the fifth line series on the chart.
  • The color of the lower limiting line on the third band series on the chart.
  • The color of the fifth bar/column series on the chart.
  • The color of the fifth scatter series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

radialChartStyle

Style options relating to the overall chart for radial charts.

@property (nonatomic, retain) SChartStyle *radialChartStyle

Discussion

This includes properties such as:

  • The background color of the chart.
  • The border of the chart.

See Also

Declared In

SChartTheme.h

redColorBrightLight

Red palette color with increased brightness.

@property (nonatomic, retain) UIColor *redColorBrightLight

Discussion

This is used for:

  • The color of falling data points in the first OHLC series on the chart.
  • The color of falling data points in the first candlestick series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

redColorDark

Red palette color.

@property (nonatomic, retain) UIColor *redColorDark

Discussion

This is used for:

  • Area fill underneath the first line series on the chart.
  • The color of the first bar/column series on the chart.
  • The color of falling data points in the first candlestick series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

redColorLight

Red palette color with increased brightness.

@property (nonatomic, retain) UIColor *redColorLight

Discussion

This is used for:

  • The line color of the first line series on the chart.
  • The color of the lower limiting line of the first band series on the chart.
  • The color of the first bar/column series on the chart.
  • The color of points in the first scatter series on the chart.
  • The color of falling data points in the first OHLC series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

regularFontName

The name of the regular font to use within the theme.

@property (nonatomic, retain) NSString *regularFontName

Discussion

This is used for:

  • The chart title.
  • The axis titles.
  • Text in the legend.
  • Text in the crosshair tooltip.
  • Labels in the first donut series on the chart.

Declared In

SChartTheme.h

xAxisRadialStyle

Style options relating to the radial axis (x-axis) of any radial charts.

@property (nonatomic, retain) SChartAxisStyle *xAxisRadialStyle

Discussion

This includes properties such as:

  • The color and font of the axis title.
  • The position of the axis title.
  • The width and color of the axis.
  • The width and color of tick marks on the axis.
  • Whether tick marks are shown.
  • The color of grid lines on the chart for the x axis.
  • Whether grid lines are shown.

See Also

Declared In

SChartTheme.h

xAxisStyle

Style options relating to the x axis of any cartesian charts.

@property (nonatomic, retain) SChartAxisStyle *xAxisStyle

Discussion

This includes properties such as:

  • The color and font of the axis title.
  • The position of the axis title.
  • The width and color of the axis.
  • The width and color of tick marks on the axis.
  • Whether tick marks are shown.
  • The color of grid lines on the chart for the x axis.
  • Whether grid lines are shown.

See Also

Declared In

SChartTheme.h

yAxisRadialStyle

Style options relating to the polar axis (y-axis) of any radial charts.

@property (nonatomic, retain) SChartAxisStyle *yAxisRadialStyle

Discussion

This includes properties such as:

  • The color and font of the axis title.
  • The position of the axis title.
  • The width and color of the axis.
  • The width and color of tick marks on the axis.
  • Whether tick marks are shown.
  • The color of grid lines on the chart for the y axis.
  • Whether grid lines are shown.

See Also

Declared In

SChartTheme.h

yAxisStyle

Style options relating to the y axis of any cartesian charts.

@property (nonatomic, retain) SChartAxisStyle *yAxisStyle

Discussion

This includes properties such as:

  • The color and font of the axis title.
  • The position of the axis title.
  • The width and color of the axis.
  • The width and color of tick marks on the axis.
  • Whether tick marks are shown.
  • The color of grid lines on the chart for the y axis.
  • Whether grid lines are shown.

See Also

Declared In

SChartTheme.h

yellowColorDark

Yellow palette color.

@property (nonatomic, retain) UIColor *yellowColorDark

Discussion

This is used for:

  • The area fill color below the sixth line series on the chart.
  • The color of the sixth bar/column series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

yellowColorLight

Yellow palette color with increased brightness.

@property (nonatomic, retain) UIColor *yellowColorLight

Discussion

This is used for:

  • The color of the sixth line series on the chart.
  • The color of the upper limiting line on the third band series on the chart.
  • The color of points in the third band series on the chart.
  • The color of the sixth bar/column series on the chart.
  • The color of the sixth scatter series on the chart.

The theme color properties are included to allow you to access the colors used within the theme, and use them elsewhere in your app.

Declared In

SChartTheme.h

Instance Methods

addBandSeriesStyle:asSelected:

Stores the series style in the array of band series styles

- (void)addBandSeriesStyle:(SChartBandSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Discussion

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

Declared In

SChartTheme.h

addBarSeriesStyle:asSelected:

Stores the series style in the array of bar series styles

- (void)addBarSeriesStyle:(SChartBarSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Discussion

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

Declared In

SChartTheme.h

addCandlestickSeriesStyle:asSelected:

Stores the series style in the array of candlestick series styles

- (void)addCandlestickSeriesStyle:(SChartCandlestickSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Discussion

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

Declared In

SChartTheme.h

addColumnSeriesStyle:asSelected:

Stores the series style in the array of column series styles

- (void)addColumnSeriesStyle:(SChartColumnSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Discussion

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

Declared In

SChartTheme.h

addDonutSeriesStyle:asSelected:

Encodes the donut series style object and stores in the array of donut series styles.

- (void)addDonutSeriesStyle:(SChartDonutSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Discussion

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

Declared In

SChartTheme.h

addLineSeriesStyle:asSelected:

Adds a series style to the array of line series styles contained within the theme.

- (void)addLineSeriesStyle:(SChartLineSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Discussion

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

Declared In

SChartTheme.h

addOHLCSeriesStyle:asSelected:

Stores the series style in the array of ohlc series styles

- (void)addOHLCSeriesStyle:(SChartOHLCSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Discussion

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

Declared In

SChartTheme.h

addScatterSeriesStyle:asSelected:

Stores the series style in the array of scatter series styles

The theme contains two sets of series styles - one for series in their normal state, and one for when they are selected. When you add a series style to the theme, you can specify when it should be used on a series using the selected parameter.

- (void)addScatterSeriesStyle:(SChartScatterSeriesStyle *)newStyle asSelected:(BOOL)selected

Parameters

newStyle

The series style to add to the theme.

selected

If this is set to YES, the style will be used for series when they are selected.

Declared In

SChartTheme.h

bandSeriesStyleForSeriesAtIndex:selected:

Returns the band series style for the specified series on the chart.

- (SChartBandSeriesStyle *)bandSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

barSeriesStyleForSeriesAtIndex:selected:

Returns the bar series style for the specified series on the chart.

- (SChartBarSeriesStyle *)barSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

bubbleSeriesStyleForSeriesAtIndex:selected:

Returns the bubble series style for the specified series on the chart.

- (SChartBubbleSeriesStyle *)bubbleSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

candlestickSeriesStyleForSeriesAtIndex:selected:

Returns the candlestick series style for the specified series on the chart.

- (SChartCandlestickSeriesStyle *)candlestickSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

columnSeriesStyleForSeriesAtIndex:selected:

Returns the column series style for the specified series on the chart.

- (SChartColumnSeriesStyle *)columnSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

donutSeriesStyleForSeriesAtIndex:selected:

Returns the donut series style for the specified series on the chart.

- (SChartDonutSeriesStyle *)donutSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

init

Initializes and returns a newly allocated theme object with default settings.

- (id)init

Return Value

An initialized theme object or nil if the object couldn’t be created.

Declared In

SChartTheme.h

lineSeriesStyleForSeriesAtIndex:selected:

Returns the line series style for the specified series on the chart.

- (SChartLineSeriesStyle *)lineSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

ohlcSeriesStyleForSeriesAtIndex:selected:

Returns the OHLC series style for the specified series on the chart.

- (SChartOHLCSeriesStyle *)ohlcSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

radialLineSeriesStyleForSeriesAtIndex:selected:

Returns the radial line series style for the specified series on the chart.

- (SChartRadialLineSeriesStyle *)radialLineSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h

scatterSeriesStyleForSeriesAtIndex:selected:

Returns the scatter series style for the specified series on the chart.

- (SChartScatterSeriesStyle *)scatterSeriesStyleForSeriesAtIndex:(NSInteger)seriesIndex selected:(BOOL)selected

Parameters

seriesIndex

The index of the series on the chart.

selected

If set to YES, this method returns the selected style for the series. If not, this method returns the normal style for the series.

Return Value

The style to use for the given series.

Declared In

SChartTheme.h