Legend EnsureLegend(ICategory2StyleContext ic2sc, string title, Style pathstyle) { var brush = CreateBrush(ic2sc); if (_legend != null) { _legend.Fill = brush; return(_legend); } _legend = new LegendValueRange() { Title = title, Minimum = ic2sc.ValueExtents.Minimum, Maximum = ic2sc.ValueExtents.Maximum, Fill = brush, Stroke = pathstyle.Find <Brush>(Path.StrokeProperty) }; return(_legend); }
/// <summary> /// Establish the legend for this style generator. /// </summary> /// <param name="ic2sc">Context.</param> /// <param name="title">Series title.</param> /// <param name="pathstyle">Use for other style properties as required.</param> /// <returns>Cached list enumerator.</returns> public override IEnumerable <LegendBase> LegendFor(ICategory2StyleContext ic2sc, string title, Style pathstyle) { if (_legend == null) { _legend = new List <LegendBase>(); foreach (var ex in Entries) { var leg = new LegendValueRange() { Title = ex.Title, Minimum = ex.Minimum, Maximum = ex.Maximum, Fill = ex.Color, Stroke = BasedOn.Find <Brush>(Path.StrokeProperty) }; _legend.Add(leg); } } return(_legend); }