Example #1
0
        public static void RenderYAxisGrids(IRenderContext rc, IAxis yAxis, List <FeatureText> features, OxyColor gridcolor)
        {
            if (features == null || features.Count == 0)
            {
                double cell_height = yAxis.Bound.Height / 4;
                if (cell_height <= 0)
                {
                    return;
                }

                double         y_start   = yAxis.Bound.Top + cell_height;
                IList <double> screen_ys = new List <double>();

                while (y_start < yAxis.Bound.Bottom)
                {
                    screen_ys.Add(y_start);
                    y_start += cell_height;
                }
            }
            else
            {
                foreach (FeatureText value in features)
                {
                    double y = value.SourcePosition.Y;

                    IList <ScreenPoint> sps = new List <ScreenPoint>();
                    ScreenPoint         sp1 = new ScreenPoint(yAxis.Bound.Left, y);
                    ScreenPoint         sp2 = new ScreenPoint(yAxis.Bound.Right, y);

                    sps.Add(sp1);
                    sps.Add(sp2);
                    rc.DrawLine(sps, gridcolor);
                }

                double y0 = yAxis.Transform(0);
                if (y0 >= yAxis.Bound.Top && y0 <= yAxis.Bound.Bottom)
                {
                    IList <ScreenPoint> sps = new List <ScreenPoint>();
                    ScreenPoint         sp1 = new ScreenPoint(yAxis.Bound.Left, y0);
                    ScreenPoint         sp2 = new ScreenPoint(yAxis.Bound.Right, y0);

                    sps.Add(sp1);
                    sps.Add(sp2);
                    rc.DrawLine(sps, gridcolor, 3);
                }
            }
        }