@protocol SChartLegendItem <NSObject>
Specifies the interface required by the legend to display chart series. A series should adopt this protocol if it wishes to specify how it is represented in the legend.
SChartSeries base class adopts this protocol and therefore any subclasses can specify their representation in the legend by overriding the methods here. All the series types provided by shinobicharts already provide their own implementation of these methods, so you should only need to implement them yourself if you are looking for custom behavior.
Returns the text displayed in the legend for the series.
This is relevant for cartesian series, but is not used for radial series. For radial series, use
- (nonnull NSString *)titleForSeriesInLegend;
optional func titleForSeriesInLegend() -> String
Returns the text displayed in the legend for the slice at the given index in the first series on the chart.
This is only relevant for radial series. This method will be called for each of the slices in the first series in the chart. If this is implemented,
symbolForSeriesInLegendwill not be called. Instead of displaying a symbol for each series, we will display more detailed information about the first series in the chart.
- (nonnull NSString *)titleForSliceInLegend:(NSInteger)index;
optional func titleForSlice(inLegend index: Int) -> String
The index of the relevant slice in the first chart series.
Returns the text color used for series titles in the legend.
By default, the text color is taken from the chart theme. If you implement this method yourself, the value it returns takes precedence.
- (nonnull UIColor *)textColorForSeriesTitleInLegend;
optional func textColorForSeriesTitleInLegend() -> UIColor
Returns the symbol representing a cartesian series in the legend.
All of the series types provided by shinobicharts return an appropriate symbol to represent them in the legend. If you would like to use a custom symbol, you can subclass one of the series types, and override this method.
For radial series, you should use
Returns the symbol representing a slice in the first radial series on the chart.
All of the series types provided by shinobicharts return an appropriate symbol type to be used in the legend. If you would like to use a custom symbol, you can subclass one of the series types, and override this method.
For cartesian series, you should use