Core Plot (iOS and tvOS)
Cocoa plotting framework for macOS, iOS, and tvOS
<CPTLegendDelegate> Protocol Reference

Legend delegate. More...

#import <CPTLegend.h>

+ Inheritance diagram for <CPTLegendDelegate>:
+ Collaboration diagram for <CPTLegendDelegate>:

Public Instance Methods

Drawing
(nullable CPTFill *) - legend:fillForEntryAtIndex:forPlot:
 (Optional) This method gives the delegate a chance to provide a background fill for each legend entry. More...
 
(nullable CPTLineStyle *) - legend:lineStyleForEntryAtIndex:forPlot:
 (Optional) This method gives the delegate a chance to provide a border line style for each legend entry. More...
 
(nullable CPTFill *) - legend:fillForSwatchAtIndex:forPlot:
 (Optional) This method gives the delegate a chance to provide a custom swatch fill for each legend entry. More...
 
(nullable CPTLineStyle *) - legend:lineStyleForSwatchAtIndex:forPlot:
 (Optional) This method gives the delegate a chance to provide a custom swatch border line style for each legend entry. More...
 
(BOOL- legend:shouldDrawSwatchAtIndex:forPlot:inRect:inContext:
 (Optional) This method gives the delegate a chance to draw custom swatches for each legend entry. More...
 
Legend Entry Selection
(void) - legend:legendEntryForPlot:wasSelectedAtIndex:
 (Optional) Informs the delegate that the swatch or label of a legend entry received both the touch down and up events. More...
 
(void) - legend:legendEntryForPlot:wasSelectedAtIndex:withEvent:
 (Optional) Informs the delegate that the swatch or label of a legend entry received both the touch down and up events. More...
 
(void) - legend:legendEntryForPlot:touchDownAtIndex:
 (Optional) Informs the delegate that the swatch or label of a legend entry touch started. More...
 
(void) - legend:legendEntryForPlot:touchDownAtIndex:withEvent:
 (Optional) Informs the delegate that the swatch or label of a legend entry touch started. More...
 
(void) - legend:legendEntryForPlot:touchUpAtIndex:
 (Optional) Informs the delegate that the swatch or label of a legend entry touch ended. More...
 
(void) - legend:legendEntryForPlot:touchUpAtIndex:withEvent:
 (Optional) Informs the delegate that the swatch or label of a legend entry touch ended. More...
 
- Public Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 

Detailed Description

Legend delegate.

Method Documentation

◆ legend:fillForEntryAtIndex:forPlot:

- (nullable CPTFill *) legend: (nonnull CPTLegend *)  legend
fillForEntryAtIndex: (NSUInteger idx
forPlot: (nonnull CPTPlot *)  plot 

(Optional) This method gives the delegate a chance to provide a background fill for each legend entry.

Parameters
legendThe legend.
idxThe zero-based index of the legend entry for the given plot.
plotThe plot.
Returns
The fill for the legend entry background or nil to use the default entryFill .

◆ legend:fillForSwatchAtIndex:forPlot:

- (nullable CPTFill *) legend: (nonnull CPTLegend *)  legend
fillForSwatchAtIndex: (NSUInteger idx
forPlot: (nonnull CPTPlot *)  plot 

(Optional) This method gives the delegate a chance to provide a custom swatch fill for each legend entry.

Parameters
legendThe legend.
idxThe zero-based index of the legend entry for the given plot.
plotThe plot.
Returns
The fill for the legend swatch or nil to use the default swatchFill .

◆ legend:legendEntryForPlot:touchDownAtIndex:

- (void) legend: (nonnull CPTLegend *)  legend
legendEntryForPlot: (nonnull CPTPlot *)  plot
touchDownAtIndex: (NSUInteger idx 

(Optional) Informs the delegate that the swatch or label of a legend entry touch started.

Parameters
legendThe legend.
plotThe plot associated with the selected legend entry.
idxThe index of the touched legend entry.

◆ legend:legendEntryForPlot:touchDownAtIndex:withEvent:

- (void) legend: (nonnull CPTLegend *)  legend
legendEntryForPlot: (nonnull CPTPlot *)  plot
touchDownAtIndex: (NSUInteger idx
withEvent: (nonnull CPTNativeEvent *)  event 

(Optional) Informs the delegate that the swatch or label of a legend entry touch started.

Parameters
legendThe legend.
plotThe plot associated with the selected legend entry.
idxThe index of the touched legend entry.
eventThe event that triggered the selection.

◆ legend:legendEntryForPlot:touchUpAtIndex:

- (void) legend: (nonnull CPTLegend *)  legend
legendEntryForPlot: (nonnull CPTPlot *)  plot
touchUpAtIndex: (NSUInteger idx 

(Optional) Informs the delegate that the swatch or label of a legend entry touch ended.

Parameters
legendThe legend.
plotThe plot associated with the selected legend entry.
idxThe index of the touched legend entry.

◆ legend:legendEntryForPlot:touchUpAtIndex:withEvent:

- (void) legend: (nonnull CPTLegend *)  legend
legendEntryForPlot: (nonnull CPTPlot *)  plot
touchUpAtIndex: (NSUInteger idx
withEvent: (nonnull CPTNativeEvent *)  event 

(Optional) Informs the delegate that the swatch or label of a legend entry touch ended.

Parameters
legendThe legend.
plotThe plot associated with the selected legend entry.
idxThe index of the touched legend entry.
eventThe event that triggered the selection.

◆ legend:legendEntryForPlot:wasSelectedAtIndex:

- (void) legend: (nonnull CPTLegend *)  legend
legendEntryForPlot: (nonnull CPTPlot *)  plot
wasSelectedAtIndex: (NSUInteger idx 

(Optional) Informs the delegate that the swatch or label of a legend entry received both the touch down and up events.

Parameters
legendThe legend.
plotThe plot associated with the selected legend entry.
idxThe index of the touched legend entry.

◆ legend:legendEntryForPlot:wasSelectedAtIndex:withEvent:

- (void) legend: (nonnull CPTLegend *)  legend
legendEntryForPlot: (nonnull CPTPlot *)  plot
wasSelectedAtIndex: (NSUInteger idx
withEvent: (nonnull CPTNativeEvent *)  event 

(Optional) Informs the delegate that the swatch or label of a legend entry received both the touch down and up events.

Parameters
legendThe legend.
plotThe plot associated with the selected legend entry.
idxThe index of the touched legend entry.
eventThe event that triggered the selection.

◆ legend:lineStyleForEntryAtIndex:forPlot:

- (nullable CPTLineStyle *) legend: (nonnull CPTLegend *)  legend
lineStyleForEntryAtIndex: (NSUInteger idx
forPlot: (nonnull CPTPlot *)  plot 

(Optional) This method gives the delegate a chance to provide a border line style for each legend entry.

Parameters
legendThe legend.
idxThe zero-based index of the legend entry for the given plot.
plotThe plot.
Returns
The line style for the legend entry border or nil to use the default entryBorderLineStyle .

◆ legend:lineStyleForSwatchAtIndex:forPlot:

- (nullable CPTLineStyle *) legend: (nonnull CPTLegend *)  legend
lineStyleForSwatchAtIndex: (NSUInteger idx
forPlot: (nonnull CPTPlot *)  plot 

(Optional) This method gives the delegate a chance to provide a custom swatch border line style for each legend entry.

Parameters
legendThe legend.
idxThe zero-based index of the legend entry for the given plot.
plotThe plot.
Returns
The line style for the legend swatch border or nil to use the default swatchBorderLineStyle .

◆ legend:shouldDrawSwatchAtIndex:forPlot:inRect:inContext:

- (BOOL) legend: (nonnull CPTLegend *)  legend
shouldDrawSwatchAtIndex: (NSUInteger idx
forPlot: (nonnull CPTPlot *)  plot
inRect: (CGRect rect
inContext: (nonnull CGContextRef context 

(Optional) This method gives the delegate a chance to draw custom swatches for each legend entry.

The "swatch" is the graphical part of the legend entry, usually accompanied by a text title that will be drawn by the legend. Returning NO will cause the legend to not draw the default legend graphics. It is then the delegate’s responsibility to do this.

Parameters
legendThe legend.
idxThe zero-based index of the legend entry for the given plot.
plotThe plot.
rectThe bounding rectangle to use when drawing the swatch.
contextThe graphics context to draw into.
Returns
YES if the legend should draw the default swatch or NO if the delegate handled the drawing.

The documentation for this protocol was generated from the following file: