public void CopyFrom(FormulaAxisX fax) { this.Visible = fax.Visible; this.DateFormatProvider = fax.DateFormatProvider; this.AutoScale = fax.AutoScale; this.Format = fax.Format; this.MajorTick = (FormulaTick)fax.MajorTick.Clone(); this.MinorTick = (FormulaTick)fax.MinorTick.Clone(); this.Back = (FormulaBack)fax.Back.Clone(); this.LabelFont = (Font)fax.LabelFont.Clone(); this.LabelBrush = (Brush)fax.LabelBrush.Clone(); this.AxisLabelAlign = fax.AxisLabelAlign; this.DataCycle = fax.DataCycle; }
/// <summary> /// Copy attribute from another FormulaAxisX /// </summary> /// <param name="fax"></param> public void CopyFrom(FormulaAxisX fax) { visible = fax.visible; DateFormatProvider = fax.DateFormatProvider; autoScale = fax.autoScale; format = fax.format; majorTick = fax.majorTick.Clone(); minorTick = fax.minorTick.Clone(); back = (FormulaBack)fax.back.Clone(); labelFont = (Font)fax.labelFont.Clone(); labelBrush = fax.labelBrush.Clone(); axisLabelAlign = fax.axisLabelAlign; DataCycle = fax.DataCycle; cursorFormat = fax.cursorFormat; height = fax.height; }
void AddScaleLabel(AxisLabelAlign AlignX, AxisLabelAlign AlignY, double x, double y, string text) { Label label = new Label(); label.Foreground = BrushScaleText; label.Content = text; label.HorizontalAlignment = HorizontalAlignment.Left; label.VerticalAlignment = VerticalAlignment.Top; var ft = new FormattedText(text, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(label.FontFamily, label.FontStyle, label.FontWeight, label.FontStretch, label.FontFamily), label.FontSize, BrushScaleText); double sx = ft.Width + 10; double sy = ft.Height + 10; switch (AlignX) { case AxisLabelAlign.Center: x -= sx / 2; if (x < 0) { x += sx / 2; } break; case AxisLabelAlign.BottomRight: x -= sx; if (x < 0) { x += sx / 2; } break; } switch (AlignY) { case AxisLabelAlign.Center: y -= sy / 2; if (y < 0) { y += sy / 2; } break; case AxisLabelAlign.BottomRight: y -= sy; if (y < 0) { y += sy / 2; } break; } if (x >= 0 && x < main_canvas.Width && y >= 0 && y < main_canvas.Height) { label.Margin = new Thickness(x, y, 0, 0); main_canvas.Children.Add(label); AdditionalList.Add(label); } }
public FormulaXFormat(double Days100Pixel, string Interval, string XFormat, double CycleDivide, string XCursorFormat, AxisLabelAlign AxisLabelAlign) : this(Days100Pixel, Interval, XFormat, CycleDivide, XCursorFormat) { this.axisLabelAlign = AxisLabelAlign; }