Package org.jCharts.axisChart.axis.scale
Class ChartScale
java.lang.Object
org.jCharts.axisChart.axis.scale.ChartScale
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
The suggested value for the rounding of the data.(package private) int
The number of segments that the suggested yStart, yEnd and yDelta produce.(package private) double
The difference between two points on adjacent grid lines.(package private) double
The value which the last grid line represents.(package private) double
The largest number in the dataset.(package private) double
The smallest number in the dataset.(package private) double
The value which the first grid line represents. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Compute yDelta, yStart, yEnd, segments and rounding.Creates and returns a new AxisProperties object based on the internally calculated values of yStart, yDelta, segments and rounding.private double
getMax
(double[][] data) Helper method that finds the largest double in the 2D array of doubles.private double
getMin
(double[][] data) Helper method that finds the smallest double in the 2D array of doubles.int
Accessor for the rounding property.int
Accessor for the segments property.double
Accessor for the yDelta property.double
getYEnd()
Accessor for the yEnd property.double
getYMax()
Accessor for the yMax property.double
getYMin()
Accessor for the yMin property.double
Accessor for the yStart property.static void
-
Field Details
-
yMax
double yMaxThe largest number in the dataset. -
yMin
double yMinThe smallest number in the dataset. -
yDelta
double yDeltaThe difference between two points on adjacent grid lines. -
yStart
double yStartThe value which the first grid line represents. -
yEnd
double yEndThe value which the last grid line represents. -
rounding
int roundingThe suggested value for the rounding of the data. -
segments
int segmentsThe number of segments that the suggested yStart, yEnd and yDelta produce.
-
-
Constructor Details
-
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 Details
-
main
-
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
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
-