AWFLegendRenderer

Objective-C

@protocol AWFLegendRenderer <NSObject>

Swift

protocol AWFLegendRenderer : NSObjectProtocol

The AWFLegendRenderer protocol defines the required properties and methods for an object that renders a legend.

  • The style associated with the legend.

    Declaration

    Objective-C

    @property (nonatomic, strong) AWFLegendStyle *_Nonnull style;

    Swift

    var style: AWFLegendStyle { get set }
  • Initializes and returns a newly allocated bar renderer with the specified legend configuration instance.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithConfig:(AWFLegendConfig *_Nonnull)config;

    Swift

    init(config: AWFLegendConfig)

    Parameters

    config

    The legend configuration.

    Return Value

    An initialized legend renderer.

  • Renders and returns a legend image with for the specified image size and insets.

    Declaration

    Objective-C

    - (nullable UIImage *)imageForSize:(CGSize)size insets:(UIEdgeInsets)insets;

    Swift

    func image(for size: CGSize, insets: UIEdgeInsets) -> UIImage?

    Parameters

    size

    The size for the image.

    insets

    The margin insets to use when rendering.

    Return Value

    A rendered legend image, or nil if an image could not be generated.

  • Returns the minimum size required to render the legend based on the legend’s configuration and style.

    Declaration

    Objective-C

    - (CGSize)sizeThatFits;

    Swift

    func sizeThatFits() -> CGSize