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

package lt.monarch.chart.chart2D;

import java.awt.Graphics;
import java.awt.Point;
import lt.monarch.chart.*;

// Referenced classes of package lt.monarch.chart.chart2D:
//			ChartPoint, ChartPointProvider, PlainMapper2D, Axis2D

public abstract class ChartPointSeries extends AbstractChartObject
	implements ChartPointProvider.Listener
{

	protected ChartPointProvider provider;
	public final PlainMapper mapper;
	public final AxisMapper xMapper;
	public final AxisMapper yMapper;

	public ChartPointSeries(ChartPointProvider chartpointprovider, PlainMapper plainmapper, AxisMapper axismapper, AxisMapper axismapper1)
	{
		provider = chartpointprovider;
		mapper = plainmapper;
		xMapper = axismapper;
		yMapper = axismapper1;
	}

	public ChartPointSeries(ChartPointProvider chartpointprovider, Axis2D axis2d, Axis2D axis2d1)
	{
		this(chartpointprovider, ((PlainMapper) (new PlainMapper2D())), ((Axis) (axis2d)).mapper, ((Axis) (axis2d1)).mapper);
	}

	public abstract void draw(Graphics g);

	public void pointAdded(ChartPointProvider chartpointprovider, ChartPoint chartpoint)
	{
		chart().refresh();
	}

	public void pointsChanged(ChartPointProvider chartpointprovider)
	{
		chart().invalidate();
	}

	public void setChart(Chart chart)
	{
		if(chart == null)
			provider.removeListener(this);
		else
			provider.addListener(this);
		super.setChart(chart);
	}

	public String tipAt(Point point)
	{
		String s = null;
		for(int i = 0; i < provider.pointCount() && s == null; i++)
			s = provider.point(i).tipAt(this, point);

		return s;
	}
}
