NChartValueAxis Class Reference

Inherits from NChartAxis : NChartObject : NSObject
Declared in NChartValueAxis.h

Overview

The NChartValueAxis class provides methods to display the value axis of the chart.

  kind

Kind of axis.

@property (nonatomic, readonly) NChartValueAxisKind kind

Declared In

NChartValueAxis.h

  minValue

Minimal value on the axis. It is obtained from the data source and, if needed, processed to look more beautiful.

@property (nonatomic, readonly) double minValue

Declared In

NChartValueAxis.h

  maxValue

Maximal value on the axis. It is obtained from the data source and, if needed, processed to look more beautiful.

@property (nonatomic, readonly) double maxValue

Declared In

NChartValueAxis.h

  step

Step from one tick to another. It is either obtained from the data source or, if not provided, calculated according to the minValue and maxValue to look beautiful.

@property (nonatomic, readonly) double step

Declared In

NChartValueAxis.h

  minDate

Minimal date on the axis. It is obtained from the data source and, if needed, processed to look more beautiful.

@property (nonatomic, readonly) NSDate *minDate

Discussion

This property works in date mode only, if hasDates is YES. Otherwise it returns nil.

Declared In

NChartValueAxis.h

  maxDate

Maximal date on the axis. It is obtained from the data source and, if needed, processed to look more beautiful.

@property (nonatomic, readonly) NSDate *maxDate

Discussion

This property works in date mode only, if hasDates is YES. Otherwise it returns nil.

Declared In

NChartValueAxis.h

  dateStep

Time interval from one date tick to another. It is either obtained from the data source or, if not provided, calculated according to the minDate and maxDate to look beautiful.

@property (nonatomic, readonly) NSTimeInterval dateStep

Discussion

This property works in date mode only, if hasDates is YES. Otherwise it returns 0.

Declared In

NChartValueAxis.h

  ticks

Array of strings that are displayed as ticks on the axis. It is obtained from the data source or nil if not provided.

@property (nonatomic, readonly) NSArray *ticks

Declared In

NChartValueAxis.h

  tickCount

Number of ticks on the axis. It is the number of ticks in an array or the number of values between minValue and maxValue through step.

@property (nonatomic, readonly) NSInteger tickCount

Declared In

NChartValueAxis.h

  length

Length of axis in 3D scene units. This value is obtained from the data source or, if not provided, is assigned to 1. It has an effect for axes being displayed in 3D only. In 2D this value is ignored because axes fill the whole area available on the screen. One 3D scene unit is equal to half a screen size by initial zoom (so space of the 3D scene is actually nonlinear respective to the screen). Therefore, by default all axes have equal length and form a kind of cube in 3D that is centered on the screen and is as big as half of the biggest screen’s dimension. However, if you want, for example, to make the Z-axis shorter than the others, you can provide a length of 0.5 for it. It will therefore be twice as short as the others.

@property (nonatomic, readonly) double length

Declared In

NChartValueAxis.h

  color

Color of the axis line.

@property (nonatomic, strong) UIColor *color

Declared In

NChartValueAxis.h

  font

Font for the ticks' labels.

@property (nonatomic, strong) UIFont *font

Declared In

NChartValueAxis.h

  textColor

Color of the text for the ticks' labels.

@property (nonatomic, strong) UIColor *textColor

Declared In

NChartValueAxis.h

  hasOffset

Flag that determines if there should be an offset on the axis. The offset is the spacing from the beginning of the axis to the first tick and from the last tick to the end of the axis. If this flag is YES, the spacing is half a step. If NO, spacing is zero.

@property (nonatomic, assign) BOOL hasOffset

Declared In

NChartValueAxis.h

  minTickSpacing

Minimal spacing between neighbor ticks in pixels (the tick is the center place for the tick label, a kind of milestone on the axis). According to this value some labels can be hidden, if there are too many of them. The default value is 50.

@property (nonatomic, assign) float minTickSpacing

Declared In

NChartValueAxis.h

  maxLabelLength

