Code coverage report for src/compiler/style.js

Statements: 93.94% (31 / 33)      Branches: 92.31% (24 / 26)      Functions: 100% (3 / 3)      Lines: 93.94% (31 / 33)      Ignored: none     

All files » src/compiler/ » style.js
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 541 1 1 42       1 1   1 42     42 42 27 27 69     56         15 3 12 12 12     12 1   12   39 39 21   18 10   8 5     3   39    
var vlEncDef = require('../encdef');
var consts_1 = require('../consts');
function default_1(encoding, stats) {
    return {
        opacity: estimateOpacity(encoding, stats),
    };
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
;
function estimateOpacity(encoding, stats) {
    Iif (!stats) {
        return 1;
    }
    var numPoints = 0;
    if (encoding.isAggregate()) {
        numPoints = 1;
        encoding.forEach(function (encDef, encType) {
            if (encType !== consts_1.Enctype.ROW && encType !== consts_1.Enctype.COL &&
                !((encType === consts_1.Enctype.X || encType === consts_1.Enctype.Y) &&
                    vlEncDef.isOrdinalScale(encDef))) {
                numPoints *= encoding.cardinality(encType, stats);
            }
        });
    }
    else {
        if (!stats['*'])
            return 1;
        numPoints = stats['*'].max;
        var numMultiples = 1;
        Iif (encoding.has(consts_1.Enctype.ROW)) {
            numMultiples *= encoding.cardinality(consts_1.Enctype.ROW, stats);
        }
        if (encoding.has(consts_1.Enctype.COL)) {
            numMultiples *= encoding.cardinality(consts_1.Enctype.COL, stats);
        }
        numPoints /= numMultiples;
    }
    var opacity = 0;
    if (numPoints <= 25) {
        opacity = 1;
    }
    else if (numPoints < 200) {
        opacity = 0.8;
    }
    else if (numPoints < 1000 || encoding.is('tick')) {
        opacity = 0.7;
    }
    else {
        opacity = 0.3;
    }
    return opacity;
}
//# sourceMappingURL=style.js.map