AWFBarLegend
Objective-C
@interface AWFBarLegend : NSObject <AWFLegendRenderer>
Swift
class AWFBarLegend : NSObject, AWFLegendRenderer
An AWFBarLegend is an object that adopts the AWFLegendRenderer protocol and is responsible for rendering a legend image based on a specific legend
configuration and style.
A bar legend is typically used to represent contoured and/or gradient data on a map, such as temperatures or wind speeds.
-
The legend configuration.
Declaration
Objective-C
@property (nonatomic, strong) AWFLegendConfig *_Nonnull config;Swift
var config: AWFLegendConfig { get set } -
The orientation of the legend. The default value is
AWFLegendOrientationHorizontal.Declaration
Objective-C
@property (nonatomic) AWFLegendOrientation orientation;Swift
var orientation: AWFLegendOrientation { get set } -
An array of color stops that define the bar legend.
Declaration
Objective-C
@property (nonatomic, strong, nullable) NSArray *colorStops;Swift
var colorStops: [Any]? { get set } -
The min and max values and data interval for the legend’s scale.
Declaration
Objective-C
@property (nonatomic) AWFDataScale scale;Swift
var scale: AWFDataScale { get set } -
The style associated with the legend.
Declaration
Objective-C
@property (nonatomic, strong) AWFLegendStyle *_Nonnull style;Swift
var style: AWFLegendStyle { get set } -
A Boolean value indicating whether the legend should be rendered using Metric values when applicable.
Declaration
Objective-C
@property (nonatomic, getter=isMetric) BOOL metric;Swift
var isMetric: Bool { get set } -
Initializes and returns a newly allocated bar renderer with the specified legend configuration instance.
Declaration
Objective-C
- (nonnull instancetype)initWithConfig:(nonnull AWFLegendConfig *)config;Swift
init(config: AWFLegendConfig)Parameters
configThe 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
sizeThe size for the image.
insetsThe margin insets to use when rendering.
Return Value
A rendered legend image, or
nilif 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
View on GitHub
AWFBarLegend Class Reference