public/libraries.js
function (val, backwards, cvsCoord, old, handleLog, pointPlacement) {
            var axis = this,
              sign = 1,
              cvsOffset = 0,
              localA = old ? axis.oldTransA : axis.transA,
              localMin = old ? axis.oldMin : axis.min,
              returnValue,
              minPixelPadding = axis.minPixelPadding,
              postTranslate = (axis.options.ordinal || (axis.isLog && handleLog)) && axis.lin2val;

            if (!localA) {
                localA = axis.transA;
            }

            // In vertical axes, the canvas coordinates start from 0 at the top like in
            // SVG.
            if (cvsCoord) {
                sign *= -1; // canvas coordinates inverts the value
                cvsOffset = axis.len;
            }

            // Handle reversed axis
            if (axis.reversed) {
                sign *= -1;
                cvsOffset -= sign * (axis.sector || axis.len);
            }

            // From pixels to value
            if (backwards) { // reverse translation

                val = val * sign + cvsOffset;
                val -= minPixelPadding;
                returnValue = val / localA + localMin; // from chart pixel to value
                if (postTranslate) { // log and ordinal axes
                    returnValue = axis.lin2val(returnValue);
                }

                // From value to pixels
            } else {
                if (postTranslate) { // log and ordinal axes
                    val = axis.val2lin(val);
                }
                if (pointPlacement === 'between') {
                    pointPlacement = 0.5;
                }
                returnValue = sign * (val - localMin) * localA + cvsOffset + (sign * minPixelPadding) +
                  (isNumber(pointPlacement) ? localA * pointPlacement * axis.pointRange : 0);
            }

            return returnValue;
        }
function (val, backwards, cvsCoord, old, handleLog, pointPlacement) {
            var axis = this,
              sign = 1,
              cvsOffset = 0,
              localA = old ? axis.oldTransA : axis.transA,
              localMin = old ? axis.oldMin : axis.min,
              returnValue,
              minPixelPadding = axis.minPixelPadding,
              postTranslate = (axis.options.ordinal || (axis.isLog && handleLog)) && axis.lin2val;

            if (!localA) {
                localA = axis.transA;
            }

            // In vertical axes, the canvas coordinates start from 0 at the top like in
            // SVG.
            if (cvsCoord) {
                sign *= -1; // canvas coordinates inverts the value
                cvsOffset = axis.len;
            }

            // Handle reversed axis
            if (axis.reversed) {
                sign *= -1;
                cvsOffset -= sign * (axis.sector || axis.len);
            }

            // From pixels to value
            if (backwards) { // reverse translation

                val = val * sign + cvsOffset;
                val -= minPixelPadding;
                returnValue = val / localA + localMin; // from chart pixel to value
                if (postTranslate) { // log and ordinal axes
                    returnValue = axis.lin2val(returnValue);
                }

                // From value to pixels
            } else {
                if (postTranslate) { // log and ordinal axes
                    val = axis.val2lin(val);
                }
                if (pointPlacement === 'between') {
                    pointPlacement = 0.5;
                }
                returnValue = sign * (val - localMin) * localA + cvsOffset + (sign * minPixelPadding) +
                  (isNumber(pointPlacement) ? localA * pointPlacement * axis.pointRange : 0);
            }

            return returnValue;
        }
function ( val , backwards , cvsCoord , old , handleLog , pointPlacement ) { var axis = this , sign = 1 , cvsOffset = 0 , localA = old ? axis . oldTransA : axis . transA , localMin = old ? axis . oldMin : axis . min , returnValue , minPixelPadding = axis . minPixelPadding , postTranslate = ( axis . options . ordinal || ( axis . isLog && handleLog ) ) && axis . lin2val ; if ( ! localA ) { localA = axis . transA ; } // In vertical axes, the canvas coordinates start from 0 at the top like in // SVG. if ( cvsCoord ) { sign *= - 1 ; // canvas coordinates inverts the value cvsOffset = axis . len ; } // Handle reversed axis if ( axis . reversed ) { sign *= - 1 ; cvsOffset -= sign * ( axis . sector || axis . len ) ; } // From pixels to value if ( backwards ) { // reverse translation val = val * sign + cvsOffset ; val -= minPixelPadding ; returnValue = val / localA + localMin ; // from chart pixel to value if ( postTranslate ) { // log and ordinal axes returnValue = axis . lin2val ( returnValue ) ; } // From value to pixels } else { if ( postTranslate ) { // log and ordinal axes val = axis . val2lin ( val ) ; } if ( pointPlacement === 'between' ) { pointPlacement = 0.5 ; } returnValue = sign * ( val - localMin ) * localA + cvsOffset + ( sign * minPixelPadding ) + ( isNumber ( pointPlacement ) ? localA * pointPlacement * axis . pointRange : 0 ) ; } return returnValue ; }
Translate from axis value to pixel position on the chart, or back
Translate from axis value to pixel position on the chart or back