AWFPointLegend

Objective-C

@interface AWFPointLegend : NSObject <AWFLegendRenderer>

Swift

class AWFPointLegend : NSObject, AWFLegendRenderer

An AWFPointLegend is an object that adopts the AWFLegendRenderer protocol and is responsible for rendering a pointlegend image based on a specific legend configuration and style.

A point legend is typically used to represent point (annotation) and shape (polygon) data on a map, such as earthquakes or storm reports.

  • The legend configuration.

    Declaration

    Objective-C

    @property (nonatomic, strong) AWFLegendConfig *_Nonnull config;

    Swift

    var config: AWFLegendConfig { get set }
  • An array of point items to display for the legend.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSArray<AWFPointLegendItem *> *_Nonnull items;

    Swift

    var items: [AWFPointLegendItem] { get set }
  • The style associated with the legend.

    Declaration

    Objective-C

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

    Swift

    var style: AWFLegendStyle { get set }
  • An array of point item keys used to limit which point items are displayed. If nil, then all point items will be rendered.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSArray<NSString *> *_Nonnull filterKeys;

    Swift

    var filterKeys: [String] { 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