# Interface Scale

@Equality public interface Scale
Represents a mapping of data values to some linear scale. The function is assumed to be strictly monotonic increasing and continuous.

All finite values are permitted for both the data and the scale, except as documented by the `isPositiveDefinite()` method.

The `LINEAR` and `LOG` instances are provided as static members of this class; to produce other instances, see the `ScaleType` class.

Since:
  12 Mar 2025
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final Scale`
`LINEAR`
`static final Scale`
`LOG`
`static final Scale`
`TIME`

## Method Summary

Modifier and Type
Method
Description
`double`
`dataToScale(double d)`
Forward mapping.
`String`
`dataToScaleExpression(String var)`
Returns an algebraic expression representing the mapping of a variable from data space to scale space.
`double[]`
`getParamValues()`
Returns the array of parameter values that combined with the scale type fully specify this scale.
`Rounder`
`getScaleRounder()`
Returns an object which can round scale values to a value that counts as a round number.
`ScaleType`
`getScaleType()`
Returns the type of this scale.
`Ticker`
`getTicker()`
Returns an object that can generate axis ticks for this scale.
`boolean`
`isLinear()`
Indicates whether the scaling relation is linear.
`boolean`
`isPositiveDefinite()`
If this method returns true, then only data values that are strictly greater than zero can be mapped to the scale, and a data value of zero is mapped to a scale value of negative infinity.
`double`
`scaleToData(double s)`
Inverse mapping.

## Field Details

### LINEAR

static final Scale LINEAR

### LOG

static final Scale LOG

### TIME

static final Scale TIME

## Method Details

### getScaleType

ScaleType getScaleType()
Returns the type of this scale.

Returns:
  scale type

### getParamValues

double[] getParamValues()
Returns the array of parameter values that combined with the scale type fully specify this scale.

Returns:
  scale parameter values, same length as `getScaleType().getParams()`

### dataToScale

double dataToScale(double d)
Forward mapping.

Parameters:
  `d` - data value
Returns:
  scale value

### scaleToData

double scaleToData(double s)
Inverse mapping.

Parameters:
  `s` - scale value
Returns:
  data value

### isPositiveDefinite

boolean isPositiveDefinite()
If this method returns true, then only data values that are strictly greater than zero can be mapped to the scale, and a data value of zero is mapped to a scale value of negative infinity. Otherwise, any finite data value and any finite scale value can be mapped to a finite value in the other domain.

Returns:
  true iff negative data values are excluded

### isLinear

boolean isLinear()
Indicates whether the scaling relation is linear.

Returns:
  true for uniformly linear scaling, false otherwise

### getTicker

Ticker getTicker()
Returns an object that can generate axis ticks for this scale.

Returns:
  ticker

### getScaleRounder

Rounder getScaleRounder()
Returns an object which can round scale values to a value that counts as a round number.

Returns:
  rounder for the scale quantity

### dataToScaleExpression

String dataToScaleExpression(String var)
Returns an algebraic expression representing the mapping of a variable from data space to scale space.

Parameters:
  `var` - input variable representation