Package org.jCharts.axisChart.axis.scale
Class ChartScale
java.lang.Object
org.jCharts.axisChart.axis.scale.ChartScale
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) intThe suggested value for the rounding of the data.(package private) intThe number of segments that the suggested yStart, yEnd and yDelta produce.(package private) doubleThe difference between two points on adjacent grid lines.(package private) doubleThe value which the last grid line represents.(package private) doubleThe largest number in the dataset.(package private) doubleThe smallest number in the dataset.(package private) doubleThe value which the first grid line represents. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidCompute 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 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.intAccessor for the rounding property.intAccessor for the segments property.doubleAccessor for the yDelta property.doublegetYEnd()Accessor for the yEnd property.doublegetYMax()Accessor for the yMax property.doublegetYMin()Accessor for the yMin property.doubleAccessor 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
-