public static Label <THelper> Label <THelper>(this ILabelCreator <THelper> creator, string text) where THelper : BootstrapHelper <THelper> { return(new Label <THelper>(creator).SetText(text)); }
internal virtual IEnumerable <AxisLabelModel> GenerateLabels() { AxisPlotMode plotMode = this.ActualPlotMode; int labelIndex = 0; int startIndex = this.LabelOffset; int labelStep = this.LabelInterval; int skipLabelCount = 1; IContentFormatter labelFormatter = this.ContentFormatter; ILabelCreator labelCreator = this.LabelCreator; object owner = this.Presenter; string format = this.GetLabelFormat(); // generate label for each major tick foreach (AxisTickModel tick in this.ticks) { if (labelIndex < startIndex) { labelIndex++; continue; } // skip minor ticks if (tick.Type == TickType.Minor) { continue; } if (skipLabelCount > 1) { skipLabelCount--; continue; } // no need to process last tick if we are plotting between ticks if (plotMode == AxisPlotMode.BetweenTicks && RadMath.IsOne(this.IsInverse ? 1 - tick.normalizedValue : tick.normalizedValue)) { break; } AxisLabelModel label = new AxisLabelModel(); object content = this.GetLabelContent(tick); if (labelCreator != null && !labelCreator.ShouldCreateAxisLabel(owner, content)) { continue; } if (labelFormatter != null) { content = labelFormatter.Format(owner, content); } else if (!string.IsNullOrEmpty(format)) { content = string.Format(CultureInfo.CurrentUICulture, format, content); } label.Content = content; tick.associatedLabel = label; if (plotMode == AxisPlotMode.BetweenTicks) { decimal length = tick.NormalizedForwardLength; if (length == 0) { length = tick.NormalizedBackwardLength; } tick.associatedLabel.normalizedPosition = tick.normalizedValue + (length / 2); } else { tick.associatedLabel.normalizedPosition = tick.normalizedValue; } yield return(label); skipLabelCount = labelStep; } }