Maximal allowed label length in pixels. If 0, maximal label width is calculated automatically according to the length between neighbor ticks. The default value is 0.

@property (nonatomic, assign) float maxLabelLength

Declared In

NChartValueAxis.h

  labelsLineBreakMode

Line break mode for axis labels. The default value is NSLineBreakByWordWrapping.

@property (nonatomic, assign) NSLineBreakMode labelsLineBreakMode

Declared In

NChartValueAxis.h

  thickness

Thickness of the axis' line in pixels.

@property (nonatomic, assign) float thickness

Declared In

NChartValueAxis.h

  lineDash

Dash of the axis' line.

@property (nonatomic, strong) NChartLineDash *lineDash

See Also

Declared In

NChartValueAxis.h

  majorTicks

Major ticks of the axis. Major ticks are spread from the minValue to the maxValue through step or, if no minValue and maxValue are provided but a ticks array is provided, the whole axis length is divided by the number of ticks and for each tick there is a major tick displayed. Major ticks can be labeled.

@property (nonatomic, readonly) NChartAxisTick *majorTicks

See Also

Declared In

NChartValueAxis.h

  minorTicks

Minor ticks of the axis. Minor ticks are displayed in the middle between two neighbor major ticks. See majorTicks for details.

@property (nonatomic, readonly) NChartAxisTick *minorTicks

See Also

Declared In

NChartValueAxis.h

  tinyTicks

Tiny ticks of the axis. Tiny ticks are displayed between consecutive major ticks. However there is a gap in tiny ticks where tiny ticks potentially overlap with major/minor ticks (even if major/minor ticks are switched off). See majorTicks, minorTicks and tinyTickIntervalsPerInterval for details.

@property (nonatomic, readonly) NChartAxisTick *tinyTicks

See Also

Declared In

NChartValueAxis.h

  tinyTickIntervalsPerInterval

Number of tiny intervals the interval between two consecutive major ticks is split up into. Tiny intervals are bounded with the tiny ticks. The default value is 0, which means no tiny ticks are displayed.
If for example this value is 10, that means each interval between two labels is split up into 10 sub-intervals and therefore should have 11 tiny ticks inside. However, only 8 tiny ticks will be visible, and 1th, 6th and 11th ticks will be discarded, because they potentially overlap with major/minor ticks (even if major/minor ticks are switched off).

@property (nonatomic, assign) NSInteger tinyTickIntervalsPerInterval

Declared In

NChartValueAxis.h

  caption

Caption of the axis.

@property (nonatomic, readonly) NChartLabel *caption

See Also

Declared In

NChartValueAxis.h

  labelsVisible

Flag that determines if the labels of ticks are visible (YES) or not (NO). The default value is YES.

@property (nonatomic, assign) BOOL labelsVisible

Declared In

NChartValueAxis.h

  lineVisible

Flag that determines if the line of the axis is visible (YES) or not (NO). The default value is NO.

@property (nonatomic, assign) BOOL lineVisible

Declared In

NChartValueAxis.h

  alwaysShowZero

Flag that determines whether zero is always on the axis. This flag makes sense if minValue and maxValue are both less or greater than zero and are beautified according to the data source. In this case, if this flag is false, it may happen, that no zero will be on the axis (for example, if minValue = 11.5 and maxValue = 19, the axis will probably start with 10 and end with 20, having 4 steps). With this flag set to true, zero will always be on the axis, so even with minValue = 11.5 and maxValue = 19 the axis will start with 0 and end with 20 having probably 5 steps or so. The default value is NO.

@property (nonatomic, assign) BOOL alwaysShowZero

Declared In

NChartValueAxis.h

  labelsIn3D

Flag that determines whether the axis labels are in “perspective” screen (YES) or are projected in the 2D screen (NO). This flag only affects 3D-charts. The default value is YES.

@property (nonatomic, assign) BOOL labelsIn3D

Declared In

NChartValueAxis.h

  captionIn3D

Flag that determines whether the axis caption is in “perspective” screen (YES) or is projected in the 2D screen (NO). This flag only affects 3D-charts. The default value is YES.

