AWFGraphRenderer

Objective-C

@interface AWFGraphRenderer : NSObject

Swift

class AWFGraphRenderer : NSObject

AWFGraphRenderer is the base class used to render series data onto a graph view. This class should not be used alone and must be subclassed to provide all drawing based on the desired result and renderer type.

  • The graph view this renderer instance belongs to.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) AWFGraphView *graphView;

    Swift

    var graphView: AWFGraphView? { get set }
  • The receiver’s delegate.

    A graph renderer sends messages to its delegate regarding the selection and deselecton of series item data points.

    Declaration

    Objective-C

    @property (nonatomic, nullable) id<AWFGraphRendererDelegate> delegate;

    Swift

    unowned(unsafe) var delegate: AWFGraphRendererDelegate? { get set }
  • Renders a series item in the graph.

    Declaration

    Objective-C

    - (void)drawSeriesItem:(nonnull AWFSeriesItem *)seriesItem;

    Swift

    func draw(_ seriesItem: AWFSeriesItem)

    Parameters

    seriesItem

    The series item to render

  • Updates all series items managed by this renderer.

    Declaration

    Objective-C

    - (void)update;

    Swift

    func update()
  • Updates all series items managed by this renderer for the specified zoom scale.

    This is called automatically by the parent graph view when its zoom scale changes and should not be called directly.

    Declaration

    Objective-C

    - (void)adjustForZoomScale:(CGFloat)zoomScale;

    Swift

    func adjust(forZoomScale zoomScale: CGFloat)

    Parameters

    zoomScale

    The zoom scale to use

  • Returns the layer that was hit at the specified point, if any.

    This is used to determine if a series item data element was tapped from the parent graph view.

    Declaration

    Objective-C

    - (nonnull CALayer *)hitTest:(CGPoint)point inView:(nonnull UIView *)view;

    Swift

    func hitTest(_ point: CGPoint, in view: UIView) -> CALayer

    Parameters

    point

    The point to test against

    view

    The view in which to test

    Return Value

    The layer that was hit, otherwise nil if none were hit.

  • Selects the graph renderer item at the index of the specified seriesItem. If a callout view is available, this method will also display a callout view containing the value of the item at the selected point and series item.

    Note: The provided seriesItem must use this renderer type in order for the item to be selected.

    Declaration

    Objective-C

    - (void)selectItemAtIndex:(NSInteger)index
                 inSeriesItem:(nonnull AWFSeriesItem *)seriesItem;

    Swift

    func selectItem(at index: Int, in seriesItem: AWFSeriesItem)

    Parameters

    index

    The index of the point in the series item to select.

    seriesItem

    The series item that contains the point to select.

  • Deselects all selected graph renderer items, if any, and dismisses the callout view.

    Declaration

    Objective-C

    - (void)deselectAllItems;

    Swift

    func deselectAllItems()