Mapping
A KontrastMapping
determines how numbers are distributed
along an axis or a slider. Both axes and
sliders have the property
mapping
of this type. For example, by specifying the
value 'log10'
for the mapping
property, you
can map values along an axis or a slider logarithmically.
The effect of most mappings described below can be explored in the Example: Mapping of axes and Example: Sliders with different mappings.
Available mappings
Linear mappings

'linear'
:This is the default mapping. Values are linearly interpolated between the minimum and maximum of an axis (or slider).

'date'
:This mapping is also linear, but formats the tick values as date (and time). The numeric values are interpreted as a JavaScript time stamp, which is the number of milliseconds passed from 19700101 00:00:00.000 UTC.

'degree'
:This mapping is again linear but appends all numbers by a degree sign (°) and uses a different rounding to emphasize 15°, 30°, 45°, 90° and 180° (as opposed to the usual
round numbers
used in the'linear'
mapping which are based on multiples of 2, 5 and 10). 
'radianAsDegree'
:Same as the
'degree'
mapping but based on radian, i.e. \pi is displayed as 180°.
Logarithmic mappings
There are three different logarithmic mappings:
'ln'
: The natural logarithm'log10'
: The logarithm with base 10'log2'
: The logarithm with base 2
Reciprocal mappings

'positiveReciprocal'
The mapping
'positiveReciprocal'
uses the reciprocal of the values in such a way that theorder
(ordirection
) of an axis is maintained, i.e. the axis still ranges from the minimum value to the maximum value (that is the reason for the minus signs in the transformation table).
Transformation table
The table below describes the forward
transform from the data
value x to the position on
the axis y
and the corresponding inverse transform (backward
).
Name  Forward transform  Backward transform 

linear, date, degree, radianAsDegree 
y = x  x = y 
ln 
y = \ln x  x = e^y 
log10 
y = {\ln x}/{\ln 10}  x = 10^y 
log2 
y = {\ln x}/{\ln 2}  x = 2^y 
positiveReciprocal 
y = 1/x  x = 1/y 
Interface
Functions

assign(value: string)
Assign a new value as the mapping. 
forward(value: number)
Computes the forward transformation of the value. 
backward(value: number)
Computes the backward transformation of the value. 
addEventListener(eventName: string, callback: function)
Registers the callback function as an event listener for the specified event name. 
clearEventListener(eventName: string)
Remove all event listener callbacks associated with the event name.
Properties

type
:string
A readonly constant string containing 'KontrastMapping'.

defaultValue
:string
A readonly string that contains the default mapping of the specific property.

value
:string
The current mapping value represented as a string.
Events

change
, callback:function () { … }
Event that fires whenever the value is changed.