@property (nonatomic, assign) BOOL captionIn3D

Declared In

NChartValueAxis.h

  shouldBeautifyMinAndMax

Flag that determines whether min and max values on the axis should be beautified in case they are calculated (YES) or not (NO). The default value is YES.

@property (nonatomic, assign) BOOL shouldBeautifyMinAndMax

Declared In

NChartValueAxis.h

  labelsAngle

Axis labels' rotation angle.

@property (nonatomic, assign) float labelsAngle

See Also

Declared In

NChartValueAxis.h

  labelsAlignment

Alignment of the axis labels relative to the axis ticks. The default value for X-Axis is NChartAxisLabelsAlignmentCenter, for Y-Axis is NChartAxisLabelsAlignmentRight, for Z-Axis is NChartAxisLabelsAlignmentLeft.

@property (nonatomic, assign) NChartAxisLabelsAlignment labelsAlignment

Declared In

NChartValueAxis.h

  dataSource

Data source of the axis.

@property (nonatomic, assign) id<NChartValueAxisDataSource> dataSource

Declared In

NChartValueAxis.h

  delegate

Delegate of the axis.

@property (nonatomic, assign) id<NChartValueAxisDelegate> delegate

Declared In

NChartValueAxis.h

– zoomToRegionFrom:to:duration:delay:

Zoom to given region by specifying the least and the greatest values that should be visible on the axis. If the axis has array of ticks, indices in this array can be used. Use this method after you updated data of the chart with [chart updateData] call.

- (void)zoomToRegionFrom:(float)startValue to:(float)endValue duration:(float)duration delay:(float)delay

Parameters

startValue
  • least value that should be visible.
endValue
  • greatest value that should be visible.
duration
  • duration of the animation in seconds.
delay
  • delay of animation in seconds.

Declared In

NChartValueAxis.h

– zoomToDateRegionFrom:to:duration:delay:

Zoom to given region by specifying the earliest and the latest dates that should be visible on the axis. This method works in date mode only, if hasDates is YES. Use this method after you updated data of the chart with [chart updateData] call.

- (void)zoomToDateRegionFrom:(NSDate *)startDate to:(NSDate *)endDate duration:(float)duration delay:(float)delay

Parameters

startDate
  • earliest date that should be visible.
endDate
  • latest date that should be visible.
duration
  • duration of the animation in seconds.
delay
  • delay of animation in seconds.

Declared In

NChartValueAxis.h

  marks

Array of axis marks.

@property (nonatomic, readonly) NSArray *marks

Declared In

NChartValueAxis.h

– addMark:

Add axis mark.

- (void)addMark:(NChartValueAxisMark *)mark

Parameters

mark
  • mark to add.

Declared In

NChartValueAxis.h

– removeMark:

Remove axis mark.

- (void)removeMark:(NChartValueAxisMark *)mark

Parameters

mark
  • mark to remove.

Declared In

NChartValueAxis.h

– removeAllMarks

Remove all axis marks.

- (void)removeAllMarks

Declared In

NChartValueAxis.h

– calcOptimalMinTickSpacing

Calculate optimal value for minTickSpacing.
Use this method if you want to get minTickSpacing that corresponds to the actual lengths of axis ticks' labels.

- (void)calcOptimalMinTickSpacing

Discussion

You should call this method after the updateData call of the chart, because this method operates with the data obtained from data source. If you call it before the data are updated, the result will be wrong.

Declared In

NChartValueAxis.h

– fitZoomByMinTickSpacingWithDuration:delay:

Fit the zoom according to the current minTickSpacing.
Use this method if you want to zoom the chart so that the maximal number of points is visible with no skipping of ticks on the axis.

- (void)fitZoomByMinTickSpacingWithDuration:(float)duration delay:(float)delay

Parameters

duration
  • duration of the animation in seconds.
delay
  • delay of animation in seconds.

Discussion

