private void CaculateFirstMaker(Size size) { Marker mk = new Marker(); Point startp = new Point(); startp.X = ChartPropery.AxisLineMargin - ChartPropery.MarkerHeight; startp.Y = size.Height - ChartPropery.AxisLineMargin-1; Point endp = new Point(); endp.X = ChartPropery.AxisLineMargin; endp.Y = startp.Y; mk.StartPoint = startp; mk.EndPoint = endp; FormattedText formattedText = new FormattedText(MinValue.ToString(), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Verdana"), 10, Brushes.White); mk.Value = formattedText; Point tpoint = new Point(); tpoint.X = ChartPropery.AxisLineMargin - formattedText.Width - ChartPropery.MarkerHeight; tpoint.Y = endp.Y - formattedText.Height; mk.TextPoint = tpoint; _Markers.Add(mk); }
private void CalcuateMarker(Size size) { CaculateFirstMaker(size); double value = MaxValue / 5; double yAxisLen = size.Height - ChartPropery.AxisLineMargin - ChartPropery.TopMargin-1; for (int i=1;i<=5;i++) { Marker mk = new Marker(); Point startp = new Point(); startp.X = ChartPropery.AxisLineMargin - ChartPropery.MarkerHeight; startp.Y = size.Height- ChartPropery.AxisLineMargin-Math.Round(i * value * yAxisLen / MaxValue); Point endp = new Point(); endp.X = ChartPropery.AxisLineMargin; endp.Y = startp.Y; mk.StartPoint = startp; mk.EndPoint = endp; FormattedText formattedText = new FormattedText((i * value).ToString(),CultureInfo.CurrentCulture,FlowDirection.LeftToRight,new Typeface("Verdana"),10, Brushes.White); mk.Value = formattedText; Point tpoint = new Point(); tpoint.X = ChartPropery.AxisLineMargin - formattedText.Width- ChartPropery.MarkerHeight; tpoint.Y = endp.Y - formattedText.Height / 2; mk.TextPoint = tpoint; Point gridsp = new Point(); gridsp.X = ChartPropery.AxisLineMargin; gridsp.Y = startp.Y; mk.GridStartPoint = gridsp; Point gridep = new Point(); gridep.X = size.Width - ChartPropery.RightMargin; gridep.Y = gridsp.Y; mk.GridEndPoint = gridep; _Markers.Add(mk); } }