package com.ddChat.graphic;
import java.awt.Graphics;
import java.util.Vector;
public class Plot extends Painter
{
Curve curve;
XScale xScale;
YScale yScale;
GData min ;
GData max ;
public Plot(Graphics g)
{
super(g);
min = new GData(1, 2);
max = new GData(100, 2);
curve = new Curve(g);
xScale = new XScale(g);
yScale = new YScale(g);
Vector
data_x = new Vector ();
Vector data_y = new Vector ();
for(int i = 0 ; i < 360 ; i++)
{
data_x.add(i);
data_y.add((int) (Math.sin(i /180.0 * 3.14) * 100));
}
curve.setData_x(data_x);
curve.setData_y(data_y);
}
@Override
void draw()
{
xScale.draw();
yScale.draw();
curve.draw();
}
@Override
void setG(Graphics g)
{
this.g = g;
xScale.setG(g);
yScale.setG(g);
curve.setG(g);
}
public GData getMin()
{
return min;
}
public void setMin(GData min)
{
this.min = min;
}
public GData getMax()
{
return max;
}
public void setMax(GData max)
{
this.max = max;
}
}
阅读(2262) | 评论(0) | 转发(0) |