internal override void ApplyLayoutRounding() { // fit first and last ticks within axis layout slot AxisTickModel firstTick = this.owner.FirstTick; AxisTickModel lastTick = this.owner.LastTick; double thickness = this.owner.TickThickness; double thicknessOffset = (int)(thickness / 2); if (firstTick != null && RadMath.IsZero(firstTick.normalizedValue)) { firstTick.layoutSlot.X = this.owner.layoutSlot.X - thicknessOffset; } if (lastTick != null && RadMath.IsOne(lastTick.normalizedValue)) { double zoomWidth = this.owner.layoutSlot.Width * this.owner.GetChartArea().view.ZoomWidth; lastTick.layoutSlot.X = this.owner.layoutSlot.X + zoomWidth - thicknessOffset; // remove one additional pixel on the right (rendering along the X-axis goes from left to right) lastTick.layoutSlot.X--; } }
internal override RadRect ArrangeOverride(RadRect rect) { this.radialLines.Clear(); this.polarLines.Clear(); RadPoint center = RadPoint.Round(rect.Center); double radius = Math.Max(0, rect.Width / 2); PolarChartAreaModel polarArea = this.GetChartArea <PolarChartAreaModel>(); PolarAxisModel polarAxis = polarArea.PolarAxis; foreach (AxisTickModel tick in polarAxis.MajorTicks) { double tickRadius = (int)(((double)tick.normalizedValue * radius) + 0.5); this.radialLines.Add(new RadCircle() { Center = center, Radius = tickRadius }); } AxisModel angleAxis = polarArea.AngleAxis; foreach (AxisTickModel tick in angleAxis.MajorTicks) { // do not add a line for the last tick if (RadMath.IsOne(angleAxis.IsInverse ? 1 - tick.normalizedValue : tick.normalizedValue)) { continue; } double angle = polarArea.NormalizeAngle((double)tick.value); this.polarLines.Add(new RadPolarVector() { Center = center, Point = tick.layoutSlot.Location, Angle = angle }); } return(rect); }
internal override void ApplyLayoutRounding() { // fit first and last ticks within axis layout slot AxisTickModel firstTick = this.owner.FirstTick; AxisTickModel lastTick = this.owner.LastTick; double thickness = this.owner.TickThickness; double thicknessOffset = (int)(thickness / 2); // ensure that the first and last ticks are within axis' layout slot if (firstTick != null && RadMath.IsZero(firstTick.normalizedValue)) { double zoomHeight = this.owner.layoutSlot.Height * this.owner.GetChartArea().view.ZoomHeight; firstTick.layoutSlot.Y = this.owner.layoutSlot.Y + zoomHeight - thicknessOffset; // remove one additional pixel at bottom (rendering along the Y-axis goes from top to bottom) firstTick.layoutSlot.Y--; } if (lastTick != null && RadMath.IsOne(lastTick.normalizedValue)) { lastTick.layoutSlot.Y = this.owner.layoutSlot.Y - thicknessOffset; } }
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; 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 (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; } }