Skip to content

Scale.Normalize

Map a value from one value scale to another Used for scaling values to fit within SVG dimensions

DaxLib.SVG.Scale.Normalize( inputValue, fromMin, fromMax, toMin, toMax )
Parameter Type Required Description
inputValue NUMERIC VAL The value to map
fromMin NUMERIC VAL The minimum value of the original scale
fromMax NUMERIC VAL The maximum value of the original scale
toMin NUMERIC VAL The minimum value of the new scale
toMax NUMERIC VAL The maximum value of the new scale

DECIMAL mapped value

DaxLib.SVG.Scale.Normalize(50, 0, 200, 0, 100) 
// Returns 25
function 'DaxLib.SVG.Scale.Normalize' =
        (
            inputValue: NUMERIC VAL,
            fromMin: NUMERIC VAL,
            fromMax: NUMERIC VAL,
            toMin: NUMERIC VAL,
            toMax: NUMERIC VAL
        ) =>

            ( ( inputValue - fromMin ) / ( fromMax - fromMin ) ) * ( toMax - toMin ) + toMin