Package org.jCharts.axisChart.axis.scale

# Class ChartScale

java.lang.Object
org.jCharts.axisChart.axis.scale.ChartScale

public class ChartScale extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`(package private) int`
`rounding`
The suggested value for the rounding of the data.
`(package private) int`
`segments`
The number of segments that the suggested yStart, yEnd and yDelta produce.
`(package private) double`
`yDelta`
The difference between two points on adjacent grid lines.
`(package private) double`
`yEnd`
The value which the last grid line represents.
`(package private) double`
`yMax`
The largest number in the dataset.
`(package private) double`
`yMin`
The smallest number in the dataset.
`(package private) double`
`yStart`
The value which the first grid line represents.

## Constructor Summary

Constructors
Constructor
Description
`ChartScale()`
`ChartScale(double[][] data)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`private void`
`calculate()`
Compute yDelta, yStart, yEnd, segments and rounding.
`AxisProperties`
`getAxisProperties()`
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`
`getRounding()`
Accessor for the rounding property.
`int`
`getSegments()`
Accessor for the segments property.
`double`
`getYDelta()`
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`
`getYStart()`
Accessor for the yStart property.
`static void`
`main(String[] args)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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 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

public static void main(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`