I managed to implement a chart legend with a custom datasource (using just a SCIChartLegend object as a subview, not SCILegendModifier). However, I am unable to place the legend at specified position, it always snaps to upper-left corner of the screen. When creating a SCIChartLegend instance using the initializer that takes a Rect as a parameter, but not supplying a custom datasource, it draws correctly according to offsets specified by the supplied rect’s X and Y. It does respond to changes in the legendPosition property, but it still doesn’t allow to draw the view with any margins (which is what I’m actually trying to achieve).
By default legend layout positions legend according to legendPosition property, and resizes to fit all the content.
However when you create a legend, you can use
- (instancetype)initWithLegend:(SCIChartLegend *)legend dataSource:(SCILegendDataSource *)dataSource useAutoPlacement:(BOOL)useAutoPlacement;
constructor, and pass useAutoPlacvement flag NO, to have a full control on the legend position. Also legend is a UICollectionView subclass, so you can use all the UICollectionView features, like custom layout etc.
Please login first to submit.