all files / circular-gauge/utils/ helper-circular-gauge.js

100% Statements 16/16
100% Branches 6/6
100% Functions 4/4
100% Lines 16/16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31   1948×         24× 24× 24× 22×         28× 28×            
define(["require", "exports", "@syncfusion/ej2-base", "./helper-common"], function (require, exports, ej2_base_1, helper_common_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    function setStyles(element, fill, border) {
        ej2_base_1.setStyleAttribute(element, {
            'stroke': border.color, 'stroke-width': border.width,
            'fill': fill
        });
    }
    exports.setStyles = setStyles;
    function getValueFromAngle(angle, maximumValue, minimumValue, startAngle, endAngle, isClockWise) {
        endAngle -= helper_common_1.isCompleteAngle(startAngle, endAngle) ? 0.0001 : 0;
        angle = angle < startAngle ? (angle + 360) : angle;
        if (isClockWise) {
            return (((angle - startAngle) / helper_common_1.getDegree(startAngle, endAngle)) * (maximumValue - minimumValue)) + minimumValue;
        }
        else {
            return maximumValue - ((((angle - startAngle) / helper_common_1.getDegree(startAngle, endAngle)) * (maximumValue - minimumValue)));
        }
    }
    exports.getValueFromAngle = getValueFromAngle;
    function getRange(targetId, gauge) {
        var tempString = targetId.replace(gauge.element.id, '').split('_Axis_')[1];
        return {
            axisIndex: +tempString[0],
            rangeIndex: +tempString.split('Range_')[1]
        };
    }
    exports.getRange = getRange;
});