ShinobiChart

@interface ShinobiChart : UIView

A ShinobiChart displays data arranged in either cartesian or radial series. Here is an example with a few of the common features labelled:

A ShinobiChart will display its cartesian series (line, column, bar, scatter) if a cartesian series is added to it first, or all its radial series (donuts, pies) if a radial series is added to it first. If a radial series is added to a ‘cartesian chart’ or vice versa, a warning will be issued and that series discarded.

Data is always represented in a series or a set of series. The SChartSeries determines the look and style of the data contained in a SChartDataSeries. There is a one-to-one relationship between a chart series and the data series it represents.

A chart must have a minimum of one x-axis and one y-axis to display cartesian series, however, these will be automatically generated if none are specified.

A ShinobiChart must have an object that acts as the data source to display any data and optionally can have an object that acts as the delegate. The data source must adopt the SChartDatasource protocol and the delegate must adopt the SChartDelegate protocol. The data source provides the information needed by the chart to construct the series and represent the data. Series are identified by an index integer by the data source.

The ShinobiChart is a subclass of UIView, and as such it can be added to other parent views or set as the root view of a view controller.

A ShinobiChart will only update to reflect any changes to data when the reloadData method is called.

  • The frame of the plot area in the coordinate system of the chart view.

    This is the area in which your data is visualised in series. This area does not usually contain the chart title, legend, axes or axis titles, or any tickmarks or ticklabels unless they are explicitly positioned inside the plot area.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) CGRect plotAreaFrame;

    Swift

    var plotAreaFrame: CGRect { get }
  • Background color of the chart view

    Declaration

    Objective-C

    - (nullable UIColor *)chartBackgroundColor;

    Swift

    func chartBackgroundColor() -> UIColor?
  • Background colour of the plot area - ie: the area inside the axis.

    Declaration

    Objective-C

    - (nullable UIColor *)plotBackgroundColor;

    Swift

    func plotBackgroundColor() -> UIColor?
  • The Inset of the chart’s canvas frame using the top, left, bottom & right values in the UIEdgeInsets object given.

    This inset will get applied after the canvas has taken everything else into account (e.g. chart and axis title positioning).

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UIEdgeInsets canvasInset;

    Swift

    var canvasInset: UIEdgeInsets { get set }
  • Tells the chart to reposition its legend.

    The chart legend is an instance of SChartLegend. The chart uses the value of its position property to position the legend on its canvas.

    Declaration

    Objective-C

    - (void)positionLegend;

    Swift

    func positionLegend()
  • Tells the chart to redraw itself. The chart is redrawn during the next draw cycle.

    Declaration

    Objective-C

    - (void)redrawChart;

    Swift

    func redraw()
  • Tells the chart to redraw itself, as long as it has basic componenents. If the chart is radial, it doesn’t need to have any axes set in order to redraw.

    Declaration

    Objective-C

    - (void)setNeedsLayoutIfHaveAxesAndData;

    Swift

    func setNeedsLayoutIfHaveAxesAndData()
  • Defines whether the chart rotates when the device is rotated.

    If the view that contains the chart doesn’t actually rotate for a device orientation, set this flag to NO to prevent unnecessary fade out/in of the axes and the crosshair.

    By default, this property is set to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL rotatesOnDeviceRotation;

    Swift

    var rotatesOnDeviceRotation: Bool { get set }
  • Returns a string that represents the specified x and y values

    A primary use case for this method is to generate text for the crosshair.

    Declaration

    Objective-C

    - (nonnull NSString *)stringForX:(double)x andY:(double)y;

    Swift

    func stringFor(x: Double, andY y: Double) -> String

    Parameters

    x

    The specified x value.

    y

    The specified y value.

  • The object that acts as the chart’s delegate.

    The object must adopt the SChartDelegate protocol. The SChartDelegate protocol provides the chart with a target to relay events to, such as when the user is zooming or other touch events. Objects that act as a delegate to the ShinobiChart can use these notifications to synchronise other charts or update objects with the current status of this chart.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<SChartDelegate> delegate;
  • The object that acts as the data source of the receiving chart.

    The object must adopt the SChartDatasource protocol. The data source provides the chart with the information it needs to construct the chart object. In general, styling and event response is handled by objects implementing the SChartDelegate protocol - the data source has minimal impact on the look and feel of the chart.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<SChartDatasource> datasource;
  • The primary x-axis for this chart.

    The chart contains an array of x axes, as different series on the chart could use different axes. The primary axis is the main one used by the chart. If you haven’t explicitly specified which axis is the primary one, this will be automatically generated by the chart.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) SChartAxis *xAxis;

    Swift

    var xAxis: SChartAxis? { get set }
  • The primary y-axis for this chart.

    The chart contains an array of y axes, as different series on the chart could use different axes. The primary axis is the main one used by the chart. If you haven’t explicitly specified which axis is the primary one, this will be automatically generated by the chart.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) SChartAxis *yAxis;

    Swift

    var yAxis: SChartAxis? { get set }
  • Adds an X-Axis for the chart

    Declaration

    Objective-C

    - (void)addXAxis:(nonnull SChartAxis *)newXAxis;

    Swift

    func addXAxis(_ newXAxis: SChartAxis)

    Parameters

    newXAxis

    The new x axis which will be added to the chart.

  • Adds a Y-Axis for the chart

    Declaration

    Objective-C

    - (void)addYAxis:(nonnull SChartAxis *)newYAxis;

    Swift

    func addYAxis(_ newYAxis: SChartAxis)

    Parameters

    newYAxis

    The new y axis which will be added to the chart.

  • Removes an X-Axis from the chart

    If this is the only x axis on the chart, it won’t be removed.

    Declaration

    Objective-C

    - (void)removeXAxis:(nonnull SChartAxis *)xAxis;

    Swift

    func removeXAxis(_ xAxis: SChartAxis)

    Parameters

    xAxis

    The axis which will be removed from the chart.

  • Removes a Y-Axis from the chart

    If this is the only y axis on the chart, it won’t be removed.

    Declaration

    Objective-C

    - (void)removeYAxis:(nonnull SChartAxis *)yAxis;

    Swift

    func removeYAxis(_ yAxis: SChartAxis)

    Parameters

    yAxis

    The axis which will be removed from the chart.

  • Replaces a X-Axis on the chart

    Declaration

    Objective-C

    - (void)replaceXAxis:(nonnull SChartAxis *)oldXAxis
                withAxis:(nonnull SChartAxis *)newXAxis;

    Swift

    func replaceXAxis(_ oldXAxis: SChartAxis, with newXAxis: SChartAxis)

    Parameters

    oldXAxis

    The axis which will be replaced.

    newXAxis

    The axis which will replace it.

  • Replaces a Y-Axis on the chart

    Declaration

    Objective-C

    - (void)replaceYAxis:(nonnull SChartAxis *)oldYAxis
                withAxis:(nonnull SChartAxis *)newYAxis;

    Swift

    func replaceYAxis(_ oldYAxis: SChartAxis, with newYAxis: SChartAxis)

    Parameters

    oldYAxis

    The axis which will be replaced.

    newYAxis

    The axis which will replace it.

  • Returns all axes associated with this chart

    A chart can contain multiple x and y axes, if the series on the chart use different axes.

    Declaration

    Objective-C

    - (nonnull NSArray<SChartAxis *> *)allAxes;

    Swift

    func allAxes() -> [SChartAxis]

    Return Value

    An array containing all the axes associated with this chart. The x axes will be first in the array, followed by the y axes.

  • Returns all Primary axes associated with this chart

    A chart can contain multiple x and y axes, if the series on the chart use different axes. A chart will always have one primary x axis, and one primary y axis, unless it is radial.

    Declaration

    Objective-C

    - (nonnull NSArray<SChartAxis *> *)primaryAxes;

    Swift

    func primaryAxes() -> [SChartAxis]

    Return Value

    An array containing the primary axes associated with the chart. The array will contain the primary x axis, followed by the primary y axis.

  • Returns all Secondary axes associated with this chart

    A chart can contain multiple x and y axes, if the series on the chart use different axes. A chart will always have one primary x axis, and one primary y axis, unless it is radial. All the other axes on the chart are regarded as secondary.

    Declaration

    Objective-C

    - (nonnull NSArray<SChartAxis *> *)secondaryAxes;

    Swift

    func secondaryAxes() -> [SChartAxis]

    Return Value

    An array containing the secondary axes associated with the chart. The array will contain the secondary x axes, followed by the secondary y axes.

  • Returns all X axes associated with this chart

    A chart can contain multiple x axes, if the series on the chart use different axes. A chart will always have one primary x axis, unless it is radial.

    Declaration

    Objective-C

    - (nonnull NSArray<SChartAxis *> *)allXAxes;

    Swift

    func allXAxes() -> [SChartAxis]

    Return Value

    An array containing all the x axes associated with the chart. The primary axis will be the first one in the array.

  • Returns all Y axes associated with this chart

    A chart can contain multiple y axes, if the series on the chart use different axes. A chart will always have one primary y axis, unless it is radial.

    Declaration

    Objective-C

    - (nonnull NSArray<SChartAxis *> *)allYAxes;

    Swift

    func allYAxes() -> [SChartAxis]

    Return Value

    An array containing all the y axes associated with the chart. The primary axis will be the first one in the array.

  • Returns all secondary X axes associated with this chart

    A chart can contain multiple x axes, if the series on the chart use different axes. A chart will always have one primary x axis, unless it is radial. All the other axes on the chart are regarded as secondary.

    Declaration

    Objective-C

    - (nonnull NSArray<SChartAxis *> *)secondaryXAxes;

    Swift

    func secondaryXAxes() -> [SChartAxis]

    Return Value

    An array containing all the secondary x axes associated with the chart.

  • Returns all secondary Y axes associated with this chart

    A chart can contain multiple y axes, if the series on the chart use different axes. A chart will always have one primary y axis, unless it is radial. All the other axes on the chart are regarded as secondary.

    Declaration

    Objective-C

    - (nonnull NSArray<SChartAxis *> *)secondaryYAxes;

    Swift

    func secondaryYAxes() -> [SChartAxis]

    Return Value

    An array containing all the secondary y axes associated with the chart.

  • Returns this chart’s primary X Axis

    A chart can contain multiple x axes, if the series on the chart use different axes. A chart will always have one primary x axis, unless it is radial.

    Declaration

    Objective-C

    - (nullable SChartAxis *)primaryXAxis;

    Swift

    func primaryXAxis() -> SChartAxis?
  • Returns this chart’s primary Y Axis

    A chart can contain multiple y axes, if the series on the chart use different axes. A chart will always have one primary y axis, unless it is radial.

    Declaration

    Objective-C

    - (nullable SChartAxis *)primaryYAxis;

    Swift

    func primaryYAxis() -> SChartAxis?
  • Finds the axes associated with the chart which are linked to the specified chart series.

    This method then sets the axis pointers, which are passed in as arguments, to reference the axes which are associated with the chart series.

    Declaration

    Objective-C

    - (void)axesForSeries:(nonnull SChartSeries *)series
                   storeX:(SChartAxis *_Nullable *_Nonnull)xStore
                andStoreY:(SChartAxis *_Nullable *_Nonnull)yStore;

    Swift

    func axes(for series: SChartSeries, storeX xStore: AutoreleasingUnsafeMutablePointer<SChartAxis?>, andStoreY yStore: AutoreleasingUnsafeMutablePointer<SChartAxis?>)

    Parameters

    series

    The chart series of interest

    xStore

    A pointer to a chart axis. In this method, we set the pointer to reference the x axis associated with the chart series.

    yStore

    A pointer to a chart axis. In this method, we set the pointer to reference the y axis associated with the chart series. @exception The chart will throw a fatal exception if it cannot find an x axis and a y axis on the chart which are linked to the specified chart series.

  • A readonly array of the SChartSeries objects displayed on the chart.

    Series are provided to the chart by its data source. Once it has pulled them in from the data source and rendered them, you can query the series on the chart via this property.

    Modifying the data points in any of these series will have no effect on the data rendered in the chart. To update it, update the chart data source, and then call reloadData on the chart.

    If you are reloading the data in your chart asynchronously, you will want to be notified when new data has loaded, as this will affect the series on the chart. To do this, you should implement the SChartDelegate protocol, and use the sChartWillStartLoadingData: and the sChartDidFinishLoadingData: methods.

    Declaration

    Objective-C

    @property (readonly, strong, atomic) NSArray<SChartSeries *> *_Nonnull series;

    Swift

    var series: [SChartSeries] { get }
  • Sets the text value of the chart title and displays in the standard position.

    See also titleLabel for the property representing the actual SChartTitle object.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) NSString *title;

    Swift

    var title: String? { get set }
  • The title for the chart.

    This object is created and automatically handled through the title property. However, modifying this object will give greater control over the title attributes.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) SChartTitle *_Nonnull titleLabel;

    Swift

    var titleLabel: SChartTitle { get set }
  • A BOOLean to indicate if the chart title label should reserve space at the top of the chart or overlap the canvas.

    Setting this attribute to YES will allow the UILabel to appear over the chart plot area. Setting it to NO will push the canvas area down and reserve space obove the chart plots for the title. calculateTargetBounds controls the space reserved for chart objects outside of the canvas area.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL overlapChartTitle;

    Swift

    var overlapChartTitle: Bool { get set }
  • Sets how the title centers.

    • SChartTitleCentreOnChart Centers the title on the full chart view.
    • SChartTitleCentreOnPlottingArea Centers the title on the plot area.
    • SChartTitleCentreOnCanvas Centers the title on the canvas.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) SChartTitleCentresOn titleCentresOn;

    Swift

    var titleCentresOn: SChartTitleCentresOn { get set }
  • Where the title will appear relative to the chart

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) SChartTitlePosition titlePosition;

    Swift

    var titlePosition: SChartTitlePosition { get set }
  • The object that represents the chart’s legend.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) SChartLegend *_Nonnull legend;

    Swift

    var legend: SChartLegend { get set }
  • Applies a theme to the chart.

    A ShinobiChart will take all of its UI configuration - colors, line thicknesses, etc - from the SChartTheme object. The chart can be initially created with a theme - see initWithFrame:usingTheme:. If a theme is not explicitly set on a chart, an instance of SChartLightTheme will be applied by default on charts running on versions of iOS prior to iOS 7, otherwise an instance of SChartiOS7Theme will be applied.

    This method applies the styling properties of the given theme to the chart, overwriting any changes which you have made to sub-objects on the chart. After this, changes made to individual objects will have precendence - for example setting the series color in the data source. To reset the styling configuration on a chart to a theme, alloc a new theme and call applyTheme: - this will clear all styling configuration from the chart and set it to the theme defaults.

        SChartTheme *chartTheme = [SChartiOS7Theme new];
        [yourChart applyTheme: chartTheme];
    

    Declaration

    Objective-C

    - (void)applyTheme:(nonnull SChartTheme *)theme;

    Swift

    func apply(_ theme: SChartTheme)
  • The background color of the canvas area where the axes and plots are drawn.

    This area does not include any titles and legends etc. To set the background color of the whole chart area use setBackgroundColor.

    By default, this property is set to clearColor.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable)
        UIColor *canvasAreaBackgroundColor;

    Swift

    var canvasAreaBackgroundColor: UIColor? { get set }
  • The background color of the plot area where the series are drawn.

    To set the background color of the whole chart area use backgroundColor - also see canvasAreaBackgroundColor.

    By default, this property is set to clearColor.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable)
        UIColor *plotAreaBackgroundColor;

    Swift

    var plotAreaBackgroundColor: UIColor? { get set }
  • The color of the border around the plot area where the series are drawn.

    To set the border color of the whole chart area use borderColor.

    By default, this property is set to clearColor.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIColor *plotAreaBorderColor;

    Swift

    var plotAreaBorderColor: UIColor? { get set }
  • The thickness of the border around the plot area where the series are drawn.

    To set the border thickness of the whole chart area use borderThickness.

    By default, this property is set to 1.0f .

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat plotAreaBorderThickness;

    Swift

    var plotAreaBorderThickness: CGFloat { get set }
  • The color of the border around the chart view.

    Default value is clearColor.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIColor *borderColor;

    Swift

    var borderColor: UIColor? { get set }
  • The thickness of the border chart view.

    Default value is 1.0f.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) NSNumber *borderThickness;

    Swift

    var borderThickness: NSNumber? { get set }
  • The object displayed after a tap-and-hold gesture on the chart

    The default crosshair implementation will draw a target cirle with axis markers and also display a tooltip. To customize, set this property to an object conforming to the SChartCrosshair protocol.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) id<SChartCrosshair> crosshair;
  • A reference to the canvas object of the chart

    The chart canvas is responsible for drawing all of the axes and series on a chart.

    Declaration

    Objective-C

    @property (readonly, nonatomic) SChartCanvas *_Nonnull canvas;

    Swift

    var canvas: SChartCanvas { get }
  • The chart’s gesture manager

    This class holds the gestures used on the chart, providing access should an extra responder be required for one of the chart’s gestures.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic)
        SChartGestureManager *_Nonnull gestureManager;

    Swift

    var gestureManager: SChartGestureManager { get }
  • Initialise a chart object with a specified frame.

    As we haven’t specified a theme, the default one is used. This is SChartLightTheme.

    Declaration

    Objective-C

    - (nonnull id)initWithFrame:(CGRect)frame;

    Swift

    init(frame: CGRect)

    Parameters

    frame

    The frame to give the new chart.

    Return Value

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

  • Initialise the chart object with the specified frame and the specified theme

    Declaration

    Objective-C

    - (nonnull id)initWithFrame:(CGRect)frame
                      withTheme:(nullable SChartTheme *)theme;

    Swift

    init(frame: CGRect, with theme: SChartTheme?)

    Parameters

    frame

    The frame to give the new chart.

    theme

    The theme to use to style the new chart.

    Return Value

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

  • Initialise the chart object with the specified frame and axes

    As we haven’t specified a theme, the default one is used. This is SChartLightTheme. In this method, we specify the types of axes which we would like on our chart. The init method will create an axis of this type, and set it as the primary axis on the chart. The chart will contain one x axis and one y axis when it is created. We can then add more axes if required.

    Declaration

    Objective-C

    - (nonnull id)initWithFrame:(CGRect)frame
           withPrimaryXAxisType:(SChartAxisType)xAxisType
           withPrimaryYAxisType:(SChartAxisType)yAxisType;

    Swift

    init(frame: CGRect, withPrimaryXAxisType xAxisType: SChartAxisType, withPrimaryYAxisType yAxisType: SChartAxisType)

    Parameters

    frame

    The frame to give the new chart.

    xAxisType

    The type of the primary x axis on the chart.

    yAxisType

    The type of the primary y axis on the chart.

    Return Value

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

  • Initialise the chart object with the specified frame, theme and axes

    In this method, we specify the types of axes which we would like on our chart. The init method will create an axis of this type, and set it as the primary axis on the chart. The chart will contain one x axis and one y axis when it is created. We can then add more axes if required.

    Declaration

    Objective-C

    - (nonnull id)initWithFrame:(CGRect)frame
                      withTheme:(nullable SChartTheme *)theme
           withPrimaryXAxisType:(SChartAxisType)xAxisType
           withPrimaryYAxisType:(SChartAxisType)yAxisType;

    Swift

    init(frame: CGRect, with theme: SChartTheme?, withPrimaryXAxisType xAxisType: SChartAxisType, withPrimaryYAxisType yAxisType: SChartAxisType)

    Parameters

    frame

    The frame to give the new chart.

    theme

    The theme to use to style the chart.

    xAxisType

    The type of the primary x axis on the chart.

    yAxisType

    The type of the primary y axis on the chart.

    Return Value

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

  • Reloads the data points for the chart.

    When the data provided by the data source changes, we use this method to tell the chart to reload. The data is reloaded during the next draw cycle. This method doesn’t redraw the chart, for that you can call either redrawChart or redrawChartIncludePlotArea: after the data has been reloaded.

    This method reloads the data on the main thread. If you wish to load data asynchronously, you should set the loadDataInBackground property to YES before you call this method.

    Declaration

    Objective-C

    - (void)reloadData;

    Swift

    func reloadData()
  • When set to YES, the chart will load its data on a background thread. Otherwise, the chart will load its data on the main UI thread.

    By default, this property is set to NO. If the chart is loading its data asynchronously, it will pop up an activity indicator while the data is loading. See loadingIndicator for more information on this.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL loadDataInBackground;

    Swift

    var loadDataInBackground: Bool { get set }
  • This view will be displayed whilst an asynchronous data reload is in progress. By default it is a UIActivityIndicatorView, but can be assigned any UIView based class – such as an SEssentialsActivityIndicator, UIImageView etc. To support animation of the view, it may also conform to the SChartActivityIndicator protocol and implement its animation methods.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) UIView *loadingIndicator;

    Swift

    var loadingIndicator: UIView? { get set }
  • Notifies the chart that the specified number of data points are available to be appended to the end of the specified chart series.

    More information about using this method can be found in our tutorial Data streaming, crosshairs and custom tooltips in ShinobiCharts.

    Declaration

    Objective-C

    - (void)appendNumberOfDataPoints:(NSInteger)numberOfDataPoints
                toEndOfSeriesAtIndex:(NSInteger)seriesIndex;

    Swift

    func append(numberOfDataPoints: Int, toEndOfSeriesAtIndex seriesIndex: Int)

    Parameters

    numberOfDataPoints

    The number of data points which are available to be appended to the end of the series.

    seriesIndex

    The index of the series which should append the new data.

  • Notifies the chart that the specified number of data points are available to be prepended to the start of the specified chart series.

    Declaration

    Objective-C

    - (void)prependNumberOfDataPoints:(NSInteger)numberOfDataPoints
               toStartOfSeriesAtIndex:(NSInteger)seriesIndex;

    Swift

    func prepend(numberOfDataPoints: Int, toStartOfSeriesAtIndex seriesIndex: Int)

    Parameters

    numberOfDataPoints

    The number of data points which are available to be prepended to the start of the series.

    seriesIndex

    The index of the series to which the new data should be prepended.

  • Notifies the chart that the specified number of data points should be removed from the start of the specified chart series.

    Declaration

    Objective-C

    - (void)removeNumberOfDataPoints:(NSInteger)numberOfDataPoints
            fromStartOfSeriesAtIndex:(NSInteger)seriesIndex;

    Swift

    func remove(numberOfDataPoints: Int, fromStartOfSeriesAtIndex seriesIndex: Int)

    Parameters

    numberOfDataPoints

    The number of data points which should be removed from the start of the series.

    seriesIndex

    The index of the series which should append the new data.

  • Update the canvas to allow for axes, titles, and legend.

    Declaration

    Objective-C

    - (void)updateCanvasSize;

    Swift

    func updateCanvasSize()
  • Tells the chart to redraw itself

    The chart will redraw itself during the next draw cycle. This does not affect the data in the chart. If the data provided by the data source has changed, then you should call reloadData to refresh the data in the chart.

    Declaration

    Objective-C

    - (void)redrawChartIncludePlotArea:(BOOL)includePlotArea;

    Swift

    func redrawIncludePlotArea(_ includePlotArea: Bool)

    Parameters

    includePlotArea

    YES if the chart needs to redraw the data for its series, which is done in the chart plot area.

  • This ensures all pending OpenGL operations are flushed to the graphics card, preventing issues where an App may be put in the background and attempt to invoke OpenGL commands, causing the App to be signalled/killed.

    Declaration

    Objective-C

    - (void)flushPendingGLOperations;

    Swift

    func flushPendingGLOperations()
  • This allows the user to prevent our OpenGL operations from initialising OpenGL objects if the application is about to be put in the background.

    Declaration

    Objective-C

    - (void)setIsEnteringBackground:(BOOL)enteringBackground;

    Swift

    func setIsEnteringBackground(_ enteringBackground: Bool)

    Parameters

    enteringBackground

    YES if the application will go to the background. NO if the application will go to the foreground.

  • Returns a string representing the given x and y double values on the specified chart axes

    This method queries each axis for a string which represents the given value, then concatenates them together to give a single string. The x value is displayed before the y value.

    This method is commonly used for displaying the tooltip on the chart crosshair.

    Declaration

    Objective-C

    - (nonnull NSString *)stringForX:(double)fx
                                andY:(double)fy
                          usingXAxis:(nonnull SChartAxis *)xAxis
                            andYAxis:(nonnull SChartAxis *)yAxis;

    Swift

    func stringFor(x fx: Double, andY fy: Double, usingXAxis xAxis: SChartAxis, andYAxis yAxis: SChartAxis) -> String

    Parameters

    fx

    The value on the x axis.

    fy

    The value on the y axis.

    xAxis

    The x axis on the chart with which the x value is associated.

    yAxis

    The y axis on the chart with which the y value is associated.

    Return Value

    A string representing the given x and y values on the specified chart axes.

  • Returns a string representing the given x and y double values in the specified chart series

    This method queries the series for the string representation of the given x and y values. It then concatenates those strings together. The x value is displayed before the y value.

    This method is commonly used for displaying the tooltip on the chart crosshair.

    Declaration

    Objective-C

    - (nonnull NSString *)stringForX:(double)fx
                                andY:(double)fy
                         usingSeries:(nonnull SChartSeries *)series;

    Swift

    func stringFor(x fx: Double, andY fy: Double, using series: SChartSeries) -> String

    Parameters

    fx

    The value on the x axis.

    fy

    The value on the y axis.

    series

    The chart series with which the values are associated

    Return Value

    A string representing the given double values in the specified chart series.

  • Returns a string representing the given x and y values in the specified chart series

    This method queries the series for the string representation of the given x and y values. It then concatenates those strings together. The x value is displayed before the y value.

    This method is commonly used for displaying the tooltip on the chart crosshair.

    Declaration

    Objective-C

    - (nonnull NSString *)stringForIdX:(nonnull id)fx
                                andIdY:(nonnull id)fy
                           usingSeries:(nonnull SChartSeries *)series;

    Swift

    func string(forIdX fx: Any, andIdY fy: Any, using series: SChartSeries) -> String

    Parameters

    fx

    The value on the x axis.

    fy

    The value on the y axis.

    series

    The chart series with which the values are associated.

    Return Value

    A string representing the given values in the specified chart series.

  • Returns whether the specified chart point is currently visible on the chart

    Declaration

    Objective-C

    - (BOOL)pointIsVisible:(SChartPoint)point
                  onSeries:(nonnull SChartSeries *)series;

    Swift

    func pointIsVisible(_ point: SChartPoint, on series: SChartSeries) -> Bool

    Parameters

    point

    The point of interest on the chart.

    series

    The chart series which contains the point.

    Return Value

    YES if the specified point is visible on the chart.

  • An array of all annotations on the chart.

    Note

    This is a Premium feature

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic)
        NSArray<SChartAnnotation *> *_Nonnull annotations;

    Swift

    var annotations: [SChartAnnotation] { get }
  • Add an annotation view to be displayed on the chart plot area

    Note

    This is a Premium feature

    Declaration

    Objective-C

    - (void)addAnnotation:(nonnull SChartAnnotation *)newAnnotation;

    Swift

    func addAnnotation(_ newAnnotation: SChartAnnotation)

    Parameters

    newAnnotation

    The new annotation to add to the chart.

  • Replace an annotation on the chart with a new one

    Annotations are held in a chart within an array. This method allows you to replace one of those annotations with the new one you have specified.

    Note

    This is a Premium feature

    Declaration

    Objective-C

    - (void)replaceAnnotationAtIndex:(NSInteger)index
                      withAnnotation:(nonnull SChartAnnotation *)newAnnotation;

    Swift

    func replaceAnnotation(at index: Int, with newAnnotation: SChartAnnotation)

    Parameters

    index

    The index of the existing annotation within the array which the chart holds.

    newAnnotation

    The new annotation which you will replace it with.

  • Remove an annotation from the chart

    Note

    This is a Premium feature

    Declaration

    Objective-C

    - (void)removeAnnotation:(nonnull SChartAnnotation *)annotation;

    Swift

    func removeAnnotation(_ annotation: SChartAnnotation)

    Parameters

    annotation

    The annotation to remove.

  • Remove all annotations from the chart

    Note

    This is a Premium feature

    Declaration

    Objective-C

    - (void)removeAllAnnotations;

    Swift

    func removeAllAnnotations()