Пример #1
0
    private void RenderGridLines(SKSurface surface, PixelRect dataRect, IAxis axis)
    {
        // TODO: restrict to visible ticks and max 1000?
        Tick[]  ticks  = axis.TickGenerator.Ticks;
        Pixel[] starts = new Pixel[ticks.Length];
        Pixel[] ends   = new Pixel[ticks.Length];

        for (int i = 0; i < ticks.Length; i++)
        {
            float px = axis.GetPixel(ticks[i].Position, dataRect);
            starts[i] = axis.Edge.IsHorizontal() ? new Pixel(px, dataRect.Bottom) : new Pixel(dataRect.Left, px);
            ends[i]   = axis.Edge.IsHorizontal() ? new Pixel(px, dataRect.Top) : new Pixel(dataRect.Right, px);
        }

        Drawing.DrawLines(surface, starts, ends, LineColor, LineWidth);
    }