net.moioli.chart
Class Scale

java.lang.Object
  extended by net.moioli.chart.Scale

public class Scale
extends java.lang.Object

Collects some of the necessary data for the DrawableI objects to be drawn on a DefaultChart, and provides common methods to calculate some scale parameters.

Version:
2005/10/5
Author:
Silvio Moioli

Method Summary
 int getDetail()
           
 double getMaxX()
           
 double getMaxY()
           
 double getMinX()
           
 double getMinY()
           
 int getPixelAccuracy()
           
 int getScreenMaxX()
           
 int getScreenMaxY()
           
 double getStep()
          When drawing mathematical functions it is needed to recalculate the function's value every "dx" increment from minX to maxX.
 int getX(double x)
          Calculates the abscissa on the screen (in pixels) corresponding to the real abscissa passed according to this Scale object.
 int getXMeasure(double l)
          Given a segment parallel to the x axis which length is l, this method returns the corresponding length in pixels.
 double getXZoom()
          Returns the x zoom factor
 int getY(double y)
          Calculates the ordinate on the screen (in pixels) corresponding to the real ordinate passed according to this Scale object.
 int getYMeasure(double l)
          Given a segment parallel to the y axis which length is l, this method returns the corresponding length in pixels.
 double getYZoom()
          Returns the y zoom factor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getX

public int getX(double x)
Calculates the abscissa on the screen (in pixels) corresponding to the real abscissa passed according to this Scale object.

Parameters:
x - real abscissa
Returns:
screen abscissa

getY

public int getY(double y)
Calculates the ordinate on the screen (in pixels) corresponding to the real ordinate passed according to this Scale object.

Parameters:
y - real abscissa
Returns:
screen ordinate

getStep

public double getStep()
When drawing mathematical functions it is needed to recalculate the function's value every "dx" increment from minX to maxX. This method returns the otimal increment value given the the scale, screen size and the pixelAccuracy parameter.

Returns:
the optimal x increment value

getXZoom

public double getXZoom()
Returns the x zoom factor

Returns:
x zoom factor

getYZoom

public double getYZoom()
Returns the y zoom factor

Returns:
y zoom factor

getXMeasure

public int getXMeasure(double l)
Given a segment parallel to the x axis which length is l, this method returns the corresponding length in pixels.

Parameters:
l - real length of a segment
Returns:
"pixel length" of a segment

getYMeasure

public int getYMeasure(double l)
Given a segment parallel to the y axis which length is l, this method returns the corresponding length in pixels.

Parameters:
l - real length of a segment
Returns:
"pixel length" of a segment

getMaxX

public double getMaxX()
Returns:
Returns the maximum represented abscissa.

getMaxY

public double getMaxY()
Returns:
Returns the maximum represented ordinate.

getMinX

public double getMinX()
Returns:
Returns the minimum represented abscissa.

getMinY

public double getMinY()
Returns:
Returns the minimum represented ordinate.

getPixelAccuracy

public int getPixelAccuracy()
Returns:
Returns the pixelAccuracy parameter.

getScreenMaxX

public int getScreenMaxX()
Returns:
Returns the number of horizontal available pixels.

getScreenMaxY

public int getScreenMaxY()
Returns:
Returns the number of vertical available pixels.

getDetail

public int getDetail()
Returns:
Returns the detail parameter.