internal override RadThickness GetDesiredMargin(RadSize availableSize) { RadThickness margin = new RadThickness(); if (this.maxLabelWidth == 0 || this.owner.LastLabelVisibility != AxisLastLabelVisibility.Visible) { return(margin); } // TODO: Is this assumption good enough as it is theoretically possible that // the horizontal reach of any inner label be wider than the reach of the last label. AxisLabelModel lastLabel = this.owner.labels[this.owner.labels.Count - 1]; double lastLabelHReach = (int)(lastLabel.desiredSize.Width / 2); if (this.owner.ActualPlotMode == AxisPlotMode.OnTicks) { margin.Right = lastLabelHReach; } else { double slotWidth = (int)(availableSize.Width / this.owner.majorTickCount); margin.Right = Math.Max(0, lastLabelHReach - (slotWidth / 2)); } return(margin); }
protected override RadRect ArrangeAxes(RadRect rect) { IRadialAxis angleAxis = this.primarySecondAxis as IRadialAxis; if (angleAxis == null) { throw new InvalidOperationException("AngleAxis of a polar chart area must be radial."); } RadRect ellipseRect = RadRect.ToSquare(rect, false); ellipseRect = RadRect.CenterRect(ellipseRect, rect); RadSize ellipseSize = new RadSize(ellipseRect.Width, ellipseRect.Height); RadRect remaining = ellipseRect; // Measure the second (radial) axis first; it will inflate the plot area this.primarySecondAxis.Measure(ellipseSize); this.primarySecondAxis.Arrange(ellipseRect); RadThickness margins = this.primarySecondAxis.desiredMargin; remaining.X += margins.Left; remaining.Y += margins.Top; remaining.Width -= margins.Left + margins.Right; remaining.Height -= margins.Top + margins.Bottom; remaining = RadRect.ToSquare(remaining, false); remaining = RadRect.CenterRect(remaining, ellipseRect); this.primaryFirstAxis.Measure(ellipseSize); this.primaryFirstAxis.Arrange(remaining); return(remaining); }
internal override RadThickness GetDesiredMargin(RadSize availableSize) { this.margins = new RadThickness(); this.UpdateLabels(availableSize); this.margins.Left = Math.Max(this.margins.Left, this.margins.Right); this.margins.Right = Math.Max(this.margins.Left, this.margins.Right); this.margins.Top = Math.Max(this.margins.Top, this.margins.Bottom); this.margins.Bottom = Math.Max(this.margins.Top, this.margins.Bottom); return(this.margins); }
public void Measure(RadSize availableSize) { this.desiredWidth = 0; this.desiredHeight = 0; for (int i = 0; i < this.axes.Count; i++) { AxisModel axis = this.axes[i]; axis.Measure(availableSize); this.desiredWidth = this.desiredWidth + axis.desiredSize.Width; this.desiredHeight = this.desiredHeight + axis.desiredSize.Height; RadThickness margin = axis.desiredMargin; this.desiredMargin.Left = Math.Max(this.desiredMargin.Left, margin.Left); this.desiredMargin.Top = Math.Max(this.desiredMargin.Top, margin.Top); this.desiredMargin.Right = Math.Max(this.desiredMargin.Right, margin.Right); this.desiredMargin.Bottom = Math.Max(this.desiredMargin.Bottom, margin.Bottom); } }
internal override RadThickness GetDesiredMargin(RadSize availableSize) { RadThickness margin = new RadThickness(); if (this.maxLabelHeight == 0 || this.owner.LastLabelVisibility != AxisLastLabelVisibility.Visible) { return(margin); } double labelOffset = 0; if (this.owner.ActualPlotMode == AxisPlotMode.OnTicks) { labelOffset = (int)(this.maxLabelHeight / 2); margin.Top = labelOffset; } return(margin); }
private void MeasureCore(RadSize availableSize) { this.BuildTicksAndLabels(availableSize); foreach (AxisLabelModel label in this.labels) { // We may enter one or more additional measure passes until all axes are best fit, // so do not re-measure already measured labels. if (label.desiredSize == RadSize.Empty) { label.desiredSize = this.presenter.MeasureContent(label, label.Content); } } if (this.title.desiredSize == RadSize.Empty) { this.title.desiredSize = this.presenter.MeasureContent(this.title, this.title.Content); } this.desiredSize = this.layoutStrategy.GetDesiredSize(availableSize); this.desiredMargin = this.layoutStrategy.GetDesiredMargin(availableSize); }