Package org.jCharts.axisChart.axis.scale
Class ChartScale
- java.lang.Object
-
- org.jCharts.axisChart.axis.scale.ChartScale
-
public class ChartScale extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description (package private) introundingThe suggested value for the rounding of the data.(package private) intsegmentsThe number of segments that the suggested yStart, yEnd and yDelta produce.(package private) doubleyDeltaThe difference between two points on adjacent grid lines.(package private) doubleyEndThe value which the last grid line represents.(package private) doubleyMaxThe largest number in the dataset.(package private) doubleyMinThe smallest number in the dataset.(package private) doubleyStartThe value which the first grid line represents.
-
Constructor Summary
Constructors Constructor Description ChartScale()ChartScale(double[][] data)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcalculate()Compute yDelta, yStart, yEnd, segments and rounding.AxisPropertiesgetAxisProperties()Creates and returns a new AxisProperties object based on the internally calculated values of yStart, yDelta, segments and rounding.private doublegetMax(double[][] data)Helper method that finds the largest double in the 2D array of doubles.private doublegetMin(double[][] data)Helper method that finds the smallest double in the 2D array of doubles.intgetRounding()Accessor for the rounding property.intgetSegments()Accessor for the segments property.doublegetYDelta()Accessor for the yDelta property.doublegetYEnd()Accessor for the yEnd property.doublegetYMax()Accessor for the yMax property.doublegetYMin()Accessor for the yMin property.doublegetYStart()Accessor for the yStart property.static voidmain(java.lang.String[] args)
-
-
-
Field Detail
-
yMax
double yMax
The largest number in the dataset.
-
yMin
double yMin
The smallest number in the dataset.
-
yDelta
double yDelta
The difference between two points on adjacent grid lines.
-
yStart
double yStart
The value which the first grid line represents.
-
yEnd
double yEnd
The value which the last grid line represents.
-
rounding
int rounding
The suggested value for the rounding of the data.
-
segments
int segments
The number of segments that the suggested yStart, yEnd and yDelta produce.
-
-
Constructor Detail
-
ChartScale
public ChartScale()
-
ChartScale
public ChartScale(double[][] data)
Constructor. Creates a ChartScale object and initializes all of its properties as appropriate for the given data's minimum and maximum values.- Parameters:
data- double[] the data for which you would like suggested graph values
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
calculate
private void calculate()
Compute yDelta, yStart, yEnd, segments and rounding.
-
getMax
private double getMax(double[][] data)
Helper method that finds the largest double in the 2D array of doubles.- Parameters:
data- double[][] to look into for the max- Returns:
- double the largest value found
-
getMin
private double getMin(double[][] data)
Helper method that finds the smallest double in the 2D array of doubles.- Parameters:
data- double[][] to look into for the min- Returns:
- double the smallest value found
-
getYMax
public double getYMax()
Accessor for the yMax property. This property represents the largest value in the dataset.- Returns:
- double largest value in the associated dataset
-
getYMin
public double getYMin()
Accessor for the yMin property. This property represents the smallest value in the dataset.- Returns:
- double smallest value in the associated dataset
-
getYDelta
public double getYDelta()
Accessor for the yDelta property. The difference between any two points on adjacent grid lines.- Returns:
- double grid line spacing
-
getYStart
public double getYStart()
Accessor for the yStart property. The value which the first grid line represents.- Returns:
- double y axis value for the bottom horizontal grid line.
-
getYEnd
public double getYEnd()
Accessor for the yEnd property. The value which the last grid line represents.- Returns:
- double y axis value for the top horizontal grid line.
-
getRounding
public int getRounding()
Accessor for the rounding property. The suggested value for the rounding of the data.- Returns:
- double rounding value suggestion.
-
getSegments
public int getSegments()
Accessor for the segments property. The number of segments that the suggested yStart, yEnd and yDelta produce.- Returns:
- double segments in the graph as suggested.
-
getAxisProperties
public AxisProperties getAxisProperties() throws PropertyException
Creates and returns a new AxisProperties object based on the internally calculated values of yStart, yDelta, segments and rounding.- Returns:
- AxisProperties with yStart, yDelta, segments and rounding set.
- Throws:
PropertyException
-
-