SChartBarColumnSeries Class Reference

Inherits from SChartCartesianSeries : SChartMappedSeries : SChartSeries : NSObject
Declared in SChartBarColumnSeries.h
Availability Standard
Premium
Related samples BarChart
ColumnChart

Overview

This is the base class for column and bar series - containing all of the common functions between the two. To display a bar or column series on the chart init and use one of the classes SChartBarSeries or SChartColumnSeries respectively.

Properties

detectTapsOutsideBar

Whether or not hit detection can be triggered by tapping outside of the bar/column.

@property (atomic) BOOL detectTapsOutsideBar

Discussion

The default value is NO.

Declared In

SChartBarColumnSeries.h

numberOfCornerEdges

The number of edges used to create a rounded corner. The default value is 15.

@property (nonatomic, assign) NSUInteger numberOfCornerEdges

Discussion

This value can be lowered to reduce the amount of memory used when creating bars & columns with rounded corners. However, this will impacts the smoothness of the rounded corners.

This value can be raised to increase the smoothness of the rounded corners on bars & columns. However, this will impacts performance and increase memory usage.

Declared In

SChartBarColumnSeries.h

orientation

The orientation of the axis with which this series is associated.

@property (nonatomic, assign) SChartSeriesOrientation orientation

Discussion

SChartSeriesOrientation is defined as follows:

  • SChartSeriesOrientationHorizontal: Configures the orientation of the axis with which this series is associated to be horizontal. Thus the controlled variable will be drawn on the x-axis, while the measured variable will be drawn on the y-axis.
  • SChartSeriesOrientationVertical: Configures the orientation of the axis with which this series is associated to be vertical. Thus the controlled variable will be drawn on the y-axis, while the measured variable will be drawn on the x-axis.

The orientation for bar/column series is vertical, and the orientation for column series is horizontal.

Declared In

SChartBarColumnSeries.h

Instance Methods

selectedStyle

Returns the selected style object for this series.

- (SChartBarColumnSeriesStyle *)selectedStyle

Discussion

These style settings will be applied when the series is marked as selected (or a datapoint is selected).

When a series is created, its style is set from the theme. If you wish to customize the look of the series, you can tweak the properties of the style to configure it correctly, or you can create a new style object and set it on the series.

Declared In

SChartBarColumnSeries.h

setSelectedStyle:

Sets the selected style object for this series.

- (void)setSelectedStyle:(SChartBarColumnSeriesStyle *)selectedStyle

Parameters

selectedStyle

The new style to use for this series when it is marked as selected.

Discussion

These style settings will be applied when the series is marked as selected (or a datapoint is selected).

You would use this method if you wished to modify the look of the series when it is selected.

Declared In

SChartBarColumnSeries.h

setStyle:

Sets the style object for this series.

- (void)setStyle:(SChartBarColumnSeriesStyle *)style

Parameters

style

The new style to use for this series.

Discussion

You would use this method if you wished to modify the look of the series in its normal state.

Declared In

SChartBarColumnSeries.h

style

Returns the style object for this series.

- (SChartBarColumnSeriesStyle *)style

Discussion

When a series is created, its style is set from the theme. If you wish to customize the look of the series, you can tweak the properties of the style to configure it correctly, or you can create a new style object and set it on the series.

Declared In

SChartBarColumnSeries.h

styleForPoint:

Specifies the style to use on a per-point basis

- (SChartBarColumnSeriesStyle *)styleForPoint:(id<SChartData>)point

Parameters

point

The data-point that will be styled by the returned style object.

Discussion

This method is called for each datapoint in this series and the standard implementation chooses to return either the style or selectedStyle object based on the selectionMode and selected state of either the point or the series. Computationally expensive operations here will increase initial render time.

Use the sChartXValue & sChartYValue properties to access each datapoint’s X & Y values. Here is an example of how to use these properties to style each bar/column:

SChartBarColumnSeriesStyle *newStyle = [super styleForPoint:point];

float xValue = [[point sChartXValue] floatValue];

newStyle.showAreaWithGradient = NO;

if (xValue > 90) { newStyle.areaColor = [UIColor redColor]; } else if(xValue > 50) { newStyle.areaColor = [UIColor yellowColor]; } else { newStyle.areaColor = [UIColor greenColor]; } return newStyle; }

Declared In

SChartBarColumnSeries.h