// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) space 
// Source File Name:   Grid.java

package lt.monarch.charts;

import java.awt.*;

// Referenced classes of package lt.monarch.charts:
//            Axis, AxisMapper, XAxis, YAxis

public class Grid
{

    public Grid(XAxis xaxis, YAxis yaxis)
    {
        xAxis = xaxis;
        yAxis = yaxis;
        gridColor = Color.gray;
    }

    public void draw(Graphics g, Rectangle rectangle)
    {
        g.setColor(gridColor);
        if (yAxis != null)
        {
            for (int i = 0; i < ((Axis) (yAxis)).mapper.labelCount(); i++)
            {
                int k = yAxis.mapLabel(rectangle, i);
                g.drawLine(rectangle.x, k, rectangle.x + rectangle.width, k);
            }

        }
        if (xAxis != null)
        {
            for (int j = 0; j < ((Axis) (xAxis)).mapper.labelCount(); j++)
            {
                int l = xAxis.mapLabel(rectangle, j);
                g.drawLine(l, rectangle.y, l, rectangle.y + rectangle.height);
            }

        }
    }

    public void setGridColor(Color color)
    {
        gridColor = color;
    }

    XAxis xAxis;
    YAxis yAxis;
    Color gridColor;
}