This method requires frame of the chart to be determined. So if you call this method before the chart’s layout, it will fail. If you want the axes to be automatically zoomed according to the minTickSpacing, use the flag shouldAutoFitZoomByMinTickSpacing.

Declared In

NChartValueAxis.h

  shouldAutoFitZoomByMinTickSpacing

Flag determining if zoom of the axis should be automatically fit according to the current minTickSpacing (YES) or not (NO). The default value is NO.
Set this flag to YES if you want to zoom the chart so that the maximal number of points is visible with no skipping of ticks on the axis. Best practice is to set this flag and call calcOptimalMinTickSpacing.

@property (nonatomic, assign) BOOL shouldAutoFitZoomByMinTickSpacing

Discussion

If this flag is set to YES, zoom of the axis is changed automatically by each chart’s layout. Zoom you set manually before layout will be ignored.

Auto fitting works in 2D mode only.

Declared In

NChartValueAxis.h

  hasDates

Flag indicating if axis displays dates instead of values (YES) or regular values (NO). The default value is NO.

@property (nonatomic, assign) BOOL hasDates

Declared In

NChartValueAxis.h

  isContinuous

Flag determining if axis is continuous (YES) or not (NO). The default value is YES. Continuous axis changes its step when chart is zoomed in. For example, if the step of axis is 1 and this flag is set to YES, than, when you zoom the chart in, the step will be changed to 0.5, then to 0.25 and so on. However if this flag is set to NO, the step will remain to be 1. Note, that if you zoom out and there is not enough place for ticks, the step will be changed independently of this flag to skip some ticks and avoid overlapping. You can control this skipping by minTickSpacing property. If the axis has discrete ticks, this property is ignored.

@property (nonatomic, assign) BOOL isContinuous

Declared In

NChartValueAxis.h

  isLogarithmic

Flag determining if axis has logarithmic scale (YES) or linear scale (NO). The default value is NO. The base of scale’s logarithm is controlled by logarithmBase property.

@property (nonatomic, assign) BOOL isLogarithmic

Declared In

NChartValueAxis.h

  logarithmBase

Base of logarithm for logarithmic scale. The default value is 10.

@property (nonatomic, assign) double logarithmBase

Discussion

This property takes effect if isLogarithmic is set to YES only.

Declared In

NChartValueAxis.h

  positionX

Coordinate controlling horizontal position of the axis.

@property (nonatomic, readonly) NChartAxisPositionCoord *positionX

Declared In

NChartValueAxis.h

  positionY

Coordinate controlling vertical position of the axis.

@property (nonatomic, readonly) NChartAxisPositionCoord *positionY

Declared In

NChartValueAxis.h

  positionZ

Coordinate controlling depth position of the axis.

@property (nonatomic, readonly) NChartAxisPositionCoord *positionZ

Declared In

NChartValueAxis.h

  isFlipped

Flag determining if value axis is flipped (displayed from max to min, YES) or not (displayed from min to max, NO). The default value is NO.

@property (nonatomic, assign) BOOL isFlipped

Declared In

NChartValueAxis.h

  visibleRange

Get values (or dates, if the axis has dates) range visible on the screen in current chart zoom/pan position. You can alter this value by zoomToRegion call.

@property (nonatomic, readonly) NChartValueAxisRange *visibleRange

Declared In

NChartValueAxis.h

  referenceValueInZero

Flag determining if the axis reference value is in its zero value (YES) or minimal value (NO). The default value is YES. The reference value is kind of “floor” value used by some of the series. For example, columns and bars use reference to indicate where to “grow” from. If this value is YES and there are positive and negative values in the series data, columns with positive value will grow up from zero and the ones with negative value will grow down from zero. Otherwise, if this flag is NO, all the columns will grow up from minimum.

@property (nonatomic, assign) BOOL referenceValueInZero

Declared In

NChartValueAxis.h

  isCaptionReversed

Flag determining if axis caption is reversed (rotated 180 degrees, YES) or not (NO). The default value is NO.

@property (nonatomic, assign) BOOL isCaptionReversed

Declared In

NChartValueAxis.h