"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../..//utils");
var _ = require("lodash");
var theme = utils_1.PageUtil.theme() == 'blue' ? 'blue' : 'default';
// 阴影样式
var ShadowMatrix = {
    'blue': "\n    0 0 0 .2 0\n    0 0 0 .2 0\n    0 0 0 .2 0\n    0 0 0 .2 0\n    ",
    'default': "\n    0 0 0 .2 0\n    0 0 0 .2 0\n    0 0 0 .2 0\n    0 0 0 .2 0\n    "
};
var name = /** @class */ (function () {
    function name() {
    }
    /**
     * 生成一个唯一ID
    */
    name.genId = function () {
        return '__vap__chart__' + _.now() + '_' + _.random(0, 10000);
    };
    name.fixMax = function (max) {
        if (max == 0) {
            return 1;
        }
        var splitLevel = [1.5, 2, 2.5, 3, 4, 5, 6, 8, 10, 12];
        var size = (max + '').length;
        var base = Math.pow(10, size - 1);
        var splitCount = Math.ceil(max / base);
        var larger = 0.2 * Math.ceil(splitCount / 3);
        var maxFix = 0;
        for (var i = 0, _i = splitLevel.length; i < _i; i++) {
            maxFix = splitLevel[i] * base;
            if ((maxFix - max) / base >= larger) {
                break;
            }
        }
        return maxFix;
    };
    //制作阴影
    name.BuildShadow = function () {
        return "<filter id=\"_ec_def_shadow\">\n        <feColorMatrix type=\"matrix\" values=\"" + ShadowMatrix[theme] + "\"></feColorMatrix>\n        <feGaussianBlur stdDeviation=\"1\" result=\"colorBlur1\"></feGaussianBlur>\n\n        <feOffset result=\"offsetBlur1\" in=\"colorBlur1\" dx=\"1\" dy=\"1\" />\n        <feOffset result=\"offsetBlur2\" in=\"colorBlur1\" dx=\"3\" dy=\"3\" />\n        <feMerge>\n            <feMergeNode in=\"offsetBlur1\" />\n            <feMergeNode in=\"offsetBlur2\" />\n            <feMergeNode in=\"SourceGraphic\" />\n        </feMerge>\n    </filter>\n    <filter id=\"_ec_def_shadow_hover\">\n        <feColorMatrix type=\"matrix\" values=\"" + ShadowMatrix[theme] + "\"></feColorMatrix>\n        <feGaussianBlur stdDeviation=\"1\" result=\"colorBlur1\"></feGaussianBlur>\n\n        <feOffset result=\"offsetBlur0\" in=\"colorBlur1\" dx=\"0\" dy=\"0\" />\n        <feOffset result=\"offsetBlur1\" in=\"colorBlur1\" dx=\"1\" dy=\"1\" />\n        <feOffset result=\"offsetBlur2\" in=\"colorBlur1\" dx=\"3\" dy=\"3\" />\n        <feOffset result=\"offsetBlur3\" in=\"colorBlur1\" dx=\"5\" dy=\"5\" />\n        <feMerge>\n            <feMergeNode in=\"offsetBlur0\" />\n            <feMergeNode in=\"offsetBlur1\" />\n            <feMergeNode in=\"offsetBlur2\" />\n            <feMergeNode in=\"offsetBlur3\" />\n            <feMergeNode in=\"SourceGraphic\" />\n        </feMerge>\n    </filter>\n    ";
    };
    name.BuildBarGrinder = function () {
        return "<linearGradient id=\"_vc_bar_top_linar\" x1=\"0%\" y1=\"0%\" x2=\"0%\" y2=\"100%\">\n        <stop offset=\"0%\" style=\"stop-color:#855699;stop-opacity:1\" />\n        <stop offset=\"100%\" style=\"stop-color:#6D8DC2;stop-opacity:1\" />\n      </linearGradient>";
    };
    /**
     * 条状图下中间的图案填充
    */
    name.BuildMutiBarImage = function () {
        // objectBoundingBox
        return "<pattern id=\"_vc_bar_top2_image0\" patternUnits=\"userSpaceOnUse\" width=\"38\" height=\"8\" x=\"0\" y=\"0\">\n                    <image xlink:href=\"/images/charts/_vc_top_bar_0.png\"  x=\"0\" y=\"0\" width=\"38\" height=\"8\"/>\n                </pattern>\n                <pattern id=\"_vc_bar_top2_image1\" patternUnits=\"userSpaceOnUse\" width=\"38\" height=\"8\" x=\"0\" y=\"0\">\n                    <image xlink:href=\"/images/charts/_vc_top_bar_1.png\" x=\"0\" y=\"0\" width=\"38\" height=\"8\" />\n                </pattern>\n                <pattern id=\"_vc_bar_top2_image2\" patternUnits=\"userSpaceOnUse\" width=\"38\" height=\"8\" x=\"0\" y=\"0\">\n                    <image xlink:href=\"/images/charts/_vc_top_bar_2.png\" x=\"0\" y=\"0\" width=\"38\" height=\"8\" />\n                </pattern>\n                <pattern id=\"_vc_bar_top2_image3\" patternUnits=\"userSpaceOnUse\" width=\"38\" height=\"8\" x=\"0\" y=\"0\">\n                    <image xlink:href=\"/images/charts/_vc_top_bar_3.png\" x=\"0\" y=\"0\" width=\"38\" height=\"8\" />\n                </pattern>";
    };
    /**
     * 时间区间分布图蹭的柱
     *
    */
    name.BuildLineDistribution = function () {
        return "<linearGradient id=\"vet_bar\" x1=\"0%\" y1=\"100%\" x2=\"0%\" y2=\"0%\">\n        <stop offset=\"0%\" stop-color=\"#02CBFE\"></stop>\n        <stop offset=\"100%\" stop-color=\"#0D365D\"></stop>\n        </linearGradient>\n        <linearGradient id=\"vet_bar_hover\" x1=\"0%\" y1=\"100%\" x2=\"0%\" y2=\"0%\">\n        <stop offset=\"0%\" stop-color=\"#C94BC3\"></stop>\n        <stop offset=\"100%\" stop-color=\"#0D365D\"></stop>\n        </linearGradient>";
    };
    return name;
}());
exports.default = name;
