MTExample4_8.ChartStyle.RNorm C# (CSharp) 메소드

RNorm() 공개 메소드

public RNorm ( float r ) : float
r float
리턴 float
        public float RNorm(float r)
        {
            float rNorm;
            CGRect rect = SetPolarArea ();
            if (r < RMin || r > RMax)
                r = float.NaN;
            rNorm = (float)((r - RMin) * rect.Width / 2 / (RMax - RMin));
            return rNorm;
        }

Usage Example

        public void AddPolar(Graphics g, ChartStyle cs)
        {
            CGRect rect = cs.SetPolarArea ();
            var xc = (float)(rect.X + rect.Width / 2);
            var yc = (float)(rect.Y + rect.Height / 2);
            // Plot lines:
            foreach (DataSeries ds in DataSeriesList) {
                var aPen = new Pen (ds.LineStyle.LineColor, ds.LineStyle.Thickness);
                aPen.DashStyle = ds.LineStyle.Pattern;
                nfloat r = ((CGPoint)ds.PointList [0]).Y;
                nfloat theta = ((CGPoint)ds.PointList [0]).X;
                float x = cs.RNorm ((float)r) * (float)Math.Cos (theta * Math.PI / 180) + xc;
                float y = cs.RNorm ((float)r) * (float)Math.Sin (theta * Math.PI / 180) + yc;

                if (ds.LineStyle.IsVisible == true) {
                    var ptStart = new PointF (x, y);
                    var ptEnd = new PointF (x, y);
                    for (int i = 1; i < ds.PointList.Count; i++) {
                        r = ((CGPoint)ds.PointList [i - 1]).Y;
                        theta = ((CGPoint)ds.PointList [i - 1]).X;
                        if (cs.AngleDirection == ChartStyle.AngleDirectionEnum.CounterClockWise) {
                            theta = -theta;
                        }
                        x = cs.RNorm ((float)r) * (float)Math.Cos (theta * Math.PI / 180) + xc;
                        y = cs.RNorm ((float)r) * (float)Math.Sin (theta * Math.PI / 180) + yc;
                        ptStart = new PointF (x, y);
                        r = ((CGPoint)ds.PointList [i]).Y;
                        theta = ((CGPoint)ds.PointList [i]).X;
                        if (cs.AngleDirection == ChartStyle.AngleDirectionEnum.CounterClockWise) {
                            theta = -theta;
                        }
                        x = cs.RNorm ((float)r) * (float)Math.Cos (theta * Math.PI / 180) + xc;
                        y = cs.RNorm ((float)r) * (float)Math.Sin (theta * Math.PI / 180) + yc;
                        ptEnd = new PointF (x, y);
                        g.DrawLine (aPen, ptStart, ptEnd);
                    }
                }
                aPen.Dispose ();
            }
        }
All Usage Examples Of MTExample4_8.ChartStyle::RNorm