From 96fd03806550d25df5e7a35b3961ba47c71c900a Mon Sep 17 00:00:00 2001 From: JM <743192023@qq.com> Date: Wed, 25 Dec 2019 10:23:20 +0800 Subject: [PATCH] update dist and lib --- dist/charts.map.js | 4 ++-- dist/charts.min.js | 2 +- lib/core/pie.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/charts.map.js b/dist/charts.map.js index 82e0ffc..f22d559 100644 --- a/dist/charts.map.js +++ b/dist/charts.map.js @@ -6061,7 +6061,7 @@ function calcPiesPercent(pies) { var percent = _ref5.percent; return percent; })); - data.slice(-1)[0].percent = 100 - percentSumNoLast; + data.slice(-1)[0].percent = parseFloat((100 - percentSumNoLast).toFixed(percentToFixed)); }); return pies; } @@ -12556,4 +12556,4 @@ try { } },{}]},{},[1]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJidWlsZC9lbnRyeS5qcyIsImxpYi9jbGFzcy9jaGFydHMuY2xhc3MuanMiLCJsaWIvY2xhc3MvdXBkYXRlci5jbGFzcy5qcyIsImxpYi9jb25maWcvYXhpcy5qcyIsImxpYi9jb25maWcvYmFyLmpzIiwibGliL2NvbmZpZy9jb2xvci5qcyIsImxpYi9jb25maWcvZ2F1Z2UuanMiLCJsaWIvY29uZmlnL2dyaWQuanMiLCJsaWIvY29uZmlnL2luZGV4LmpzIiwibGliL2NvbmZpZy9sZWdlbmQuanMiLCJsaWIvY29uZmlnL2xpbmUuanMiLCJsaWIvY29uZmlnL3BpZS5qcyIsImxpYi9jb25maWcvcmFkYXIuanMiLCJsaWIvY29uZmlnL3JhZGFyQXhpcy5qcyIsImxpYi9jb25maWcvdGl0bGUuanMiLCJsaWIvY29yZS9heGlzLmpzIiwibGliL2NvcmUvYmFyLmpzIiwibGliL2NvcmUvZ2F1Z2UuanMiLCJsaWIvY29yZS9ncmlkL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uICAgICAgICAgICAgdGhpcy5hbmltYXRpb25Sb290LnB1c2goY2hhbmdlUm9vdCk7XG4gICAgICAgICAgICB0aGlzLmFuaW1hdGlvbktleXMucHVzaChjaGFuZ2VLZXlzKTtcbiAgICAgICAgICAgIHRoaXMuYW5pbWF0aW9uRnJhbWVTdGF0ZS5wdXNoKGFuaW1hdGlvbkZyYW1lU3RhdGUpO1xuXG4gICAgICAgICAgICBpZiAoIXdhaXQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIGlmICghKGFuaW1hdGlvbkRlbGF5ID4gMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gZGVsYXkoYW5pbWF0aW9uRGVsYXkpO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIHJlbmRlciA9IHRoaXMucmVuZGVyO1xuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cIiwgbmV3IFByb21pc2UoXG4gICAgICAgICAgICAvKiNfX1BVUkVfXyovXG4gICAgICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgIHZhciBfcmVmMyA9ICgwLCBfYXN5bmNUb0dlbmVyYXRvcjJbXCJkZWZhdWx0XCJdKShcbiAgICAgICAgICAgICAgLyojX19QVVJFX18qL1xuICAgICAgICAgICAgICBfcmVnZW5lcmF0b3JbXCJkZWZhdWx0XCJdLm1hcmsoZnVuY3Rpb24gX2NhbGxlZShyZXNvbHZlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvcltcImRlZmF1bHRcIl0ud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlbmRlci5sYXVuY2hBbmltYXRpb24oKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgX2NhbGxlZSk7XG4gICAgICAgICAgICAgIH0pKTtcblxuICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKF94Mykge1xuICAgICAgICAgICAgICAgIHJldHVybiBfcmVmMy5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfSgpKSk7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICB9KSk7XG5cbiAgcmV0d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ICAgc3RhdGUgPSBjb250ZXh0LmRvbmVcbiAgICAgICAgICAgID8gR2VuU3RhdGVDb21wbGV0ZWRcbiAgICAgICAgICAgIDogR2VuU3RhdGVTdXNwZW5kZWRZaWVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIHN0YXRlID0gR2VuU3RhdGVDb21wbGV0ZWQ7XG4gICAgICAgICAgLy8gRGlzcGF0Y2ggdGhlIGV4Y2VwdGlvbiBieSBsb29waW5nIGJhY2sgYXJvdW5kIHRvIHRoZVxuICAgICAgICAgIC8vIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpIGNhbGwgYWJvdmUuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8vIENhbGwgZGVsZWdhdGUuaXRlcmF0b3JbY29udGV4dC5tZXRob2RdKGNvbnRleHQuYXJnKSBhbmQgaGFuZGxlIHRoZVxuICAvLyByZXN1bHQsIGVpdGhlciBieSByZXR1cm5pbmcgYSB7IHZhbHVlLCBkb25lIH0gcmVzdWx0IGZyb20gdGhlXG4gIC8vIGRlbGVnYXRlIGl0ZXJhdG9yLCBvciBieSBtb2RpZnlpbmcgY29udGV4dC5tZXRob2QgYW5kIGNvbnRleHQuYXJnLFxuICAvLyBzZXR0aW5nIGNvb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ZWxlZ2F0ZShjb250ZXh0KSBjaGFuZ2VkIGNvbnRleHQubWV0aG9kIGZyb21cbiAgICAgICAgICAgIC8vIFwicmV0dXJuXCIgdG8gXCJ0aHJvd1wiLCBsZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3RcIik7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuIC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RlciBvZiB0aGVzZSBjb25kaXRpb25zOlxuICAgICAgICAgIGlmIChuYW1lLmNoYXJBdCgwKSA9PT0gXCJ0XCIgJiZcbiAgICAgICAgICAgICAgaGFzT3duLmNhbGwodGhpcywgbmFtZSkgJiZcbiAgICAgICAgICAgICAgIWlzTmFOKCtuYW1lLnNsaWNlKDEpKSkge1xuICAgICAgICAgICAgdGhpc1tuYW1lXSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgc3RvcDogZnVuY3Rpb24oKSB7XG4gICAgICB0aGlzLmRvbmUgPSB0cnVlO1xuXG4gICAgICB2YXIgcm9vdEVudHJ5ID0gdGhpcy50cnlFbnRyaWVzWzBdO1xuICAgICAgdmFyIHJvb3RSZWNvcmQgPSByb290RW50cnkuY29tcGxldGlvbjtcbiAgICAgIGlmIChyb290UmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICB0aHJvdyByb290UmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHRoaXMucnZhbDtcbiAgICB9LFxuXG4gICAgZGlzcGF0Y2hFeGNlcHRpb246IGZ1bmN0aW9uKGV4Y2VwdGlvbikge1xuICAgICAgaWYgKHRoaXMuZG9uZSkge1xuICAgICAgICB0aHJvdyBleGNlcHRpb247XG4gICAgICB9XG5cbiAgICAgIHZhciBjb250ZXh0ID0gdGhpcztcbiAgICAgIGZ1bmN0aW9uIGhhbmRsZShsb2MsIGNhdWdodCkge1xuICAgICAgICByZWNvcmQudHlwZSA9IFwidGhyb3dcIjtcbiAgICAgICAgcmVjb3JkLmFyZyA9IGV4Y2VwdGlvbjtcbiAgICAgICAgY29udGV4dC5uZXh0ID0gbG9jO1xuXG4gICAgICAgIGlmIChjYXVnaHQpIHtcbiAgICAgICAgICAvLyBJZiB0aGUgZGlzcGF0Y2hlZCBleGNlcHRpb24gd2FzIGNhdWdodCBieSBhIGNhdGN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ICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmNhdGNoTG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfSBlbHNlIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0NhdGNoKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidHJ5IHN0YXRlbWVudCB3aXRob3V0IGNhdGNoIG9yIGZpbmFsbHlcIik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIGFicnVwdDogZnVuY3Rpb24odHlwZSwgYXJnKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LnRyeUxvYyA8PSB0aGlzLnByZXYgJiZcbiAgICAgICAgICAgIGhh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Vjb3JkLCBhZnRlckxvYykge1xuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICByZWNvcmQudHlwZSA9PT0gXCJjb250aW51ZVwiKSB7XG4gICAgICAgIHRoaXMubmV4dCA9IHJlY29yZC5hcmc7XG4gICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcInJldHVyblwiKSB7XG4gICAgICAgIHRoaXMucnZhbCA9IHRoaXMuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcInJldHVyblwiO1xuICAgICAgICB0aGlzLm5leHQgPSBcImVuZFwiO1xuICAgICAgfSBlbHNlIGlmIChyZWNvcmQudHlwZSA9PT0gXCJub3JtYWxcIiAmJiBhZnRlckxvYykge1xuICAgICAgICB0aGlzLm5leHQgPSBhZnRlckxvYztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfSxcblxuICAgIGZpbmlzaDogZnVuY3Rpb24oZmluYWxseUxvYykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS5maW5hbGx5TG9jID09PSBmaW5hbGx5TG9jKSB7XG4gICAgICAgICAgdGhpcy5jb21wbGV0ZShlbnRyeS5jb21wbGV0aW9uLCBlbnRyeS5hZnRlckxvYyk7XG4gICAgICAgICAgcmVzZXRUcnlFbnRyeShlbnRyeSk7XG4gICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgXC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5cbiAgRnVuY3Rpb24oXCJyXCIsIFwicmVnZW5lcmF0b3JSdW50aW1lID0gclwiKShydW50aW1lKTtcbn1cbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJidWlsZC9lbnRyeS5qcyIsImxpYi9jbGFzcy9jaGFydHMuY2xhc3MuanMiLCJsaWIvY2xhc3MvdXBkYXRlci5jbGFzcy5qcyIsImxpYi9jb25maWcvYXhpcy5qcyIsImxpYi9jb25maWcvYmFyLmpzIiwibGliL2NvbmZpZy9jb2xvci5qcyIsImxpYi9jb25maWcvZ2F1Z2UuanMiLCJsaWIvY29uZmlnL2dyaWQuanMiLCJsaWIvY29uZmlnL2luZGV4LmpzIiwibGliL2NvbmZpZy9sZWdlbmQuanMiLCJsaWIvY29uZmlnL2xpbmUuanMiLCJsaWIvY29uZmlnL3BpZS5qcyIsImxpYi9jb25maWcvcmFkYXIuanMiLCJsaWIvY29uZmlnL3JhZGFyQXhpcy5qcyIsImxpYi9jb25maWcvdGl0bGUuanMiLCJsaWIvY29yZS9heGlzLmpzIiwibGliL2NvcmUvYmFyLmpzIiwibGliL2NvcmUvZ2F1Z2UuanMiLCJsaWIvY29yZS9ncmlkLmpzIiwibGliL2NvcmUvaW5kZXguanMiLCJsaWIvY29yZS9sZWdlbmQuanMiLCJsaWIvY29yZS9saW5lLmpzIiwibGliL2NvcmUvbWVyZ2VDb2xvci5qcyIsImxpYi9jb3JlL3BpZS5qcyIsImxpYi9jb3JlL3JhZGFyLmpzIiwibGliL2NvcmUvcmFkYXJBeGlzLmpzIiwibGliL2NvcmUvdGl0bGUuanMiLCJsaWIvZXh0ZW5kL2luZGV4LmpzIiwibGliL2luZGV4LmpzIiwibGliL3V0aWwvaW5kZXguanMiLCJub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9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gICAgICAgIHZhciBvZmZzZXQgPSAwO1xuXG4gICAgICAgIGZvciAodmFyIGogPSAwOyBqIDwgY3VycmVudFNlZ21lbnRQb2ludHNOdW07IGorKykge1xuICAgICAgICAgIGlmIChqID09PSAwKSByZXR1cm47XG4gICAgICAgICAgb2Zmc2V0ICs9IGRldmlhdGlvbnNbaiAtIDFdO1xuICAgICAgICAgIHRbal0gLT0gc3RlcFNpemUgKiBvZmZzZXQ7XG4gICAgICAgICAgaWYgKHRbal0gPiAxKSB0W2pdID0gMTtcbiAgICAgICAgICBpZiAodFtqXSA8IDApIHRbal0gPSAwO1xuICAgICAgICAgIHNlZ21lbnRQb2ludHNbaV1bal0gPSBnZXRTZWdtZW50VFBvaW50RnVuKHRbal0pO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSk7XG4gICAgcm91bmRzICo9IDQ7XG4gICAgY3ljbGVzKys7XG4gIH07XG5cbiAgZG8ge1xuICAgIHZhciBfcmV0ID0gX2xvb3AoKTtcblxuICAgIGlmIChfcmV0ID09PSBcImJyZWFrXCIpIGJyZWFrO1xuICB9IHdoaWxlIChyb3VuZHMgPD0gMTAyNSk7XG5cbiAgc2VnbWVudFBvaW50cyA9IHNlZ21lbnRQb2ludHMucmVkdWNlKGZ1bmN0aW9uIChhbGwsIHNlZykge1xuICAgIHJldHVybiBhbGwuY29uY2F0KHNlZyk7XG4gIH0sIFtdKTtcbiAgcmV0dXJuIHtcbiAgICBzZWdtZW50UG9pbnRzOiBzZWdtZW50UG9pbnRzLFxuICAgIGN5Y2xlczogY3ljbGVzLFxuICAgIHJvdW5kczogcm91bmRzXG4gIH07XG59XG4vKipcclxuICogQGRlc2NyaXB0aW9uIEdldCB0aGUgcG9seWxpbmUgY29ycmVzcG9uZGluZyB0byB0aGUgQmV6aWVyIGN1cnZlXHJcbiAqIEBwYXJhbSB7QXJyYXl9IGJlemllckN1cnZlIEJlemllckN1cnZlIGRhdGFcclxuICogQHBhcmFtIHtOdW1iZXJ9IHByZWN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S2V5cy5wdXNoKGNoYW5nZUtleXMpO1xuICAgICAgICAgICAgdGhpcy5hbmltYXRpb25GcmFtZVN0YXRlLnB1c2goYW5pbWF0aW9uRnJhbWVTdGF0ZSk7XG5cbiAgICAgICAgICAgIGlmICghd2FpdCkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDE3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cIik7XG5cbiAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgaWYgKCEoYW5pbWF0aW9uRGVsYXkgPiAwKSkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDIwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyMDtcbiAgICAgICAgICAgIHJldHVybiBkZWxheShhbmltYXRpb25EZWxheSk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgcmVuZGVyID0gdGhpcy5yZW5kZXI7XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCBuZXcgUHJvbWlzZShcbiAgICAgICAgICAgIC8qI19fUFVSRV9fKi9cbiAgICAgICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgdmFyIF9yZWYzID0gKDAsIF9hc3luY1RvR2VuZXJhdG9yMltcImRlZmF1bHRcIl0pKFxuICAgICAgICAgICAgICAvKiNfX1BVUkVfXyovXG4gICAgICAgICAgICAgIF9yZWdlbmVyYXRvcltcImRlZmF1bHRcIl0ubWFyayhmdW5jdGlvbiBfY2FsbGVlKHJlc29sdmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yW1wiZGVmYXVsdFwiXS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICAgICAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVuZGVyLmxhdW5jaEFuaW1hdGlvbigpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LCBfY2FsbGVlKTtcbiAgICAgICAgICAgICAgfSkpO1xuXG4gICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoX3gzKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9yZWYzLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9KCkpKTtcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5zdG9wKCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LCBfY2FsbGVlMiwgdGhpcyk7XG4gIH0pKTtcblxuICByZXR1cm4gZnVuY3Rpb24gKF94LCBfeDIpIHtcbiAgICByZXR1cm4gX3JlZjIuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgfTtcbn0oKT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gQ29udGludWVTZW50aW5lbCkgY29udGludWU7XG4gICAgICAgICAgICByZXR1cm4gZGVsZWdhdGVSZXN1bHQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGNvbnRleHQubWV0aG9kID09PSBcIm5leHRcIikge1xuICAgICAgICAgIC8vIFNldHRpbmcgY29udGV4dC5fc2VudCBmb3IgbGVnYWN5IHN1cHBvcnQgb2YgQmFiZWwnc1xuICAgICAgICAgIC8vIGZ1bmN0aW9uLnNlbnQgaW1wbGVtZW50YXRpb24uXG4gICAgICAgICAgY29udGV4dC5zZW50ID0gY29udGV4dC5fc2VudCA9IGNvbnRleHQuYXJnO1xuXG4gICAgICAgIH0gZWxzZSBpZiAoY29udGV4dC5tZXRob2QgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIGlmIChzdGF0ZSA9PT0gR2VuU3RhdGVTdXNwZW5kZWRTdGFydCkge1xuICAgICAgICAgICAgc3RhdGUgPSBHZW5TdGF0ZUNvbXBsZXRlZDtcbiAgICAgICAgICAgIHRocm93IGNvbnRleHQuYXJnO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpO1xuXG4gICAgICAgIH0gZWxzZSBpZiAoY29udGV4dC5tZXRob2QgPT09IFwicmV0dXJuXCIpIHtcbiAgICAgICAgICBjb250ZXh0LmFicnVwdChcInJldHVyblwiLCBjb250ZXh0LmFyZyk7XG4gICAgICAgIH1cblxuICAgICAgICBzdGF0ZSA9IEdlblN0YXRlRXhlY3V0aW5nO1xuXG4gICAgICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChpbm5lckZuLCBzZWxmLCBjb250ZXh0KTtcbiAgICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcIm5vcm1hbFwiKSB7XG4gICAgICAgICAgLy8gSWYgYW4gZXhjZXB0aW9uIGlzIHRocm93biBmcm9tIGlubmVyRm4sIHdlIGxlYXZ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tYXliZUludm9rZURlbGVnYXRlKGRlbGVnYXRlLCBjb250ZXh0KTtcblxuICAgICAgICAgIGlmIChjb250ZXh0Lm1ldGhvZCA9PT0gXCJ0aHJvd1wiKSB7XG4gICAgICAgICAgICAvLyBJZiBtYXliZUludm9rZURlbGVnYXRlKGNvbnRleHQpIGNoYW5nZWQgY29udGV4dC5tZXRob2QgZnJvbVxuICAgICAgICAgICAgLy8gXCJyZXR1cm5cIiB0byBcInRocm93XCIsIGxldCB0aGF0IG92ZXJyaWRlIHRoZSBUeXBlRXJyb3IgYmVsb3cuXG4gICAgICAgICAgICByZXR1cm4gQ29udGludWVTZW50aW5lbDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBjb250ZXh0Lm1ldGhvZCA9IFwidGhyb3dcIjtcbiAgICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFxuICAgICAgICAgIFwiVGhlIGl0ZXJhdG9yIGRvZXMgbm90IHByb3ZpZGUgYSAndGhyb3cnIG1ldGhvZFwiKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfVxuXG4gICAgdmFyIHJlY29yZCA9IHRyeUNhdGNoKG1ldGhvZCwgZGVsZWdhdGUuaXRlcmF0b3IsIGNvbnRleHQuYXJnKTtcblxuICAgIGlmIChyZWNvcmQudHlwZSA9PT0gXCJ0aHJvd1wiKSB7XG4gICAgICBjb250ZXh0Lm1ldGhvZCA9IFwidGhyb3dcIjtcbiAgICAgIGNvbnRleHQuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgIGNvbnRleHQuZGVsZWdhdGUgPSBudWxsO1xuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfVxuXG4gICAgdmFyIGluZm8gPSByZWNvcmQuYXJnO1xuXG4gICAgaWYgKCEgaW5mbykge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0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hdGNoTG9jXCIpO1xuICAgICAgICAgIHZhciBoYXNGaW5hbGx5ID0gaGFzT3duLmNhbGwoZW50cnksIFwiZmluYWxseUxvY1wiKTtcblxuICAgICAgICAgIGlmIChoYXNDYXRjaCAmJiBoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5maW5hbGx5TG9jKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSBpZiAoaGFzQ2F0Y2gpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5jYXRjaExvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmNhdGNoTG9jLCB0cnVlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSBpZiAoaGFzRmluYWxseSkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5maW5hbGx5TG9jKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJ0cnkgc3RhdGVtZW50IHdpdGhvdXQgY2F0Y2ggb3IgZmluYWxseVwiKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgYWJydXB0OiBmdW5jdGlvbih0eXBlLCBhcmcpIHtcbiAgICAgIGZvciAodmFyIGkgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgaSA+PSAwOyAtLWkpIHtcbiAgICAgICAgdmFyIGVudHJ5ID0gdGhpcy50cnlFbnRyaWVzW2ldO1xuICAgICAgICBpZiAoZW50cnkudHJ5TG9jIDw9IHRoaXMucHJldiAmJlxuICAgICAgICAgICAgaGFzT3duLmNhbGwoZW50cnksIFwiZmluYWxseUxvY1wiKSAmJlxuICAgICAgICAgICAgdGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgIHZhciBmaW5hbGx5RW50cnkgPSBlbnRyeTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAoZmluYWxseUVudHJ5ICYmXG4gICAgICAgICAgKHR5cGUgPT09IFwiYnJlYWtcIiB8fFxuICAgICAgICAgICB0eXBlID09PSBcImNvbnRpbnVlXCIpICYmXG4gICAgICAgICAgZmluYWxseUVudHJ5LnRyeUxvYyA8PSBhcmcgJiZcbiAgICAgICAgICBhcmcgPD0gZmluYWxseUVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgLy8gSWdub3JlIHRoZSBmaW5hbGx5IGVudHJ5IGlmIGNvbnRyb2wgaXMgbm90IGp1bXBpbmcgdG8gYVxuICAgICAgICAvLyBsb2NhdGlvbiBvdXRzaWRlIHRoZSB0cnkvY2F0Y2ggYmxvY2suXG4gICAgICAgIGZpbmFsbHlFbnRyeSA9IG51bGw7XG4gICAgICB9XG5cbiAgICAgIHZhciByZWNvcmQgPSBmaW5hbGx5RW50cnkgPyBmaW5hbGx5RW50cnkuY29tcGxldGlvbiA6IHt9O1xuICAgICAgcmVjb3JkLnR5cGUgPSB0eXBlO1xuICAgICAgcmVjb3JkLmFyZyA9IGFyZztcblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSkge1xuICAgICAgICB0aGlzLm1ldGhvZCA9IFwibmV4dFwiO1xuICAgICAgICB0aGlzLm5leHQgPSBmaW5hbGx5RW50cnkuZmluYWx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iAgLy8gQ1NQIHRvIGZvcmJpZCBGdW5jdGlvbiwgYW5kIHlvdSdyZSBub3Qgd2lsbGluZyB0byBmaXggZWl0aGVyIG9mIHRob3NlXG4gIC8vIHByb2JsZW1zLCBwbGVhc2UgZGV0YWlsIHlvdXIgdW5pcXVlIHByZWRpY2FtZW50IGluIGEgR2l0SHViIGlzc3VlLlxuICBGdW5jdGlvbihcInJcIiwgXCJyZWdlbmVyYXRvclJ1bnRpbWUgPSByXCIpKHJ1bnRpbWUpO1xufVxuIl19 diff --git a/dist/charts.min.js b/dist/charts.min.js index f27bc9a..9746c5f 100644 --- a/dist/charts.min.js +++ b/dist/charts.min.js @@ -1 +1 @@ -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i1&&arguments[1]!==undefined?arguments[1]:false;if(!option||(0,_typeof2["default"])(option)!=="object"){console.error("setOption Missing parameters!");return false}if(animationEnd)this.render.graphs.forEach(function(graph){return graph.animationEnd()});var optionCloned=(0,_util.deepClone)(option,true);(0,_core.mergeColor)(this,optionCloned);(0,_core.grid)(this,optionCloned);(0,_core.axis)(this,optionCloned);(0,_core.radarAxis)(this,optionCloned);(0,_core.title)(this,optionCloned);(0,_core.bar)(this,optionCloned);(0,_core.line)(this,optionCloned);(0,_core.pie)(this,optionCloned);(0,_core.radar)(this,optionCloned);(0,_core.gauge)(this,optionCloned);(0,_core.legend)(this,optionCloned);this.option=option;this.render.launchAnimation()};Charts.prototype.resize=function(){var container=this.container,canvas=this.canvas,render=this.render,option=this.option;var clientWidth=container.clientWidth,clientHeight=container.clientHeight;canvas.setAttribute("width",clientWidth);canvas.setAttribute("height",clientHeight);render.area=[clientWidth,clientHeight];this.setOption(option)}},{"../core":20,"../extend/index":28,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/plugin/util":54}],3:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.doUpdate=doUpdate;exports.Updater=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var Updater=function Updater(config,series){(0,_classCallCheck2["default"])(this,Updater);var chart=config.chart,key=config.key,getGraphConfig=config.getGraphConfig;if(typeof getGraphConfig!=="function"){console.warn("Updater need function getGraphConfig!");return}if(!chart[key])this.graphs=chart[key]=[];Object.assign(this,config);this.update(series)};exports.Updater=Updater;Updater.prototype.update=function(series){var _this=this;var graphs=this.graphs,beforeUpdate=this.beforeUpdate;delRedundanceGraph(this,series);if(!series.length)return;var beforeUpdateType=(0,_typeof2["default"])(beforeUpdate);series.forEach(function(seriesItem,i){if(beforeUpdateType==="function")beforeUpdate(graphs,seriesItem,i,_this);var cache=graphs[i];if(cache){changeGraphs(cache,seriesItem,i,_this)}else{addGraphs(graphs,seriesItem,i,_this)}})};function delRedundanceGraph(updater,series){var graphs=updater.graphs,render=updater.chart.render;var cacheGraphNum=graphs.length;var needGraphNum=series.length;if(cacheGraphNum>needGraphNum){var needDelGraphs=graphs.splice(needGraphNum);needDelGraphs.forEach(function(item){return item.forEach(function(g){return render.delGraph(g)})})}}function changeGraphs(cache,seriesItem,i,updater){var getGraphConfig=updater.getGraphConfig,render=updater.chart.render,beforeChange=updater.beforeChange;var configs=getGraphConfig(seriesItem,updater);balanceGraphsNum(cache,configs,render);cache.forEach(function(graph,j){var config=configs[j];if(typeof beforeChange==="function")beforeChange(graph,config);updateGraphConfigByKey(graph,config)})}function balanceGraphsNum(graphs,graphConfig,render){var cacheGraphNum=graphs.length;var needGraphNum=graphConfig.length;if(needGraphNum>cacheGraphNum){var lastCacheGraph=graphs.slice(-1)[0];var needAddGraphNum=needGraphNum-cacheGraphNum;var needAddGraphs=new Array(needAddGraphNum).fill(0).map(function(foo){return render.clone(lastCacheGraph)});graphs.push.apply(graphs,(0,_toConsumableArray2["default"])(needAddGraphs))}else if(needGraphNum0&&arguments[0]!==undefined?arguments[0]:{},chart=_ref.chart,series=_ref.series,key=_ref.key,getGraphConfig=_ref.getGraphConfig,getStartGraphConfig=_ref.getStartGraphConfig,beforeChange=_ref.beforeChange,beforeUpdate=_ref.beforeUpdate,afterAddGraph=_ref.afterAddGraph;if(chart[key]){chart[key].update(series)}else{chart[key]=new Updater({chart:chart,key:key,getGraphConfig:getGraphConfig,getStartGraphConfig:getStartGraphConfig,beforeChange:beforeChange,beforeUpdate:beforeUpdate,afterAddGraph:afterAddGraph},series)}}},{"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.yAxisConfig=exports.xAxisConfig=void 0;var xAxisConfig={name:"",show:true,position:"bottom",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:false,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.xAxisConfig=xAxisConfig;var yAxisConfig={name:"",show:true,position:"left",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:true,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.yAxisConfig=yAxisConfig},{}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.barConfig=void 0;var barConfig={show:true,name:"",stack:"",shapeType:"normal",echelonOffset:10,barWidth:"auto",barGap:"30%",barCategoryGap:"20%",xAxisIndex:0,yAxisIndex:0,data:[],backgroundBar:{show:false,width:"auto",style:{fill:"rgba(200, 200, 200, .4)"}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},gradient:{color:[],local:true},barStyle:{},independentColor:false,independentColors:[],rLevel:0,animationCurve:"easeOutCubic",animationFrame:50};exports.barConfig=barConfig},{}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.colorConfig=void 0;var colorConfig=["#37a2da","#32c5e9","#67e0e3","#9fe6b8","#ffdb5c","#ff9f7f","#fb7293","#e062ae","#e690d1","#e7bcf3","#9d96f5","#8378ea","#96bfff"];exports.colorConfig=colorConfig},{}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gaugeConfig=void 0;var gaugeConfig={show:true,name:"",radius:"60%",center:["50%","50%"],startAngle:-(Math.PI/4)*5,endAngle:Math.PI/4,min:0,max:100,splitNum:5,arcLineWidth:15,data:[],dataItemStyle:{},axisTick:{show:true,tickLength:6,style:{stroke:"#999",lineWidth:1}},axisLabel:{show:true,data:[],formatter:null,labelGap:5,style:{}},pointer:{show:true,valueIndex:0,style:{scale:[1,1],fill:"#fb7293"}},details:{show:false,formatter:null,offset:[0,0],valueToFixed:0,position:"center",style:{fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle"}},backgroundArc:{show:true,style:{stroke:"#e0e0e0"}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.gaugeConfig=gaugeConfig},{}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gridConfig=void 0;var gridConfig={left:"10%",right:"10%",top:60,bottom:60,style:{fill:"rgba(0, 0, 0, 0)"},rLevel:-30,animationCurve:"easeOutCubic",animationFrame:30};exports.gridConfig=gridConfig},{}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.changeDefaultConfig=changeDefaultConfig;Object.defineProperty(exports,"colorConfig",{enumerable:true,get:function get(){return _color.colorConfig}});Object.defineProperty(exports,"gridConfig",{enumerable:true,get:function get(){return _grid.gridConfig}});Object.defineProperty(exports,"xAxisConfig",{enumerable:true,get:function get(){return _axis.xAxisConfig}});Object.defineProperty(exports,"yAxisConfig",{enumerable:true,get:function get(){return _axis.yAxisConfig}});Object.defineProperty(exports,"titleConfig",{enumerable:true,get:function get(){return _title.titleConfig}});Object.defineProperty(exports,"lineConfig",{enumerable:true,get:function get(){return _line.lineConfig}});Object.defineProperty(exports,"barConfig",{enumerable:true,get:function get(){return _bar.barConfig}});Object.defineProperty(exports,"pieConfig",{enumerable:true,get:function get(){return _pie.pieConfig}});Object.defineProperty(exports,"radarAxisConfig",{enumerable:true,get:function get(){return _radarAxis.radarAxisConfig}});Object.defineProperty(exports,"radarConfig",{enumerable:true,get:function get(){return _radar.radarConfig}});Object.defineProperty(exports,"gaugeConfig",{enumerable:true,get:function get(){return _gauge.gaugeConfig}});Object.defineProperty(exports,"legendConfig",{enumerable:true,get:function get(){return _legend.legendConfig}});exports.keys=void 0;var _color=require("./color");var _grid=require("./grid");var _axis=require("./axis");var _title=require("./title");var _line=require("./line");var _bar=require("./bar");var _pie=require("./pie");var _radarAxis=require("./radarAxis");var _radar=require("./radar");var _gauge=require("./gauge");var _legend=require("./legend");var _util=require("../util");var allConfig={colorConfig:_color.colorConfig,gridConfig:_grid.gridConfig,xAxisConfig:_axis.xAxisConfig,yAxisConfig:_axis.yAxisConfig,titleConfig:_title.titleConfig,lineConfig:_line.lineConfig,barConfig:_bar.barConfig,pieConfig:_pie.pieConfig,radarAxisConfig:_radarAxis.radarAxisConfig,radarConfig:_radar.radarConfig,gaugeConfig:_gauge.gaugeConfig,legendConfig:_legend.legendConfig};function changeDefaultConfig(key,config){if(!allConfig["".concat(key,"Config")]){console.warn("Change default config Error - Invalid key!");return}(0,_util.deepMerge)(allConfig["".concat(key,"Config")],config)}var keys=["color","title","legend","xAxis","yAxis","grid","radarAxis","line","bar","pie","radar","gauge"];exports.keys=keys},{"../util":30,"./axis":4,"./bar":5,"./color":6,"./gauge":7,"./grid":8,"./legend":10,"./line":11,"./pie":12,"./radar":13,"./radarAxis":14,"./title":15}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.legendConfig=void 0;var legendConfig={show:true,orient:"horizontal",left:"auto",right:"auto",top:"auto",bottom:"auto",itemGap:10,iconWidth:25,iconHeight:10,selectAble:true,data:[],textStyle:{fontFamily:"Arial",fontSize:13,fill:"#000"},iconStyle:{},textUnselectedStyle:{fontFamily:"Arial",fontSize:13,fill:"#999"},iconUnselectedStyle:{fill:"#999"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.legendConfig=legendConfig},{}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.lineConfig=void 0;var lineConfig={show:true,name:"",stack:"",smooth:false,xAxisIndex:0,yAxisIndex:0,data:[],lineStyle:{lineWidth:1},linePoint:{show:true,radius:2,style:{fill:"#fff",lineWidth:1}},lineArea:{show:false,gradient:[],style:{opacity:.5}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.lineConfig=lineConfig},{}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.pieConfig=void 0;var pieConfig={show:true,name:"",radius:"50%",center:["50%","50%"],startAngle:-Math.PI/2,roseType:false,roseSort:true,roseIncrement:"auto",data:[],insideLabel:{show:false,formatter:"{percent}%",style:{fontSize:10,fill:"#fff",textAlign:"center",textBaseline:"middle"}},outsideLabel:{show:true,formatter:"{name}",style:{fontSize:11},labelLineBendGap:"20%",labelLineEndLength:50,labelLineStyle:{lineWidth:1}},pieStyle:{},percentToFixed:0,rLevel:10,animationDelayGap:60,animationCurve:"easeOutCubic",startAnimationCurve:"easeOutBack",animationFrame:50};exports.pieConfig=pieConfig},{}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarConfig=void 0;var radarConfig={show:true,name:"",data:[],radarStyle:{lineWidth:1},point:{show:true,radius:2,style:{fill:"#fff"}},label:{show:true,offset:[0,0],labelGap:5,formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarConfig=radarConfig},{}],14:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarAxisConfig=void 0;var radarAxisConfig={show:true,center:["50%","50%"],radius:"65%",startAngle:-Math.PI/2,splitNum:5,polygon:false,axisLabel:{show:true,labelGap:15,color:[],style:{fill:"#333"}},axisLine:{show:true,color:[],style:{stroke:"#999",lineWidth:1}},splitLine:{show:true,color:[],style:{stroke:"#d4d4d4",lineWidth:1}},splitArea:{show:false,color:["#f5f5f5","#e6e6e6"],style:{}},rLevel:-10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarAxisConfig=radarAxisConfig},{}],15:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.titleConfig=void 0;var titleConfig={show:true,text:"",offset:[0,-20],style:{fill:"#333",fontSize:17,fontWeight:"bold",textAlign:"center",textBaseline:"bottom"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.titleConfig=titleConfig},{}],16:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.axis=axis;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _config=require("../config");var _util=require("../util");var _util2=require("@jiaminghi/c-render/lib/plugin/util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var allAxis=[];if(xAxis&&yAxis&&series){allAxis=getAllAxis(xAxis,yAxis);allAxis=mergeDefaultAxisConfig(allAxis);allAxis=allAxis.filter(function(_ref){var show=_ref.show;return show});allAxis=mergeDefaultBoundaryGap(allAxis);allAxis=calcAxisLabelData(allAxis,series);allAxis=setAxisPosition(allAxis);allAxis=calcAxisLinePosition(allAxis,chart);allAxis=calcAxisTickPosition(allAxis,chart);allAxis=calcAxisNamePosition(allAxis,chart);allAxis=calcSplitLinePosition(allAxis,chart)}(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLine",getGraphConfig:getLineConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisTick",getGraphConfig:getTickConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLabel",getGraphConfig:getLabelConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisName",getGraphConfig:getNameConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"splitLine",getGraphConfig:getSplitLineConfig});chart.axisData=allAxis}function getAllAxis(xAxis,yAxis){var allXAxis=[],allYAxis=[];if(xAxis instanceof Array){var _allXAxis;(_allXAxis=allXAxis).push.apply(_allXAxis,(0,_toConsumableArray2["default"])(xAxis))}else{allXAxis.push(xAxis)}if(yAxis instanceof Array){var _allYAxis;(_allYAxis=allYAxis).push.apply(_allYAxis,(0,_toConsumableArray2["default"])(yAxis))}else{allYAxis.push(yAxis)}allXAxis.splice(2);allYAxis.splice(2);allXAxis=allXAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"x"})});allYAxis=allYAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"y"})});return[].concat((0,_toConsumableArray2["default"])(allXAxis),(0,_toConsumableArray2["default"])(allYAxis))}function mergeDefaultAxisConfig(allAxis){var xAxis=allAxis.filter(function(_ref2){var axis=_ref2.axis;return axis==="x"});var yAxis=allAxis.filter(function(_ref3){var axis=_ref3.axis;return axis==="y"});xAxis=xAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.xAxisConfig),axis)});yAxis=yAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.yAxisConfig),axis)});return[].concat((0,_toConsumableArray2["default"])(xAxis),(0,_toConsumableArray2["default"])(yAxis))}function mergeDefaultBoundaryGap(allAxis){var valueAxis=allAxis.filter(function(_ref4){var data=_ref4.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref5){var data=_ref5.data;return data!=="value"});valueAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=false});labelAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=true});return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcAxisLabelData(allAxis,series){var valueAxis=allAxis.filter(function(_ref6){var data=_ref6.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref7){var data=_ref7.data;return data instanceof Array});valueAxis=calcValueAxisLabelData(valueAxis,series);labelAxis=calcLabelAxisLabelData(labelAxis);return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcValueAxisLabelData(valueAxis,series){return valueAxis.map(function(axis){var minMaxValue=getValueAxisMaxMinValue(axis,series);var _getTrueMinMax=getTrueMinMax(axis,minMaxValue),_getTrueMinMax2=(0,_slicedToArray2["default"])(_getTrueMinMax,2),min=_getTrueMinMax2[0],max=_getTrueMinMax2[1];var interval=getValueInterval(min,max,axis);var formatter=axis.axisLabel.formatter;var label=[];if(minMaxValue[0]===minMaxValue[1]){label=minMaxValue}else if(min<0&&max>0){label=getValueAxisLabelFromZero(min,max,interval)}else{label=getValueAxisLabelFromMin(min,max,interval)}label=label.map(function(l){return parseFloat(l.toFixed(2))});return _objectSpread({},axis,{maxValue:label.slice(-1)[0],minValue:label[0],label:getAfterFormatterLabel(label,formatter)})})}function getValueAxisMaxMinValue(axis,series){series=series.filter(function(_ref8){var show=_ref8.show,type=_ref8.type;if(show===false)return false;if(type==="pie")return false;return true});if(series.length===0)return[0,0];var index=axis.index,axisType=axis.axis;series=mergeStackData(series);var axisName=axisType+"Axis";var valueSeries=series.filter(function(s){return s[axisName]===index});if(!valueSeries.length)valueSeries=series;return getSeriesMinMaxValue(valueSeries)}function getSeriesMinMaxValue(series){if(!series)return;var minValue=Math.min.apply(Math,(0,_toConsumableArray2["default"])(series.map(function(_ref9){var data=_ref9.data;return Math.min.apply(Math,(0,_toConsumableArray2["default"])((0,_util.filterNonNumber)(data)))})));var maxValue=Math.max.apply(Math,(0,_toConsumableArray2["default"])(series.map(function(_ref10){var data=_ref10.data;return Math.max.apply(Math,(0,_toConsumableArray2["default"])((0,_util.filterNonNumber)(data)))})));return[minValue,maxValue]}function mergeStackData(series){var seriesCloned=(0,_util2.deepClone)(series,true);series.forEach(function(item,i){var data=(0,_util.mergeSameStackData)(item,series);seriesCloned[i].data=data});return seriesCloned}function getTrueMinMax(_ref11,_ref12){var min=_ref11.min,max=_ref11.max,axis=_ref11.axis;var _ref13=(0,_slicedToArray2["default"])(_ref12,2),minValue=_ref13[0],maxValue=_ref13[1];var minType=(0,_typeof2["default"])(min),maxType=(0,_typeof2["default"])(max);if(!testMinMaxType(min)){min=axisConfig[axis+"AxisConfig"].min;minType="string"}if(!testMinMaxType(max)){max=axisConfig[axis+"AxisConfig"].max;maxType="string"}if(minType==="string"){min=parseInt(minValue-abs(minValue*parseFloat(min)/100));var lever=getValueLever(min);min=parseFloat((min/lever-.1).toFixed(1))*lever}if(maxType==="string"){max=parseInt(maxValue+abs(maxValue*parseFloat(max)/100));var _lever=getValueLever(max);max=parseFloat((max/_lever+.1).toFixed(1))*_lever}return[min,max]}function getValueLever(value){var valueString=abs(value).toString();var valueLength=valueString.length;var firstZeroIndex=valueString.replace(/0*$/g,"").indexOf("0");var pow10Num=valueLength-1;if(firstZeroIndex!==-1)pow10Num-=firstZeroIndex;return pow(10,pow10Num)}function testMinMaxType(val){var valType=(0,_typeof2["default"])(val);var isValidString=valType==="string"&&/^\d+%$/.test(val);var isValidNumber=valType==="number";return isValidString||isValidNumber}function getValueAxisLabelFromZero(min,max,interval){var negative=[],positive=[];var currentNegative=0,currentPositive=0;do{negative.push(currentNegative-=interval)}while(currentNegative>min);do{positive.push(currentPositive+=interval)}while(currentPositive1)valueInterval=parseInt(valueInterval.toString().replace(/\d$/,"0"));if(valueInterval===0)valueInterval=1;if(typeof minInterval==="number"&&valueIntervalmaxInterval)return maxInterval;return valueInterval}function setAxisPosition(allAxis){var xAxis=allAxis.filter(function(_ref14){var axis=_ref14.axis;return axis==="x"});var yAxis=allAxis.filter(function(_ref15){var axis=_ref15.axis;return axis==="y"});if(xAxis[0]&&!xAxis[0].position)xAxis[0].position=_config.xAxisConfig.position;if(xAxis[1]&&!xAxis[1].position){xAxis[1].position=xAxis[0].position==="bottom"?"top":"bottom"}if(yAxis[0]&&!yAxis[0].position)yAxis[0].position=_config.yAxisConfig.position;if(yAxis[1]&&!yAxis[1].position){yAxis[1].position=yAxis[0].position==="left"?"right":"left"}return[].concat((0,_toConsumableArray2["default"])(xAxis),(0,_toConsumableArray2["default"])(yAxis))}function calcAxisLinePosition(allAxis,chart){var _chart$gridArea=chart.gridArea,x=_chart$gridArea.x,y=_chart$gridArea.y,w=_chart$gridArea.w,h=_chart$gridArea.h;allAxis=allAxis.map(function(axis){var position=axis.position;var linePosition=[];if(position==="left"){linePosition=[[x,y],[x,y+h]].reverse()}else if(position==="right"){linePosition=[[x+w,y],[x+w,y+h]].reverse()}else if(position==="top"){linePosition=[[x,y],[x+w,y]]}else if(position==="bottom"){linePosition=[[x,y+h],[x+w,y+h]]}return _objectSpread({},axis,{linePosition:linePosition})});return allAxis}function calcAxisTickPosition(allAxis,chart){return allAxis.map(function(axisItem){var axis=axisItem.axis,linePosition=axisItem.linePosition,position=axisItem.position,label=axisItem.label,boundaryGap=axisItem.boundaryGap;if(typeof boundaryGap!=="boolean")boundaryGap=axisConfig[axis+"AxisConfig"].boundaryGap;var labelNum=label.length;var _linePosition=(0,_slicedToArray2["default"])(linePosition,2),_linePosition$=(0,_slicedToArray2["default"])(_linePosition[0],2),startX=_linePosition$[0],startY=_linePosition$[1],_linePosition$2=(0,_slicedToArray2["default"])(_linePosition[1],2),endX=_linePosition$2[0],endY=_linePosition$2[1];var gapLength=axis==="x"?endX-startX:endY-startY;var gap=gapLength/(boundaryGap?labelNum:labelNum-1);var tickPosition=new Array(labelNum).fill(0).map(function(foo,i){if(axis==="x"){return[startX+gap*(boundaryGap?i+.5:i),startY]}return[startX,startY+gap*(boundaryGap?i+.5:i)]});var tickLinePosition=getTickLinePosition(axis,boundaryGap,position,tickPosition,gap);return _objectSpread({},axisItem,{tickPosition:tickPosition,tickLinePosition:tickLinePosition,tickGap:gap})})}function getTickLinePosition(axisType,boundaryGap,position,tickPosition,gap){var index=axisType==="x"?1:0;var plus=5;if(axisType==="x"&&position==="top")plus=-5;if(axisType==="y"&&position==="left")plus=-5;var tickLinePosition=tickPosition.map(function(lineStart){var lineEnd=(0,_util2.deepClone)(lineStart);lineEnd[index]+=plus;return[(0,_util2.deepClone)(lineStart),lineEnd]});if(!boundaryGap)return tickLinePosition;index=axisType==="x"?0:1;plus=gap/2;tickLinePosition.forEach(function(_ref16){var _ref17=(0,_slicedToArray2["default"])(_ref16,2),lineStart=_ref17[0],lineEnd=_ref17[1];lineStart[index]+=plus;lineEnd[index]+=plus});return tickLinePosition}function calcAxisNamePosition(allAxis,chart){return allAxis.map(function(axisItem){var nameGap=axisItem.nameGap,nameLocation=axisItem.nameLocation,position=axisItem.position,linePosition=axisItem.linePosition;var _linePosition2=(0,_slicedToArray2["default"])(linePosition,2),lineStart=_linePosition2[0],lineEnd=_linePosition2[1];var namePosition=(0,_toConsumableArray2["default"])(lineStart);if(nameLocation==="end")namePosition=(0,_toConsumableArray2["default"])(lineEnd);if(nameLocation==="center"){namePosition[0]=(lineStart[0]+lineEnd[0])/2;namePosition[1]=(lineStart[1]+lineEnd[1])/2}var index=0;if(position==="top"&&nameLocation==="center")index=1;if(position==="bottom"&&nameLocation==="center")index=1;if(position==="left"&&nameLocation!=="center")index=1;if(position==="right"&&nameLocation!=="center")index=1;var plus=nameGap;if(position==="top"&&nameLocation!=="end")plus*=-1;if(position==="left"&&nameLocation!=="start")plus*=-1;if(position==="bottom"&&nameLocation==="start")plus*=-1;if(position==="right"&&nameLocation==="end")plus*=-1;namePosition[index]+=plus;return _objectSpread({},axisItem,{namePosition:namePosition})})}function calcSplitLinePosition(allAxis,chart){var _chart$gridArea2=chart.gridArea,w=_chart$gridArea2.w,h=_chart$gridArea2.h;return allAxis.map(function(axisItem){var tickLinePosition=axisItem.tickLinePosition,position=axisItem.position,boundaryGap=axisItem.boundaryGap;var index=0,plus=w;if(position==="top"||position==="bottom")index=1;if(position==="top"||position==="bottom")plus=h;if(position==="right"||position==="bottom")plus*=-1;var splitLinePosition=tickLinePosition.map(function(_ref18){var _ref19=(0,_slicedToArray2["default"])(_ref18,1),startPoint=_ref19[0];var endPoint=(0,_toConsumableArray2["default"])(startPoint);endPoint[index]+=plus;return[(0,_toConsumableArray2["default"])(startPoint),endPoint]});if(!boundaryGap)splitLinePosition.shift();return _objectSpread({},axisItem,{splitLinePosition:splitLinePosition})})}function getLineConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;return[{name:"polyline",index:rLevel,visible:axisItem.axisLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getLineShape(axisItem),style:getLineStyle(axisItem)}]}function getLineShape(axisItem){var linePosition=axisItem.linePosition;return{points:linePosition}}function getLineStyle(axisItem){return axisItem.axisLine.style}function getTickConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getTickShapes(axisItem);var style=getTickStyle(axisItem);return shapes.map(function(shape){return{name:"polyline",index:rLevel,visible:axisItem.axisTick.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getTickShapes(axisItem){var tickLinePosition=axisItem.tickLinePosition;return tickLinePosition.map(function(points){return{points:points}})}function getTickStyle(axisItem){return axisItem.axisTick.style}function getLabelConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getLabelShapes(axisItem);var styles=getLabelStyle(axisItem,shapes);return shapes.map(function(shape,i){return{name:"text",index:rLevel,visible:axisItem.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:styles[i],setGraphCenter:function setGraphCenter(){return void 0}}})}function getLabelShapes(axisItem){var label=axisItem.label,tickPosition=axisItem.tickPosition,position=axisItem.position;return tickPosition.map(function(point,i){return{position:getLabelRealPosition(point,position),content:label[i].toString()}})}function getLabelRealPosition(points,position){var index=0,plus=10;if(position==="top"||position==="bottom")index=1;if(position==="top"||position==="left")plus=-10;points=(0,_util2.deepClone)(points);points[index]+=plus;return points}function getLabelStyle(axisItem,shapes){var position=axisItem.position;var style=axisItem.axisLabel.style;var align=getAxisLabelRealAlign(position);style=(0,_util.deepMerge)(align,style);var styles=shapes.map(function(_ref20){var position=_ref20.position;return _objectSpread({},style,{graphCenter:position})});return styles}function getAxisLabelRealAlign(position){if(position==="left")return{textAlign:"right",textBaseline:"middle"};if(position==="right")return{textAlign:"left",textBaseline:"middle"};if(position==="top")return{textAlign:"center",textBaseline:"bottom"};if(position==="bottom")return{textAlign:"center",textBaseline:"top"}}function getNameConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;return[{name:"text",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getNameShape(axisItem),style:getNameStyle(axisItem)}]}function getNameShape(axisItem){var name=axisItem.name,namePosition=axisItem.namePosition;return{content:name,position:namePosition}}function getNameStyle(axisItem){var nameLocation=axisItem.nameLocation,position=axisItem.position,style=axisItem.nameTextStyle;var align=getNameRealAlign(position,nameLocation);return(0,_util.deepMerge)(align,style)}function getNameRealAlign(position,location){if(position==="top"&&location==="start"||position==="bottom"&&location==="start"||position==="left"&&location==="center")return{textAlign:"right",textBaseline:"middle"};if(position==="top"&&location==="end"||position==="bottom"&&location==="end"||position==="right"&&location==="center")return{textAlign:"left",textBaseline:"middle"};if(position==="top"&&location==="center"||position==="left"&&location==="end"||position==="right"&&location==="end")return{textAlign:"center",textBaseline:"bottom"};if(position==="bottom"&&location==="center"||position==="left"&&location==="start"||position==="right"&&location==="start")return{textAlign:"center",textBaseline:"top"}}function getSplitLineConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getSplitLineShapes(axisItem);var style=getSplitLineStyle(axisItem);return shapes.map(function(shape){return{name:"polyline",index:rLevel,visible:axisItem.splitLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getSplitLineShapes(axisItem){var splitLinePosition=axisItem.splitLinePosition;return splitLinePosition.map(function(points){return{points:points}})}function getSplitLineStyle(axisItem){return axisItem.splitLine.style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],17:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.bar=bar;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _config=require("../config");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var bars=[];if(xAxis&&yAxis&&series){bars=(0,_util2.initNeedSeries)(series,_config.barConfig,"bar");bars=setBarAxis(bars,chart);bars=setBarPositionData(bars,chart);bars=calcBarsPosition(bars,chart)}(0,_updater.doUpdate)({chart:chart,series:bars.slice(-1),key:"backgroundBar",getGraphConfig:getBackgroundBarConfig});bars.reverse();(0,_updater.doUpdate)({chart:chart,series:bars,key:"bar",getGraphConfig:getBarConfig,getStartGraphConfig:getStartBarConfig,beforeUpdate:beforeUpdateBar});(0,_updater.doUpdate)({chart:chart,series:bars,key:"barLabel",getGraphConfig:getLabelConfig})}function setBarAxis(bars,chart){var axisData=chart.axisData;bars.forEach(function(bar){var xAxisIndex=bar.xAxisIndex,yAxisIndex=bar.yAxisIndex;if(typeof xAxisIndex!=="number")xAxisIndex=0;if(typeof yAxisIndex!=="number")yAxisIndex=0;var xAxis=axisData.find(function(_ref){var axis=_ref.axis,index=_ref.index;return"".concat(axis).concat(index)==="x".concat(xAxisIndex)});var yAxis=axisData.find(function(_ref2){var axis=_ref2.axis,index=_ref2.index;return"".concat(axis).concat(index)==="y".concat(yAxisIndex)});var axis=[xAxis,yAxis];var valueAxisIndex=axis.findIndex(function(_ref3){var data=_ref3.data;return data==="value"});bar.valueAxis=axis[valueAxisIndex];bar.labelAxis=axis[1-valueAxisIndex]});return bars}function setBarPositionData(bars,chart){var labelBarGroup=groupBarByLabelAxis(bars);labelBarGroup.forEach(function(group){setBarIndex(group);setBarNum(group);setBarCategoryWidth(group,chart);setBarWidthAndGap(group);setBarAllWidthAndGap(group)});return bars}function setBarIndex(bars){var stacks=getBarStack(bars);stacks=stacks.map(function(stack){return{stack:stack,index:-1}});var currentIndex=0;bars.forEach(function(bar){var stack=bar.stack;if(!stack){bar.barIndex=currentIndex;currentIndex++}else{var stackData=stacks.find(function(_ref4){var s=_ref4.stack;return s===stack});if(stackData.index===-1){stackData.index=currentIndex;currentIndex++}bar.barIndex=stackData.index}})}function groupBarByLabelAxis(bars){var labelAxis=bars.map(function(_ref5){var _ref5$labelAxis=_ref5.labelAxis,axis=_ref5$labelAxis.axis,index=_ref5$labelAxis.index;return axis+index});labelAxis=(0,_toConsumableArray2["default"])(new Set(labelAxis));return labelAxis.map(function(axisIndex){return bars.filter(function(_ref6){var _ref6$labelAxis=_ref6.labelAxis,axis=_ref6$labelAxis.axis,index=_ref6$labelAxis.index;return axis+index===axisIndex})})}function getBarStack(bars){var stacks=[];bars.forEach(function(_ref7){var stack=_ref7.stack;if(stack)stacks.push(stack)});return(0,_toConsumableArray2["default"])(new Set(stacks))}function setBarNum(bars){var barNum=(0,_toConsumableArray2["default"])(new Set(bars.map(function(_ref8){var barIndex=_ref8.barIndex;return barIndex}))).length;bars.forEach(function(bar){return bar.barNum=barNum})}function setBarCategoryWidth(bars){var lastBar=bars.slice(-1)[0];var barCategoryGap=lastBar.barCategoryGap,tickGap=lastBar.labelAxis.tickGap;var barCategoryWidth=0;if(typeof barCategoryGap==="number"){barCategoryWidth=barCategoryGap}else{barCategoryWidth=(1-parseInt(barCategoryGap)/100)*tickGap}bars.forEach(function(bar){return bar.barCategoryWidth=barCategoryWidth})}function setBarWidthAndGap(bars){var _bars$slice$=bars.slice(-1)[0],barCategoryWidth=_bars$slice$.barCategoryWidth,barWidth=_bars$slice$.barWidth,barGap=_bars$slice$.barGap,barNum=_bars$slice$.barNum;var widthAndGap=[];if(typeof barWidth==="number"||barWidth!=="auto"){widthAndGap=getBarWidthAndGapWithPercentOrNumber(barCategoryWidth,barWidth,barGap,barNum)}else if(barWidth==="auto"){widthAndGap=getBarWidthAndGapWidthAuto(barCategoryWidth,barWidth,barGap,barNum)}var _widthAndGap=widthAndGap,_widthAndGap2=(0,_slicedToArray2["default"])(_widthAndGap,2),width=_widthAndGap2[0],gap=_widthAndGap2[1];bars.forEach(function(bar){bar.barWidth=width;bar.barGap=gap})}function getBarWidthAndGapWithPercentOrNumber(barCategoryWidth,barWidth,barGap){var width=0,gap=0;if(typeof barWidth==="number"){width=barWidth}else{width=parseInt(barWidth)/100*barCategoryWidth}if(typeof barGap==="number"){gap=barGap}else{gap=parseInt(barGap)/100*width}return[width,gap]}function getBarWidthAndGapWidthAuto(barCategoryWidth,barWidth,barGap,barNum){var width=0,gap=0;var barItemWidth=barCategoryWidth/barNum;if(typeof barGap==="number"){gap=barGap;width=barItemWidth-gap}else{var percent=10+parseInt(barGap)/10;if(percent===0){width=barItemWidth*2;gap=-width}else{width=barItemWidth/percent*10;gap=barItemWidth-width}}return[width,gap]}function setBarAllWidthAndGap(bars){var _bars$slice$2=bars.slice(-1)[0],barGap=_bars$slice$2.barGap,barWidth=_bars$slice$2.barWidth,barNum=_bars$slice$2.barNum;var barAllWidthAndGap=(barGap+barWidth)*barNum-barGap;bars.forEach(function(bar){return bar.barAllWidthAndGap=barAllWidthAndGap})}function calcBarsPosition(bars,chart){bars=calcBarValueAxisCoordinate(bars);bars=calcBarLabelAxisCoordinate(bars);bars=eliminateNullBarLabelAxis(bars);bars=keepSameNumBetweenBarAndData(bars);return bars}function calcBarLabelAxisCoordinate(bars){return bars.map(function(bar){var labelAxis=bar.labelAxis,barAllWidthAndGap=bar.barAllWidthAndGap,barGap=bar.barGap,barWidth=bar.barWidth,barIndex=bar.barIndex;var tickGap=labelAxis.tickGap,tickPosition=labelAxis.tickPosition,axis=labelAxis.axis;var coordinateIndex=axis==="x"?0:1;var barLabelAxisPos=tickPosition.map(function(tick,i){var barCategoryStartPos=tickPosition[i][coordinateIndex]-tickGap/2;var barItemsStartPos=barCategoryStartPos+(tickGap-barAllWidthAndGap)/2;return barItemsStartPos+(barIndex+.5)*barWidth+barIndex*barGap});return _objectSpread({},bar,{barLabelAxisPos:barLabelAxisPos})})}function calcBarValueAxisCoordinate(bars){return bars.map(function(bar){var data=(0,_util2.mergeSameStackData)(bar,bars);data=eliminateNonNumberData(bar,data);var _bar$valueAxis=bar.valueAxis,axis=_bar$valueAxis.axis,minValue=_bar$valueAxis.minValue,maxValue=_bar$valueAxis.maxValue,linePosition=_bar$valueAxis.linePosition;var startPos=getValuePos(minValue,maxValue,minValue<0?0:minValue,linePosition,axis);var endPos=data.map(function(v){return getValuePos(minValue,maxValue,v,linePosition,axis)});var barValueAxisPos=endPos.map(function(p){return[startPos,p]});return _objectSpread({},bar,{barValueAxisPos:barValueAxisPos})})}function eliminateNonNumberData(barItem,barData){var data=barItem.data;return barData.map(function(v,i){return typeof data[i]==="number"?v:null}).filter(function(d){return d!==null})}function eliminateNullBarLabelAxis(bars){return bars.map(function(bar){var barLabelAxisPos=bar.barLabelAxisPos,data=bar.data;data.forEach(function(d,i){if(typeof d==="number")return;barLabelAxisPos[i]=null});return _objectSpread({},bar,{barLabelAxisPos:barLabelAxisPos.filter(function(p){return p!==null})})})}function keepSameNumBetweenBarAndData(bars){bars.forEach(function(bar){var data=bar.data,barLabelAxisPos=bar.barLabelAxisPos,barValueAxisPos=bar.barValueAxisPos;var dataNum=data.filter(function(d){return typeof d==="number"}).length;var axisPosNum=barLabelAxisPos.length;if(axisPosNum>dataNum){barLabelAxisPos.splice(dataNum);barValueAxisPos.splice(dataNum)}});return bars}function getValuePos(min,max,value,linePosition,axis){if(typeof value!=="number")return null;var valueMinus=max-min;var coordinateIndex=axis==="x"?0:1;var posMinus=linePosition[1][coordinateIndex]-linePosition[0][coordinateIndex];var percent=(value-min)/valueMinus;if(valueMinus===0)percent=0;var pos=percent*posMinus;return pos+linePosition[0][coordinateIndex]}function getBackgroundBarConfig(barItem){var animationCurve=barItem.animationCurve,animationFrame=barItem.animationFrame,rLevel=barItem.rLevel;var shapes=getBackgroundBarShapes(barItem);var style=getBackgroundBarStyle(barItem);return shapes.map(function(shape){return{name:"rect",index:rLevel,visible:barItem.backgroundBar.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getBackgroundBarShapes(barItem){var labelAxis=barItem.labelAxis,valueAxis=barItem.valueAxis;var tickPosition=labelAxis.tickPosition;var axis=valueAxis.axis,linePosition=valueAxis.linePosition;var width=getBackgroundBarWidth(barItem);var haltWidth=width/2;var posIndex=axis==="x"?0:1;var centerPos=tickPosition.map(function(p){return p[1-posIndex]});var _ref9=[linePosition[0][posIndex],linePosition[1][posIndex]],start=_ref9[0],end=_ref9[1];return centerPos.map(function(center){if(axis==="x"){return{x:start,y:center-haltWidth,w:end-start,h:width}}else{return{x:center-haltWidth,y:end,w:width,h:start-end}}})}function getBackgroundBarWidth(barItem){var barAllWidthAndGap=barItem.barAllWidthAndGap,barCategoryWidth=barItem.barCategoryWidth,backgroundBar=barItem.backgroundBar;var width=backgroundBar.width;if(typeof width==="number")return width;if(width==="auto")return barAllWidthAndGap;return parseInt(width)/100*barCategoryWidth}function getBackgroundBarStyle(barItem){return barItem.backgroundBar.style}function getBarConfig(barItem){var barLabelAxisPos=barItem.barLabelAxisPos,animationCurve=barItem.animationCurve,animationFrame=barItem.animationFrame,rLevel=barItem.rLevel;var name=getBarName(barItem);return barLabelAxisPos.map(function(foo,i){return{name:name,index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getBarShape(barItem,i),style:getBarStyle(barItem,i)}})}function getBarName(barItem){var shapeType=barItem.shapeType;if(shapeType==="leftEchelon"||shapeType==="rightEchelon")return"polyline";return"rect"}function getBarShape(barItem,i){var shapeType=barItem.shapeType;if(shapeType==="leftEchelon"){return getLeftEchelonShape(barItem,i)}else if(shapeType==="rightEchelon"){return getRightEchelonShape(barItem,i)}else{return getNormalBarShape(barItem,i)}}function getLeftEchelonShape(barItem,i){var barValueAxisPos=barItem.barValueAxisPos,barLabelAxisPos=barItem.barLabelAxisPos,barWidth=barItem.barWidth,echelonOffset=barItem.echelonOffset;var _barValueAxisPos$i=(0,_slicedToArray2["default"])(barValueAxisPos[i],2),start=_barValueAxisPos$i[0],end=_barValueAxisPos$i[1];var labelAxisPos=barLabelAxisPos[i];var halfWidth=barWidth/2;var valueAxis=barItem.valueAxis.axis;var points=[];if(valueAxis==="x"){points[0]=[end,labelAxisPos-halfWidth];points[1]=[end,labelAxisPos+halfWidth];points[2]=[start,labelAxisPos+halfWidth];points[3]=[start+echelonOffset,labelAxisPos-halfWidth];if(end-start1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var gauges=(0,_util2.initNeedSeries)(series,_gauge.gaugeConfig,"gauge");gauges=calcGaugesCenter(gauges,chart);gauges=calcGaugesRadius(gauges,chart);gauges=calcGaugesDataRadiusAndLineWidth(gauges,chart);gauges=calcGaugesDataAngles(gauges,chart);gauges=calcGaugesDataGradient(gauges,chart);gauges=calcGaugesAxisTickPosition(gauges,chart);gauges=calcGaugesLabelPositionAndAlign(gauges,chart);gauges=calcGaugesLabelData(gauges,chart);gauges=calcGaugesDetailsPosition(gauges,chart);gauges=calcGaugesDetailsContent(gauges,chart);(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeAxisTick",getGraphConfig:getAxisTickConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeAxisLabel",getGraphConfig:getAxisLabelConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeBackgroundArc",getGraphConfig:getBackgroundArcConfig,getStartGraphConfig:getStartBackgroundArcConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeArc",getGraphConfig:getArcConfig,getStartGraphConfig:getStartArcConfig,beforeChange:beforeChangeArc});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugePointer",getGraphConfig:getPointerConfig,getStartGraphConfig:getStartPointerConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeDetails",getGraphConfig:getDetailsConfig})}function calcGaugesCenter(gauges,chart){var area=chart.render.area;gauges.forEach(function(gaugeItem){var center=gaugeItem.center;center=center.map(function(pos,i){if(typeof pos==="number")return pos;return parseInt(pos)/100*area[i]});gaugeItem.center=center});return gauges}function calcGaugesRadius(gauges,chart){var area=chart.render.area;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;gauges.forEach(function(gaugeItem){var radius=gaugeItem.radius;if(typeof radius!=="number"){radius=parseInt(radius)/100*maxRadius}gaugeItem.radius=radius});return gauges}function calcGaugesDataRadiusAndLineWidth(gauges,chart){var area=chart.render.area;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;gauges.forEach(function(gaugeItem){var radius=gaugeItem.radius,data=gaugeItem.data,arcLineWidth=gaugeItem.arcLineWidth;data.forEach(function(item){var arcRadius=item.radius,lineWidth=item.lineWidth;if(!arcRadius)arcRadius=radius;if(typeof arcRadius!=="number")arcRadius=parseInt(arcRadius)/100*maxRadius;item.radius=arcRadius;if(!lineWidth)lineWidth=arcLineWidth;item.lineWidth=lineWidth})});return gauges}function calcGaugesDataAngles(gauges,chart){gauges.forEach(function(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,data=gaugeItem.data,min=gaugeItem.min,max=gaugeItem.max;var angleMinus=endAngle-startAngle;var valueMinus=max-min;data.forEach(function(item){var value=item.value;var itemAngle=Math.abs((value-min)/valueMinus*angleMinus);item.startAngle=startAngle;item.endAngle=startAngle+itemAngle})});return gauges}function calcGaugesDataGradient(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data;data.forEach(function(item){var color=item.color,gradient=item.gradient;if(!gradient||!gradient.length)gradient=color;if(!(gradient instanceof Array))gradient=[gradient];item.gradient=gradient})});return gauges}function calcGaugesAxisTickPosition(gauges,chart){gauges.forEach(function(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,splitNum=gaugeItem.splitNum,center=gaugeItem.center,radius=gaugeItem.radius,arcLineWidth=gaugeItem.arcLineWidth,axisTick=gaugeItem.axisTick;var tickLength=axisTick.tickLength,lineWidth=axisTick.style.lineWidth;var angles=endAngle-startAngle;var outerRadius=radius-arcLineWidth/2;var innerRadius=outerRadius-tickLength;var angleGap=angles/(splitNum-1);var arcLength=2*Math.PI*radius*angles/(Math.PI*2);var offset=Math.ceil(lineWidth/2)/arcLength*angles;gaugeItem.tickAngles=[];gaugeItem.tickInnerRadius=[];gaugeItem.tickPosition=new Array(splitNum).fill(0).map(function(foo,i){var angle=startAngle+angleGap*i;if(i===0)angle+=offset;if(i===splitNum-1)angle-=offset;gaugeItem.tickAngles[i]=angle;gaugeItem.tickInnerRadius[i]=innerRadius;return[_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([outerRadius,angle])),_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([innerRadius,angle]))]})});return gauges}function calcGaugesLabelPositionAndAlign(gauges,chart){gauges.forEach(function(gaugeItem){var center=gaugeItem.center,tickInnerRadius=gaugeItem.tickInnerRadius,tickAngles=gaugeItem.tickAngles,labelGap=gaugeItem.axisLabel.labelGap;var position=tickAngles.map(function(angle,i){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([tickInnerRadius[i]-labelGap,tickAngles[i]]))});var align=position.map(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),x=_ref2[0],y=_ref2[1];return{textAlign:x>center[0]?"right":"left",textBaseline:y>center[1]?"bottom":"top"}});gaugeItem.labelPosition=position;gaugeItem.labelAlign=align});return gauges}function calcGaugesLabelData(gauges,chart){gauges.forEach(function(gaugeItem){var axisLabel=gaugeItem.axisLabel,min=gaugeItem.min,max=gaugeItem.max,splitNum=gaugeItem.splitNum;var data=axisLabel.data,formatter=axisLabel.formatter;var valueGap=(max-min)/(splitNum-1);var value=new Array(splitNum).fill(0).map(function(foo,i){return parseInt(min+valueGap*i)});var formatterType=(0,_typeof2["default"])(formatter);data=(0,_util2.deepMerge)(value,data).map(function(v,i){var label=v;if(formatterType==="string"){label=formatter.replace("{value}",v)}if(formatterType==="function"){label=formatter({value:v,index:i})}return label});axisLabel.data=data});return gauges}function calcGaugesDetailsPosition(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data,details=gaugeItem.details,center=gaugeItem.center;var position=details.position,offset=details.offset;var detailsPosition=data.map(function(_ref3){var startAngle=_ref3.startAngle,endAngle=_ref3.endAngle,radius=_ref3.radius;var point=null;if(position==="center"){point=center}else if(position==="start"){point=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,startAngle]))}else if(position==="end"){point=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,endAngle]))}return getOffsetedPoint(point,offset)});gaugeItem.detailsPosition=detailsPosition});return gauges}function calcGaugesDetailsContent(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data,details=gaugeItem.details;var formatter=details.formatter;var formatterType=(0,_typeof2["default"])(formatter);var contents=data.map(function(dataItem){var content=dataItem.value;if(formatterType==="string"){content=formatter.replace("{value}","{nt}");content=content.replace("{name}",dataItem.name)}if(formatterType==="function")content=formatter(dataItem);return content.toString()});gaugeItem.detailsContent=contents});return gauges}function getOffsetedPoint(_ref4,_ref5){var _ref6=(0,_slicedToArray2["default"])(_ref4,2),x=_ref6[0],y=_ref6[1];var _ref7=(0,_slicedToArray2["default"])(_ref5,2),ox=_ref7[0],oy=_ref7[1];return[x+ox,y+oy]}function getAxisTickConfig(gaugeItem){var tickPosition=gaugeItem.tickPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return tickPosition.map(function(foo,i){return{name:"polyline",index:rLevel,visible:gaugeItem.axisTick.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisTickShape(gaugeItem,i),style:getAxisTickStyle(gaugeItem,i)}})}function getAxisTickShape(gaugeItem,i){var tickPosition=gaugeItem.tickPosition;return{points:tickPosition[i]}}function getAxisTickStyle(gaugeItem,i){var style=gaugeItem.axisTick.style;return style}function getAxisLabelConfig(gaugeItem){var labelPosition=gaugeItem.labelPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return labelPosition.map(function(foo,i){return{name:"text",index:rLevel,visible:gaugeItem.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLabelShape(gaugeItem,i),style:getAxisLabelStyle(gaugeItem,i)}})}function getAxisLabelShape(gaugeItem,i){var labelPosition=gaugeItem.labelPosition,data=gaugeItem.axisLabel.data;return{content:data[i].toString(),position:labelPosition[i]}}function getAxisLabelStyle(gaugeItem,i){var labelAlign=gaugeItem.labelAlign,axisLabel=gaugeItem.axisLabel;var style=axisLabel.style;return(0,_util2.deepMerge)(_objectSpread({},labelAlign[i]),style)}function getBackgroundArcConfig(gaugeItem){var animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return[{name:"arc",index:rLevel,visible:gaugeItem.backgroundArc.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getGaugeBackgroundArcShape(gaugeItem),style:getGaugeBackgroundArcStyle(gaugeItem)}]}function getGaugeBackgroundArcShape(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,center=gaugeItem.center,radius=gaugeItem.radius;return{rx:center[0],ry:center[1],r:radius,startAngle:startAngle,endAngle:endAngle}}function getGaugeBackgroundArcStyle(gaugeItem){var backgroundArc=gaugeItem.backgroundArc,arcLineWidth=gaugeItem.arcLineWidth;var style=backgroundArc.style;return(0,_util2.deepMerge)({lineWidth:arcLineWidth},style)}function getStartBackgroundArcConfig(gaugeItem){var config=getBackgroundArcConfig(gaugeItem)[0];var shape=_objectSpread({},config.shape);shape.endAngle=config.shape.startAngle;config.shape=shape;return[config]}function getArcConfig(gaugeItem){var data=gaugeItem.data,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return data.map(function(foo,i){return{name:"agArc",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getGaugeArcShape(gaugeItem,i),style:getGaugeArcStyle(gaugeItem,i)}})}function getGaugeArcShape(gaugeItem,i){var data=gaugeItem.data,center=gaugeItem.center,gradientEndAngle=gaugeItem.endAngle;var _data$i=data[i],radius=_data$i.radius,startAngle=_data$i.startAngle,endAngle=_data$i.endAngle,localGradient=_data$i.localGradient;if(localGradient)gradientEndAngle=endAngle;return{rx:center[0],ry:center[1],r:radius,startAngle:startAngle,endAngle:endAngle,gradientEndAngle:gradientEndAngle}}function getGaugeArcStyle(gaugeItem,i){var data=gaugeItem.data,dataItemStyle=gaugeItem.dataItemStyle;var _data$i2=data[i],lineWidth=_data$i2.lineWidth,gradient=_data$i2.gradient;gradient=gradient.map(function(c){return(0,_color.getRgbaValue)(c)});return(0,_util2.deepMerge)({lineWidth:lineWidth,gradient:gradient},dataItemStyle)}function getStartArcConfig(gaugeItem){var configs=getArcConfig(gaugeItem);configs.map(function(config){var shape=_objectSpread({},config.shape);shape.endAngle=config.shape.startAngle;config.shape=shape});return configs}function beforeChangeArc(graph,config){var graphGradient=graph.style.gradient;var cacheNum=graphGradient.length;var needNum=config.style.gradient.length;if(cacheNum>needNum){graphGradient.splice(needNum)}else{var last=graphGradient.slice(-1)[0];graphGradient.push.apply(graphGradient,(0,_toConsumableArray2["default"])(new Array(needNum-cacheNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(last)})))}}function getPointerConfig(gaugeItem){var animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,center=gaugeItem.center,rLevel=gaugeItem.rLevel;return[{name:"polyline",index:rLevel,visible:gaugeItem.pointer.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getPointerShape(gaugeItem),style:getPointerStyle(gaugeItem),setGraphCenter:function setGraphCenter(foo,graph){graph.style.graphCenter=center}}]}function getPointerShape(gaugeItem){var center=gaugeItem.center;return{points:getPointerPoints(center),close:true}}function getPointerStyle(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,min=gaugeItem.min,max=gaugeItem.max,data=gaugeItem.data,pointer=gaugeItem.pointer,center=gaugeItem.center;var valueIndex=pointer.valueIndex,style=pointer.style;var value=data[valueIndex]?data[valueIndex].value:0;var angle=(value-min)/(max-min)*(endAngle-startAngle)+startAngle+Math.PI/2;return(0,_util2.deepMerge)({rotate:(0,_util2.radianToAngle)(angle),scale:[1,1],graphCenter:center},style)}function getPointerPoints(_ref8){var _ref9=(0,_slicedToArray2["default"])(_ref8,2),x=_ref9[0],y=_ref9[1];var point1=[x,y-40];var point2=[x+5,y];var point3=[x,y+10];var point4=[x-5,y];return[point1,point2,point3,point4]}function getStartPointerConfig(gaugeItem){var startAngle=gaugeItem.startAngle;var config=getPointerConfig(gaugeItem)[0];config.style.rotate=(0,_util2.radianToAngle)(startAngle+Math.PI/2);return[config]}function getDetailsConfig(gaugeItem){var detailsPosition=gaugeItem.detailsPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;var visible=gaugeItem.details.show;return detailsPosition.map(function(foo,i){return{name:"numberText",index:rLevel,visible:visible,animationCurve:animationCurve,animationFrame:animationFrame,shape:getDetailsShape(gaugeItem,i),style:getDetailsStyle(gaugeItem,i)}})}function getDetailsShape(gaugeItem,i){var detailsPosition=gaugeItem.detailsPosition,detailsContent=gaugeItem.detailsContent,data=gaugeItem.data,details=gaugeItem.details;var position=detailsPosition[i];var content=detailsContent[i];var dataValue=data[i].value;var toFixed=details.valueToFixed;return{number:[dataValue],content:content,position:position,toFixed:toFixed}}function getDetailsStyle(gaugeItem,i){var details=gaugeItem.details,data=gaugeItem.data;var style=details.style;var color=data[i].color;return(0,_util2.deepMerge)({fill:color},style)}},{"../class/updater.class":3,"../config/gauge":7,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],19:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.grid=grid;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var grid=option.grid;grid=(0,_util2.deepMerge)((0,_util.deepClone)(_config.gridConfig,true),grid||{});(0,_updater.doUpdate)({chart:chart,series:[grid],key:"grid",getGraphConfig:getGridConfig})}function getGridConfig(gridItem,updater){var animationCurve=gridItem.animationCurve,animationFrame=gridItem.animationFrame,rLevel=gridItem.rLevel;var shape=getGridShape(gridItem,updater);var style=getGridStyle(gridItem);updater.chart.gridArea=_objectSpread({},shape);return[{name:"rect",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}]}function getGridShape(gridItem,updater){var _updater$chart$render=(0,_slicedToArray2["default"])(updater.chart.render.area,2),w=_updater$chart$render[0],h=_updater$chart$render[1];var left=getNumberValue(gridItem.left,w);var right=getNumberValue(gridItem.right,w);var top=getNumberValue(gridItem.top,h);var bottom=getNumberValue(gridItem.bottom,h);var width=w-left-right;var height=h-top-bottom;return{x:left,y:top,w:width,h:height}}function getNumberValue(val,all){if(typeof val==="number")return val;if(typeof val!=="string")return 0;return all*parseInt(val)/100}function getGridStyle(gridItem){var style=gridItem.style;return style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@jiaminghi/c-render/lib/plugin/util":54}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"mergeColor",{enumerable:true,get:function get(){return _mergeColor.mergeColor}});Object.defineProperty(exports,"title",{enumerable:true,get:function get(){return _title.title}});Object.defineProperty(exports,"grid",{enumerable:true,get:function get(){return _grid.grid}});Object.defineProperty(exports,"axis",{enumerable:true,get:function get(){return _axis.axis}});Object.defineProperty(exports,"line",{enumerable:true,get:function get(){return _line.line}});Object.defineProperty(exports,"bar",{enumerable:true,get:function get(){return _bar.bar}});Object.defineProperty(exports,"pie",{enumerable:true,get:function get(){return _pie.pie}});Object.defineProperty(exports,"radarAxis",{enumerable:true,get:function get(){return _radarAxis.radarAxis}});Object.defineProperty(exports,"radar",{enumerable:true,get:function get(){return _radar.radar}});Object.defineProperty(exports,"gauge",{enumerable:true,get:function get(){return _gauge.gauge}});Object.defineProperty(exports,"legend",{enumerable:true,get:function get(){return _legend.legend}});var _mergeColor=require("./mergeColor");var _title=require("./title");var _grid=require("./grid");var _axis=require("./axis");var _line=require("./line");var _bar=require("./bar");var _pie=require("./pie");var _radarAxis=require("./radarAxis");var _radar=require("./radar");var _gauge=require("./gauge");var _legend=require("./legend")},{"./axis":16,"./bar":17,"./gauge":18,"./grid":19,"./legend":21,"./line":22,"./mergeColor":23,"./pie":24,"./radar":25,"./radarAxis":26,"./title":27}],21:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.legend=legend;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function legend(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var legend=option.legend;if(legend){legend=(0,_util2.deepMerge)((0,_util.deepClone)(_config.legendConfig,true),legend);legend=initLegendData(legend);legend=filterInvalidData(legend,option,chart);legend=calcLegendTextWidth(legend,chart);legend=calcLegendPosition(legend,chart);legend=[legend]}else{legend=[]}(0,_updater.doUpdate)({chart:chart,series:legend,key:"legendIcon",getGraphConfig:getIconConfig});(0,_updater.doUpdate)({chart:chart,series:legend,key:"legendText",getGraphConfig:getTextConfig})}function initLegendData(legend){var data=legend.data;legend.data=data.map(function(item){var itemType=(0,_typeof2["default"])(item);if(itemType==="string"){return{name:item}}else if(itemType==="object"){return item}return{name:""}});return legend}function filterInvalidData(legend,option,chart){var series=option.series;var legendStatus=chart.legendStatus;var data=legend.data.filter(function(item){var name=item.name;var result=series.find(function(_ref){var sn=_ref.name;return name===sn});if(!result)return false;if(!item.color)item.color=result.color;if(!item.icon)item.icon=result.type;return item});if(!legendStatus||legendStatus.length!==legend.data.length)legendStatus=new Array(legend.data.length).fill(true);data.forEach(function(item,i){return item.status=legendStatus[i]});legend.data=data;chart.legendStatus=legendStatus;return legend}function calcLegendTextWidth(legend,chart){var ctx=chart.render.ctx;var data=legend.data,textStyle=legend.textStyle,textUnselectedStyle=legend.textUnselectedStyle;data.forEach(function(item){var status=item.status,name=item.name;item.textWidth=getTextWidth(ctx,name,status?textStyle:textUnselectedStyle)});return legend}function getTextWidth(ctx,text,style){ctx.font=getFontConfig(style);return ctx.measureText(text).width}function getFontConfig(style){var fontFamily=style.fontFamily,fontSize=style.fontSize;return"".concat(fontSize,"px ").concat(fontFamily)}function calcLegendPosition(legend,chart){var orient=legend.orient;if(orient==="vertical"){calcVerticalPosition(legend,chart)}else{calcHorizontalPosition(legend,chart)}return legend}function calcHorizontalPosition(legend,chart){var iconHeight=legend.iconHeight,itemGap=legend.itemGap;var lines=calcDefaultHorizontalPosition(legend,chart);var xOffsets=lines.map(function(line){return getHorizontalXOffset(line,legend,chart)});var yOffset=getHorizontalYOffset(legend,chart);var align={textAlign:"left",textBaseline:"middle"};lines.forEach(function(line,i){return line.forEach(function(item){var iconPosition=item.iconPosition,textPosition=item.textPosition;var xOffset=xOffsets[i];var realYOffset=yOffset+i*(itemGap+iconHeight);item.iconPosition=mergeOffset(iconPosition,[xOffset,realYOffset]);item.textPosition=mergeOffset(textPosition,[xOffset,realYOffset]);item.align=align})})}function calcDefaultHorizontalPosition(legend,chart){var data=legend.data,iconWidth=legend.iconWidth;var w=chart.render.area[0];var startIndex=0;var lines=[[]];data.forEach(function(item,i){var beforeWidth=getBeforeWidth(startIndex,i,legend);var endXPos=beforeWidth+iconWidth+5+item.textWidth;if(endXPos>=w){startIndex=i;beforeWidth=getBeforeWidth(startIndex,i,legend);lines.push([])}item.iconPosition=[beforeWidth,0];item.textPosition=[beforeWidth+iconWidth+5,0];lines.slice(-1)[0].push(item)});return lines}function getBeforeWidth(startIndex,currentIndex,legend){var data=legend.data,iconWidth=legend.iconWidth,itemGap=legend.itemGap;var beforeItem=data.slice(startIndex,currentIndex);return(0,_util2.mulAdd)(beforeItem.map(function(_ref2){var textWidth=_ref2.textWidth;return textWidth}))+(currentIndex-startIndex)*(itemGap+5+iconWidth)}function getHorizontalXOffset(data,legend,chart){var left=legend.left,right=legend.right,iconWidth=legend.iconWidth,itemGap=legend.itemGap;var w=chart.render.area[0];var dataNum=data.length;var allWidth=(0,_util2.mulAdd)(data.map(function(_ref3){var textWidth=_ref3.textWidth;return textWidth}))+dataNum*(5+iconWidth)+(dataNum-1)*itemGap;var horizontal=[left,right].findIndex(function(pos){return pos!=="auto"});if(horizontal===-1){return(w-allWidth)/2}else if(horizontal===0){if(typeof left==="number")return left;return parseInt(left)/100*w}else{if(typeof right!=="number")right=parseInt(right)/100*w;return w-(allWidth+right)}}function getHorizontalYOffset(legend,chart){var top=legend.top,bottom=legend.bottom,iconHeight=legend.iconHeight;var h=chart.render.area[1];var vertical=[top,bottom].findIndex(function(pos){return pos!=="auto"});var halfIconHeight=iconHeight/2;if(vertical===-1){var _chart$gridArea=chart.gridArea,y=_chart$gridArea.y,height=_chart$gridArea.h;return y+height+45-halfIconHeight}else if(vertical===0){if(typeof top==="number")return top-halfIconHeight;return parseInt(top)/100*h-halfIconHeight}else{if(typeof bottom!=="number")bottom=parseInt(bottom)/100*h;return h-bottom-halfIconHeight}}function mergeOffset(_ref4,_ref5){var _ref6=(0,_slicedToArray2["default"])(_ref4,2),x=_ref6[0],y=_ref6[1];var _ref7=(0,_slicedToArray2["default"])(_ref5,2),ox=_ref7[0],oy=_ref7[1];return[x+ox,y+oy]}function calcVerticalPosition(legend,chart){var _getVerticalXOffset=getVerticalXOffset(legend,chart),_getVerticalXOffset2=(0,_slicedToArray2["default"])(_getVerticalXOffset,2),isRight=_getVerticalXOffset2[0],xOffset=_getVerticalXOffset2[1];var yOffset=getVerticalYOffset(legend,chart);calcDefaultVerticalPosition(legend,isRight);var align={textAlign:"left",textBaseline:"middle"};legend.data.forEach(function(item){var textPosition=item.textPosition,iconPosition=item.iconPosition;item.textPosition=mergeOffset(textPosition,[xOffset,yOffset]);item.iconPosition=mergeOffset(iconPosition,[xOffset,yOffset]);item.align=align})}function getVerticalXOffset(legend,chart){var left=legend.left,right=legend.right;var w=chart.render.area[0];var horizontal=[left,right].findIndex(function(pos){return pos!=="auto"});if(horizontal===-1){return[true,w-10]}else{var offset=[left,right][horizontal];if(typeof offset!=="number")offset=parseInt(offset)/100*w;return[Boolean(horizontal),offset]}}function getVerticalYOffset(legend,chart){var iconHeight=legend.iconHeight,itemGap=legend.itemGap,data=legend.data,top=legend.top,bottom=legend.bottom;var h=chart.render.area[1];var dataNum=data.length;var allHeight=dataNum*iconHeight+(dataNum-1)*itemGap;var vertical=[top,bottom].findIndex(function(pos){return pos!=="auto"});if(vertical===-1){return(h-allHeight)/2}else{var offset=[top,bottom][vertical];if(typeof offset!=="number")offset=parseInt(offset)/100*h;if(vertical===1)offset=h-offset-allHeight;return offset}}function calcDefaultVerticalPosition(legend,isRight){var data=legend.data,iconWidth=legend.iconWidth,iconHeight=legend.iconHeight,itemGap=legend.itemGap;var halfIconHeight=iconHeight/2;data.forEach(function(item,i){var textWidth=item.textWidth;var yPos=(iconHeight+itemGap)*i+halfIconHeight;var iconXPos=isRight?0-iconWidth:0;var textXpos=isRight?iconXPos-5-textWidth:iconWidth+5;item.iconPosition=[iconXPos,yPos];item.textPosition=[textXpos,yPos]})}function getIconConfig(legendItem,updater){var data=legendItem.data,selectAble=legendItem.selectAble,animationCurve=legendItem.animationCurve,animationFrame=legendItem.animationFrame,rLevel=legendItem.rLevel;return data.map(function(item,i){return(0,_defineProperty2["default"])({name:item.icon==="line"?"lineIcon":"rect",index:rLevel,visible:legendItem.show,hover:selectAble,click:selectAble,animationCurve:animationCurve,animationFrame:animationFrame,shape:getIconShape(legendItem,i),style:getIconStyle(legendItem,i)},"click",createClickCallBack(legendItem,i,updater))})}function getIconShape(legendItem,i){var data=legendItem.data,iconWidth=legendItem.iconWidth,iconHeight=legendItem.iconHeight;var _data$i$iconPosition=(0,_slicedToArray2["default"])(data[i].iconPosition,2),x=_data$i$iconPosition[0],y=_data$i$iconPosition[1];var halfIconHeight=iconHeight/2;return{x:x,y:y-halfIconHeight,w:iconWidth,h:iconHeight}}function getIconStyle(legendItem,i){var data=legendItem.data,iconStyle=legendItem.iconStyle,iconUnselectedStyle=legendItem.iconUnselectedStyle;var _data$i=data[i],status=_data$i.status,color=_data$i.color;var style=status?iconStyle:iconUnselectedStyle;return(0,_util2.deepMerge)({fill:color},style)}function getTextConfig(legendItem,updater){var data=legendItem.data,selectAble=legendItem.selectAble,animationCurve=legendItem.animationCurve,animationFrame=legendItem.animationFrame,rLevel=legendItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:legendItem.show,hover:selectAble,animationCurve:animationCurve,animationFrame:animationFrame,hoverRect:getTextHoverRect(legendItem,i),shape:getTextShape(legendItem,i),style:getTextStyle(legendItem,i),click:createClickCallBack(legendItem,i,updater)}})}function getTextShape(legendItem,i){var _legendItem$data$i=legendItem.data[i],textPosition=_legendItem$data$i.textPosition,name=_legendItem$data$i.name;return{content:name,position:textPosition}}function getTextStyle(legendItem,i){var textStyle=legendItem.textStyle,textUnselectedStyle=legendItem.textUnselectedStyle;var _legendItem$data$i2=legendItem.data[i],status=_legendItem$data$i2.status,align=_legendItem$data$i2.align;var style=status?textStyle:textUnselectedStyle;return(0,_util2.deepMerge)((0,_util.deepClone)(style,true),align)}function getTextHoverRect(legendItem,i){var textStyle=legendItem.textStyle,textUnselectedStyle=legendItem.textUnselectedStyle;var _legendItem$data$i3=legendItem.data[i],status=_legendItem$data$i3.status,_legendItem$data$i3$t=(0,_slicedToArray2["default"])(_legendItem$data$i3.textPosition,2),x=_legendItem$data$i3$t[0],y=_legendItem$data$i3$t[1],textWidth=_legendItem$data$i3.textWidth;var style=status?textStyle:textUnselectedStyle;var fontSize=style.fontSize;return[x,y-fontSize/2,textWidth,fontSize]}function createClickCallBack(legendItem,index,updater){var name=legendItem.data[index].name;return function(){var _updater$chart=updater.chart,legendStatus=_updater$chart.legendStatus,option=_updater$chart.option;var status=!legendStatus[index];var change=option.series.find(function(_ref9){var sn=_ref9.name;return sn===name});change.show=status;legendStatus[index]=status;updater.chart.setOption(option)}}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],22:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.line=line;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _updater=require("../class/updater.class");var _config=require("../config");var _bezierCurve=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var lines=[];if(xAxis&&yAxis&&series){lines=(0,_util.initNeedSeries)(series,_config.lineConfig,"line");lines=calcLinesPosition(lines,chart)}(0,_updater.doUpdate)({chart:chart,series:lines,key:"lineArea",getGraphConfig:getLineAreaConfig,getStartGraphConfig:getStartLineAreaConfig,beforeUpdate:beforeUpdateLineAndArea,beforeChange:beforeChangeLineAndArea});(0,_updater.doUpdate)({chart:chart,series:lines,key:"line",getGraphConfig:getLineConfig,getStartGraphConfig:getStartLineConfig,beforeUpdate:beforeUpdateLineAndArea,beforeChange:beforeChangeLineAndArea});(0,_updater.doUpdate)({chart:chart,series:lines,key:"linePoint",getGraphConfig:getPointConfig,getStartGraphConfig:getStartPointConfig});(0,_updater.doUpdate)({chart:chart,series:lines,key:"lineLabel",getGraphConfig:getLabelConfig})}function calcLinesPosition(lines,chart){var axisData=chart.axisData;return lines.map(function(lineItem){var lineData=(0,_util.mergeSameStackData)(lineItem,lines);lineData=mergeNonNumber(lineItem,lineData);var lineAxis=getLineAxis(lineItem,axisData);var linePosition=getLinePosition(lineData,lineAxis);var lineFillBottomPos=getLineFillBottomPos(lineAxis);return _objectSpread({},lineItem,{linePosition:linePosition.filter(function(p){return p}),lineFillBottomPos:lineFillBottomPos})})}function mergeNonNumber(lineItem,lineData){var data=lineItem.data;return lineData.map(function(v,i){return typeof data[i]==="number"?v:null})}function getLineAxis(line,axisData){var xAxisIndex=line.xAxisIndex,yAxisIndex=line.yAxisIndex;var xAxis=axisData.find(function(_ref){var axis=_ref.axis,index=_ref.index;return axis==="x"&&index===xAxisIndex});var yAxis=axisData.find(function(_ref2){var axis=_ref2.axis,index=_ref2.index;return axis==="y"&&index===yAxisIndex});return[xAxis,yAxis]}function getLinePosition(lineData,lineAxis){var valueAxisIndex=lineAxis.findIndex(function(_ref3){var data=_ref3.data;return data==="value"});var valueAxis=lineAxis[valueAxisIndex];var labelAxis=lineAxis[1-valueAxisIndex];var linePosition=valueAxis.linePosition,axis=valueAxis.axis;var tickPosition=labelAxis.tickPosition;var tickNum=tickPosition.length;var valueAxisPosIndex=axis==="x"?0:1;var valueAxisStartPos=linePosition[0][valueAxisPosIndex];var valueAxisEndPos=linePosition[1][valueAxisPosIndex];var valueAxisPosMinus=valueAxisEndPos-valueAxisStartPos;var maxValue=valueAxis.maxValue,minValue=valueAxis.minValue;var valueMinus=maxValue-minValue;var position=new Array(tickNum).fill(0).map(function(foo,i){var v=lineData[i];if(typeof v!=="number")return null;var valuePercent=(v-minValue)/valueMinus;if(valueMinus===0)valuePercent=0;return valuePercent*valueAxisPosMinus+valueAxisStartPos});return position.map(function(vPos,i){if(i>=tickNum||typeof vPos!=="number")return null;var pos=[vPos,tickPosition[i][1-valueAxisPosIndex]];if(valueAxisPosIndex===0)return pos;pos.reverse();return pos})}function getLineFillBottomPos(lineAxis){var valueAxis=lineAxis.find(function(_ref4){var data=_ref4.data;return data==="value"});var axis=valueAxis.axis,linePosition=valueAxis.linePosition,minValue=valueAxis.minValue,maxValue=valueAxis.maxValue;var changeIndex=axis==="x"?0:1;var changeValue=linePosition[0][changeIndex];if(minValue<0&&maxValue>0){var valueMinus=maxValue-minValue;var posMinus=Math.abs(linePosition[0][changeIndex]-linePosition[1][changeIndex]);var offset=Math.abs(minValue)/valueMinus*posMinus;if(axis==="y")offset*=-1;changeValue+=offset}return{changeIndex:changeIndex,changeValue:changeValue}}function getLineAreaConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,lineFillBottomPos=lineItem.lineFillBottomPos,rLevel=lineItem.rLevel;return[{name:getLineGraphName(lineItem),index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,visible:lineItem.lineArea.show,lineFillBottomPos:lineFillBottomPos,shape:getLineAndAreaShape(lineItem),style:getLineAreaStyle(lineItem),drawed:lineAreaDrawed}]}function getLineAndAreaShape(lineItem){var linePosition=lineItem.linePosition;return{points:linePosition}}function getLineAreaStyle(lineItem){var lineArea=lineItem.lineArea,color=lineItem.color;var gradient=lineArea.gradient,style=lineArea.style;var fillColor=[style.fill||color];var gradientColor=(0,_util.deepMerge)(fillColor,gradient);if(gradientColor.length===1)gradientColor.push(gradientColor[0]);var gradientParams=getGradientParams(lineItem);style=_objectSpread({},style,{stroke:"rgba(0, 0, 0, 0)"});return(0,_util.deepMerge)({gradientColor:gradientColor,gradientParams:gradientParams,gradientType:"linear",gradientWith:"fill"},style)}function getGradientParams(lineItem){var lineFillBottomPos=lineItem.lineFillBottomPos,linePosition=lineItem.linePosition;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;var mainPos=linePosition.map(function(p){return p[changeIndex]});var maxPos=Math.max.apply(Math,(0,_toConsumableArray2["default"])(mainPos));var minPos=Math.min.apply(Math,(0,_toConsumableArray2["default"])(mainPos));var beginPos=maxPos;if(changeIndex===1)beginPos=minPos;if(changeIndex===1){return[0,beginPos,0,changeValue]}else{return[beginPos,0,changeValue,0]}}function lineAreaDrawed(_ref5,_ref6){var lineFillBottomPos=_ref5.lineFillBottomPos,shape=_ref5.shape;var ctx=_ref6.ctx;var points=shape.points;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;var linePoint1=(0,_toConsumableArray2["default"])(points[points.length-1]);var linePoint2=(0,_toConsumableArray2["default"])(points[0]);linePoint1[changeIndex]=changeValue;linePoint2[changeIndex]=changeValue;ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(linePoint1));ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(linePoint2));ctx.closePath();ctx.fill()}function getStartLineAreaConfig(lineItem){var config=getLineAreaConfig(lineItem)[0];var style=_objectSpread({},config.style);style.opacity=0;config.style=style;return[config]}function beforeUpdateLineAndArea(graphs,lineItem,i,updater){var cache=graphs[i];if(!cache)return;var currentName=getLineGraphName(lineItem);var render=updater.chart.render;var name=cache[0].name;var delAll=currentName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeLineAndArea(graph,config){var points=config.shape.points;var graphPoints=graph.shape.points;var graphPointsNum=graphPoints.length;var pointsNum=points.length;if(pointsNum>graphPointsNum){var lastPoint=graphPoints.slice(-1)[0];var newAddPoints=new Array(pointsNum-graphPointsNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(lastPoint)});graphPoints.push.apply(graphPoints,(0,_toConsumableArray2["default"])(newAddPoints))}else if(pointsNum1&&arguments[1]!==undefined?arguments[1]:false;if(!smooth)return(0,_util.getPolylineLength)(points);var curve=polylineToBezierCurve(points);return getBezierCurveLength(curve)}function getStartLineConfig(lineItem){var lineDash=lineItem.lineStyle.lineDash;var config=getLineConfig(lineItem)[0];var realLineDash=config.style.lineDash;if(lineDash){realLineDash=[0,0]}else{realLineDash=(0,_toConsumableArray2["default"])(realLineDash).reverse()}config.style.lineDash=realLineDash;return[config]}function getPointConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,rLevel=lineItem.rLevel;var shapes=getPointShapes(lineItem);var style=getPointStyle(lineItem);return shapes.map(function(shape){return{name:"circle",index:rLevel+2,visible:lineItem.linePoint.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getPointShapes(lineItem){var linePosition=lineItem.linePosition,radius=lineItem.linePoint.radius;return linePosition.map(function(_ref7){var _ref8=(0,_slicedToArray2["default"])(_ref7,2),rx=_ref8[0],ry=_ref8[1];return{r:radius,rx:rx,ry:ry}})}function getPointStyle(lineItem){var color=lineItem.color,style=lineItem.linePoint.style;return(0,_util.deepMerge)({stroke:color},style)}function getStartPointConfig(lineItem){var configs=getPointConfig(lineItem);configs.forEach(function(config){config.shape.r=.1});return configs}function getLabelConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,rLevel=lineItem.rLevel;var shapes=getLabelShapes(lineItem);var style=getLabelStyle(lineItem);return shapes.map(function(shape,i){return{name:"text",index:rLevel+3,visible:lineItem.label.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getLabelShapes(lineItem){var contents=formatterLabel(lineItem);var position=getLabelPosition(lineItem);return contents.map(function(content,i){return{content:content,position:position[i]}})}function getLabelPosition(lineItem){var linePosition=lineItem.linePosition,lineFillBottomPos=lineItem.lineFillBottomPos,label=lineItem.label;var position=label.position,offset=label.offset;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;return linePosition.map(function(pos){if(position==="bottom"){pos=(0,_toConsumableArray2["default"])(pos);pos[changeIndex]=changeValue}if(position==="center"){var bottom=(0,_toConsumableArray2["default"])(pos);bottom[changeIndex]=changeValue;pos=getCenterLabelPoint(pos,bottom)}return getOffsetedPoint(pos,offset)})}function getOffsetedPoint(_ref9,_ref10){var _ref11=(0,_slicedToArray2["default"])(_ref9,2),x=_ref11[0],y=_ref11[1];var _ref12=(0,_slicedToArray2["default"])(_ref10,2),ox=_ref12[0],oy=_ref12[1];return[x+ox,y+oy]}function getCenterLabelPoint(_ref13,_ref14){var _ref15=(0,_slicedToArray2["default"])(_ref13,2),ax=_ref15[0],ay=_ref15[1];var _ref16=(0,_slicedToArray2["default"])(_ref14,2),bx=_ref16[0],by=_ref16[1];return[(ax+bx)/2,(ay+by)/2]}function formatterLabel(lineItem){var data=lineItem.data,formatter=lineItem.label.formatter;data=data.filter(function(d){return typeof d==="number"}).map(function(d){return d.toString()});if(!formatter)return data;var type=(0,_typeof2["default"])(formatter);if(type==="string")return data.map(function(d){return formatter.replace("{value}",d)});if(type==="function")return data.map(function(value,index){return formatter({value:value,index:index})});return data}function getLabelStyle(lineItem){var color=lineItem.color,style=lineItem.label.style;return(0,_util.deepMerge)({fill:color},style)}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/bezier-curve":47}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.mergeColor=mergeColor;var _config=require("../config");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function mergeColor(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var defaultColor=(0,_util.deepClone)(_config.colorConfig,true);var color=option.color,series=option.series;if(!series)series=[];if(!color)color=[];option.color=color=(0,_util2.deepMerge)(defaultColor,color);if(!series.length)return;var colorNum=color.length;series.forEach(function(item,i){if(item.color)return;item.color=color[i%colorNum]});var pies=series.filter(function(_ref){var type=_ref.type;return type==="pie"});pies.forEach(function(pie){return pie.data.forEach(function(di,i){return di.color=color[i%colorNum]})});var gauges=series.filter(function(_ref2){var type=_ref2.type;return type==="gauge"});gauges.forEach(function(gauge){return gauge.data.forEach(function(di,i){return di.color=color[i%colorNum]})});var barWithIndependentColor=series.filter(function(_ref3){var type=_ref3.type,independentColor=_ref3.independentColor;return type==="bar"&&independentColor});barWithIndependentColor.forEach(function(bar){if(bar.independentColors)return;bar.independentColors=color})}},{"../config":9,"../util":30,"@jiaminghi/c-render/lib/plugin/util":54}],24:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.pie=pie;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _pie=require("../config/pie");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var pies=(0,_util2.initNeedSeries)(series,_pie.pieConfig,"pie");pies=calcPiesCenter(pies,chart);pies=calcPiesRadius(pies,chart);pies=calcRosePiesRadius(pies,chart);pies=calcPiesPercent(pies);pies=calcPiesAngle(pies,chart);pies=calcPiesInsideLabelPos(pies);pies=calcPiesEdgeCenterPos(pies);pies=calcPiesOutSideLabelPos(pies);(0,_updater.doUpdate)({chart:chart,series:pies,key:"pie",getGraphConfig:getPieConfig,getStartGraphConfig:getStartPieConfig,beforeChange:beforeChangePie});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieInsideLabel",getGraphConfig:getInsideLabelConfig});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieOutsideLabelLine",getGraphConfig:getOutsideLabelLineConfig,getStartGraphConfig:getStartOutsideLabelLineConfig});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieOutsideLabel",getGraphConfig:getOutsideLabelConfig,getStartGraphConfig:getStartOutsideLabelConfig})}function calcPiesCenter(pies,chart){var area=chart.render.area;pies.forEach(function(pie){var center=pie.center;center=center.map(function(pos,i){if(typeof pos==="number")return pos;return parseInt(pos)/100*area[i]});pie.center=center});return pies}function calcPiesRadius(pies,chart){var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(chart.render.area))/2;pies.forEach(function(pie){var radius=pie.radius,data=pie.data;radius=getNumberRadius(radius,maxRadius);data.forEach(function(item){var itemRadius=item.radius;if(!itemRadius)itemRadius=radius;itemRadius=getNumberRadius(itemRadius,maxRadius);item.radius=itemRadius});pie.radius=radius});return pies}function getNumberRadius(radius,maxRadius){if(!(radius instanceof Array))radius=[0,radius];radius=radius.map(function(r){if(typeof r==="number")return r;return parseInt(r)/100*maxRadius});return radius}function calcRosePiesRadius(pies,chart){var rosePie=pies.filter(function(_ref){var roseType=_ref.roseType;return roseType});rosePie.forEach(function(pie){var radius=pie.radius,data=pie.data,roseSort=pie.roseSort;var roseIncrement=getRoseIncrement(pie);var dataCopy=(0,_toConsumableArray2["default"])(data);data=sortData(data);data.forEach(function(item,i){item.radius[1]=radius[1]-roseIncrement*i});if(roseSort){data.reverse()}else{pie.data=dataCopy}pie.roseIncrement=roseIncrement});return pies}function sortData(data){return data.sort(function(_ref2,_ref3){var a=_ref2.value;var b=_ref3.value;if(a===b)return 0;if(a>b)return-1;if(a1&&arguments[1]!==undefined?arguments[1]:true;var data=pieItem.data,center=pieItem.center;var centerXPos=center[0];return data.filter(function(_ref9){var edgeCenterPos=_ref9.edgeCenterPos;var xPos=edgeCenterPos[0];if(left)return xPos<=centerXPos;return xPos>centerXPos})}function sortPiesFromTopToBottom(dataItem){dataItem.sort(function(_ref10,_ref11){var _ref10$edgeCenterPos=(0,_slicedToArray2["default"])(_ref10.edgeCenterPos,2),t=_ref10$edgeCenterPos[0],ay=_ref10$edgeCenterPos[1];var _ref11$edgeCenterPos=(0,_slicedToArray2["default"])(_ref11.edgeCenterPos,2),tt=_ref11$edgeCenterPos[0],by=_ref11$edgeCenterPos[1];if(ay>by)return 1;if(ay2&&arguments[2]!==undefined?arguments[2]:true;var center=pieItem.center,outsideLabel=pieItem.outsideLabel;var radius=getLabelLineBendRadius(pieItem);dataItem.forEach(function(item){var edgeCenterPos=item.edgeCenterPos,startAngle=item.startAngle,endAngle=item.endAngle;var labelLineEndLength=outsideLabel.labelLineEndLength;var angle=(startAngle+endAngle)/2;var bendPoint=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,angle]));var endPoint=(0,_toConsumableArray2["default"])(bendPoint);endPoint[0]+=labelLineEndLength*(left?-1:1);item.labelLine=[edgeCenterPos,bendPoint,endPoint];item.labelLineLength=(0,_util2.getPolylineLength)(item.labelLine);item.align={textAlign:"left",textBaseline:"middle"};if(left)item.align.textAlign="right"})}function getPieConfig(pieItem){var data=pieItem.data,animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"pie",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getPieShape(pieItem,i),style:getPieStyle(pieItem,i)}})}function getStartPieConfig(pieItem){var animationDelayGap=pieItem.animationDelayGap,startAnimationCurve=pieItem.startAnimationCurve;var configs=getPieConfig(pieItem);configs.forEach(function(config,i){config.animationCurve=startAnimationCurve;config.animationDelay=i*animationDelayGap;config.shape.or=config.shape.ir});return configs}function beforeChangePie(graph){graph.animationDelay=0}function getPieShape(pieItem,i){var center=pieItem.center,data=pieItem.data;var dataItem=data[i];var radius=dataItem.radius,startAngle=dataItem.startAngle,endAngle=dataItem.endAngle;return{startAngle:startAngle,endAngle:endAngle,ir:radius[0],or:radius[1],rx:center[0],ry:center[1]}}function getPieStyle(pieItem,i){var pieStyle=pieItem.pieStyle,data=pieItem.data;var dataItem=data[i];var color=dataItem.color;return(0,_util2.deepMerge)({fill:color},pieStyle)}function getInsideLabelConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:pieItem.insideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getInsideLabelShape(pieItem,i),style:getInsideLabelStyle(pieItem,i)}})}function getInsideLabelShape(pieItem,i){var insideLabel=pieItem.insideLabel,data=pieItem.data;var formatter=insideLabel.formatter;var dataItem=data[i];var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",dataItem.name);label=label.replace("{percent}",dataItem.percent);label=label.replace("{value}",dataItem.value)}if(formatterType==="function"){label=formatter(dataItem)}return{content:label,position:dataItem.insideLabelPos}}function getInsideLabelStyle(pieItem,i){var style=pieItem.insideLabel.style;return style}function getOutsideLabelLineConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"polyline",index:rLevel,visible:pieItem.outsideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getOutsideLabelLineShape(pieItem,i),style:getOutsideLabelLineStyle(pieItem,i)}})}function getStartOutsideLabelLineConfig(pieItem){var data=pieItem.data;var configs=getOutsideLabelLineConfig(pieItem);configs.forEach(function(config,i){config.style.lineDash=[0,data[i].labelLineLength]});return configs}function getOutsideLabelLineShape(pieItem,i){var data=pieItem.data;var dataItem=data[i];return{points:dataItem.labelLine}}function getOutsideLabelLineStyle(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var labelLineStyle=outsideLabel.labelLineStyle;var color=data[i].color;return(0,_util2.deepMerge)({stroke:color,lineDash:[data[i].labelLineLength,0]},labelLineStyle)}function getOutsideLabelConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:pieItem.outsideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getOutsideLabelShape(pieItem,i),style:getOutsideLabelStyle(pieItem,i)}})}function getStartOutsideLabelConfig(pieItem){var data=pieItem.data;var configs=getOutsideLabelConfig(pieItem);configs.forEach(function(config,i){config.shape.position=data[i].labelLine[1]});return configs}function getOutsideLabelShape(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var formatter=outsideLabel.formatter;var _data$i=data[i],labelLine=_data$i.labelLine,name=_data$i.name,percent=_data$i.percent,value=_data$i.value;var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",name);label=label.replace("{percent}",percent);label=label.replace("{value}",value)}if(formatterType==="function"){label=formatter(data[i])}return{content:label,position:labelLine[2]}}function getOutsideLabelStyle(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var _data$i2=data[i],color=_data$i2.color,align=_data$i2.align;var style=outsideLabel.style;return(0,_util2.deepMerge)(_objectSpread({fill:color},align),style)}},{"../class/updater.class":3,"../config/pie":12,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],25:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.radar=radar;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _index=require("../config/index");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var radars=(0,_util2.initNeedSeries)(series,_index.radarConfig,"radar");radars=calcRadarPosition(radars,chart);radars=calcRadarLabelPosition(radars,chart);radars=calcRadarLabelAlign(radars,chart);(0,_updater.doUpdate)({chart:chart,series:radars,key:"radar",getGraphConfig:getRadarConfig,getStartGraphConfig:getStartRadarConfig,beforeChange:beforeChangeRadar});(0,_updater.doUpdate)({chart:chart,series:radars,key:"radarPoint",getGraphConfig:getPointConfig,getStartGraphConfig:getStartPointConfig});(0,_updater.doUpdate)({chart:chart,series:radars,key:"radarLabel",getGraphConfig:getLabelConfig})}function calcRadarPosition(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var indicator=radarAxis.indicator,axisLineAngles=radarAxis.axisLineAngles,radius=radarAxis.radius,centerPos=radarAxis.centerPos;radars.forEach(function(radarItem){var data=radarItem.data;radarItem.dataRadius=[];radarItem.radarPosition=indicator.map(function(_ref,i){var max=_ref.max,min=_ref.min;var v=data[i];if(typeof max!=="number")max=v;if(typeof min!=="number")min=0;if(typeof v!=="number")v=min;var dataRadius=(v-min)/(max-min)*radius;radarItem.dataRadius[i]=dataRadius;return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([dataRadius,axisLineAngles[i]]))})});return radars}function calcRadarLabelPosition(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var centerPos=radarAxis.centerPos,axisLineAngles=radarAxis.axisLineAngles;radars.forEach(function(radarItem){var dataRadius=radarItem.dataRadius,label=radarItem.label;var labelGap=label.labelGap;radarItem.labelPosition=dataRadius.map(function(r,i){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([r+labelGap,axisLineAngles[i]]))})});return radars}function calcRadarLabelAlign(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var _radarAxis$centerPos=(0,_slicedToArray2["default"])(radarAxis.centerPos,2),x=_radarAxis$centerPos[0],y=_radarAxis$centerPos[1];radars.forEach(function(radarItem){var labelPosition=radarItem.labelPosition;var labelAlign=labelPosition.map(function(_ref2){var _ref3=(0,_slicedToArray2["default"])(_ref2,2),lx=_ref3[0],ly=_ref3[1];var textAlign=lx>x?"left":"right";var textBaseline=ly>y?"top":"bottom";return{textAlign:textAlign,textBaseline:textBaseline}});radarItem.labelAlign=labelAlign});return radars}function getRadarConfig(radarItem){var animationCurve=radarItem.animationCurve,animationFrame=radarItem.animationFrame,rLevel=radarItem.rLevel;return[{name:"polyline",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getRadarShape(radarItem),style:getRadarStyle(radarItem)}]}function getStartRadarConfig(radarItem,updater){var centerPos=updater.chart.radarAxis.centerPos;var config=getRadarConfig(radarItem)[0];var pointNum=config.shape.points.length;var points=new Array(pointNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(centerPos)});config.shape.points=points;return[config]}function getRadarShape(radarItem){var radarPosition=radarItem.radarPosition;return{points:radarPosition,close:true}}function getRadarStyle(radarItem){var radarStyle=radarItem.radarStyle,color=radarItem.color;var colorRgbaValue=(0,_color.getRgbaValue)(color);colorRgbaValue[3]=.5;var radarDefaultColor={stroke:color,fill:(0,_color.getColorFromRgbValue)(colorRgbaValue)};return(0,_util2.deepMerge)(radarDefaultColor,radarStyle)}function beforeChangeRadar(graph,_ref4){var shape=_ref4.shape;var graphPoints=graph.shape.points;var graphPointsNum=graphPoints.length;var pointsNum=shape.points.length;if(pointsNum>graphPointsNum){var lastPoint=graphPoints.slice(-1)[0];var newAddPoints=new Array(pointsNum-graphPointsNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(lastPoint)});graphPoints.push.apply(graphPoints,(0,_toConsumableArray2["default"])(newAddPoints))}else if(pointsNum1&&arguments[1]!==undefined?arguments[1]:{};var radar=option.radar;var radarAxis=[];if(radar){radarAxis=mergeRadarAxisDefaultConfig(radar);radarAxis=calcRadarAxisCenter(radarAxis,chart);radarAxis=calcRadarAxisRingRadius(radarAxis,chart);radarAxis=calcRadarAxisLinePosition(radarAxis);radarAxis=calcRadarAxisAreaRadius(radarAxis);radarAxis=calcRadarAxisLabelPosition(radarAxis);radarAxis=[radarAxis]}var radarAxisForUpdate=radarAxis;if(radarAxis.length&&!radarAxis[0].show)radarAxisForUpdate=[];(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisSplitArea",getGraphConfig:getSplitAreaConfig,beforeUpdate:beforeUpdateSplitArea,beforeChange:beforeChangeSplitArea});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisSplitLine",getGraphConfig:getSplitLineConfig,beforeUpdate:beforeUpdateSplitLine,beforeChange:beforeChangeSplitLine});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisLine",getGraphConfig:getAxisLineConfig});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisLable",getGraphConfig:getAxisLabelConfig});chart.radarAxis=radarAxis[0]}function mergeRadarAxisDefaultConfig(radar){return(0,_util2.deepMerge)((0,_util.deepClone)(_index.radarAxisConfig),radar)}function calcRadarAxisCenter(radarAxis,chart){var area=chart.render.area;var center=radarAxis.center;radarAxis.centerPos=center.map(function(v,i){if(typeof v==="number")return v;return parseInt(v)/100*area[i]});return radarAxis}function calcRadarAxisRingRadius(radarAxis,chart){var area=chart.render.area;var splitNum=radarAxis.splitNum,radius=radarAxis.radius;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;if(typeof radius!=="number")radius=parseInt(radius)/100*maxRadius;var splitGap=radius/splitNum;radarAxis.ringRadius=new Array(splitNum).fill(0).map(function(foo,i){return splitGap*(i+1)});radarAxis.radius=radius;return radarAxis}function calcRadarAxisLinePosition(radarAxis){var indicator=radarAxis.indicator,centerPos=radarAxis.centerPos,radius=radarAxis.radius,startAngle=radarAxis.startAngle;var fullAngle=Math.PI*2;var indicatorNum=indicator.length;var indicatorGap=fullAngle/indicatorNum;var angles=new Array(indicatorNum).fill(0).map(function(foo,i){return indicatorGap*i+startAngle});radarAxis.axisLineAngles=angles;radarAxis.axisLinePosition=angles.map(function(g){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([radius,g]))});return radarAxis}function calcRadarAxisAreaRadius(radarAxis){var ringRadius=radarAxis.ringRadius;var subRadius=ringRadius[0]/2;radarAxis.areaRadius=ringRadius.map(function(r){return r-subRadius});return radarAxis}function calcRadarAxisLabelPosition(radarAxis){var axisLineAngles=radarAxis.axisLineAngles,centerPos=radarAxis.centerPos,radius=radarAxis.radius,axisLabel=radarAxis.axisLabel;radius+=axisLabel.labelGap;radarAxis.axisLabelPosition=axisLineAngles.map(function(angle){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([radius,angle]))});return radarAxis}function getSplitAreaConfig(radarAxis){var areaRadius=radarAxis.areaRadius,polygon=radarAxis.polygon,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;var name=polygon?"regPolygon":"ring";return areaRadius.map(function(foo,i){return{name:name,index:rLevel,visible:radarAxis.splitArea.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getSplitAreaShape(radarAxis,i),style:getSplitAreaStyle(radarAxis,i)}})}function getSplitAreaShape(radarAxis,i){var polygon=radarAxis.polygon,areaRadius=radarAxis.areaRadius,indicator=radarAxis.indicator,centerPos=radarAxis.centerPos;var indicatorNum=indicator.length;var shape={rx:centerPos[0],ry:centerPos[1],r:areaRadius[i]};if(polygon)shape.side=indicatorNum;return shape}function getSplitAreaStyle(radarAxis,i){var splitArea=radarAxis.splitArea,ringRadius=radarAxis.ringRadius,axisLineAngles=radarAxis.axisLineAngles,polygon=radarAxis.polygon,centerPos=radarAxis.centerPos;var color=splitArea.color,style=splitArea.style;style=_objectSpread({fill:"rgba(0, 0, 0, 0)"},style);var lineWidth=ringRadius[0]-0;if(polygon){var point1=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([ringRadius[0],axisLineAngles[0]]));var point2=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([ringRadius[0],axisLineAngles[1]]));lineWidth=(0,_util2.getPointToLineDistance)(centerPos,point1,point2)}style=(0,_util2.deepMerge)((0,_util.deepClone)(style,true),{lineWidth:lineWidth});if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function beforeUpdateSplitArea(graphs,radarAxis,i,updater){var cache=graphs[i];if(!cache)return;var render=updater.chart.render;var polygon=radarAxis.polygon;var name=cache[0].name;var currentName=polygon?"regPolygon":"ring";var delAll=currentName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeSplitArea(graph,config){var side=config.shape.side;if(typeof side!=="number")return;graph.shape.side=side}function getSplitLineConfig(radarAxis){var ringRadius=radarAxis.ringRadius,polygon=radarAxis.polygon,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;var name=polygon?"regPolygon":"ring";return ringRadius.map(function(foo,i){return{name:name,index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,visible:radarAxis.splitLine.show,shape:getSplitLineShape(radarAxis,i),style:getSplitLineStyle(radarAxis,i)}})}function getSplitLineShape(radarAxis,i){var ringRadius=radarAxis.ringRadius,centerPos=radarAxis.centerPos,indicator=radarAxis.indicator,polygon=radarAxis.polygon;var shape={rx:centerPos[0],ry:centerPos[1],r:ringRadius[i]};var indicatorNum=indicator.length;if(polygon)shape.side=indicatorNum;return shape}function getSplitLineStyle(radarAxis,i){var splitLine=radarAxis.splitLine;var color=splitLine.color,style=splitLine.style;style=_objectSpread({fill:"rgba(0, 0, 0, 0)"},style);if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function beforeUpdateSplitLine(graphs,radarAxis,i,updater){var cache=graphs[i];if(!cache)return;var render=updater.chart.render;var polygon=radarAxis.polygon;var name=cache[0].name;var currenName=polygon?"regPolygon":"ring";var delAll=currenName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeSplitLine(graph,config){var side=config.shape.side;if(typeof side!=="number")return;graph.shape.side=side}function getAxisLineConfig(radarAxis){var axisLinePosition=radarAxis.axisLinePosition,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;return axisLinePosition.map(function(foo,i){return{name:"polyline",index:rLevel,visible:radarAxis.axisLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLineShape(radarAxis,i),style:getAxisLineStyle(radarAxis,i)}})}function getAxisLineShape(radarAxis,i){var centerPos=radarAxis.centerPos,axisLinePosition=radarAxis.axisLinePosition;var points=[centerPos,axisLinePosition[i]];return{points:points}}function getAxisLineStyle(radarAxis,i){var axisLine=radarAxis.axisLine;var color=axisLine.color,style=axisLine.style;if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function getAxisLabelConfig(radarAxis){var axisLabelPosition=radarAxis.axisLabelPosition,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;return axisLabelPosition.map(function(foo,i){return{name:"text",index:rLevel,visible:radarAxis.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLableShape(radarAxis,i),style:getAxisLableStyle(radarAxis,i)}})}function getAxisLableShape(radarAxis,i){var axisLabelPosition=radarAxis.axisLabelPosition,indicator=radarAxis.indicator;return{content:indicator[i].name,position:axisLabelPosition[i]}}function getAxisLableStyle(radarAxis,i){var axisLabel=radarAxis.axisLabel,_radarAxis$centerPos=(0,_slicedToArray2["default"])(radarAxis.centerPos,2),x=_radarAxis$centerPos[0],y=_radarAxis$centerPos[1],axisLabelPosition=radarAxis.axisLabelPosition;var color=axisLabel.color,style=axisLabel.style;var _axisLabelPosition$i=(0,_slicedToArray2["default"])(axisLabelPosition[i],2),labelXpos=_axisLabelPosition$i[0],labelYPos=_axisLabelPosition$i[1];var textAlign=labelXpos>x?"left":"right";var textBaseline=labelYPos>y?"top":"bottom";style=(0,_util2.deepMerge)({textAlign:textAlign,textBaseline:textBaseline},style);if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{fill:color[i%colorNum]})}},{"../class/updater.class":3,"../config/index":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render/lib/plugin/util":54}],27:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.title=title;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function title(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var title=[];if(option.title){title[0]=(0,_util2.deepMerge)((0,_util.deepClone)(_config.titleConfig,true),option.title)}(0,_updater.doUpdate)({chart:chart,series:title,key:"title",getGraphConfig:getTitleConfig})}function getTitleConfig(titleItem,updater){var animationCurve=_config.titleConfig.animationCurve,animationFrame=_config.titleConfig.animationFrame,rLevel=_config.titleConfig.rLevel;var shape=getTitleShape(titleItem,updater);var style=getTitleStyle(titleItem);return[{name:"text",index:rLevel,visible:titleItem.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}]}function getTitleShape(titleItem,updater){var offset=titleItem.offset,text=titleItem.text;var _updater$chart$gridAr=updater.chart.gridArea,x=_updater$chart$gridAr.x,y=_updater$chart$gridAr.y,w=_updater$chart$gridAr.w;var _offset=(0,_slicedToArray2["default"])(offset,2),ox=_offset[0],oy=_offset[1];return{content:text,position:[x+w/2+ox,y+oy]}}function getTitleStyle(titleItem){var style=titleItem.style;return style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@jiaminghi/c-render/lib/plugin/util":54}],28:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _cRender=require("@jiaminghi/c-render");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _index=require("../util/index");var pie={shape:{rx:0,ry:0,ir:0,or:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref){var shape=_ref.shape;var keys=["rx","ry","ir","or","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Pie shape configuration is abnormal!");return false}return true},draw:function draw(_ref2,_ref3){var ctx=_ref2.ctx;var shape=_ref3.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,ir=shape.ir,or=shape.or,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;rx=parseInt(rx)+.5;ry=parseInt(ry)+.5;ctx.arc(rx,ry,ir>0?ir:0,startAngle,endAngle,!clockWise);var connectPoint1=(0,_util.getCircleRadianPoint)(rx,ry,or,endAngle).map(function(p){return parseInt(p)+.5});var connectPoint2=(0,_util.getCircleRadianPoint)(rx,ry,ir,startAngle).map(function(p){return parseInt(p)+.5});ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(connectPoint1));ctx.arc(rx,ry,or>0?or:0,endAngle,startAngle,clockWise);ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(connectPoint2));ctx.closePath();ctx.stroke();ctx.fill()}};var agArc={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,gradientStartAngle:null,gradientEndAngle:null},validator:function validator(_ref4){var shape=_ref4.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("AgArc shape configuration is abnormal!");return false}return true},draw:function draw(_ref5,_ref6){var ctx=_ref5.ctx;var shape=_ref6.shape,style=_ref6.style;var gradient=style.gradient;gradient=gradient.map(function(cv){return(0,_color.getColorFromRgbValue)(cv)});if(gradient.length===1){gradient=[gradient[0],gradient[0]]}var gradientArcNum=gradient.length-1;var gradientStartAngle=shape.gradientStartAngle,gradientEndAngle=shape.gradientEndAngle,startAngle=shape.startAngle,endAngle=shape.endAngle,r=shape.r,rx=shape.rx,ry=shape.ry;if(gradientStartAngle===null)gradientStartAngle=startAngle;if(gradientEndAngle===null)gradientEndAngle=endAngle;var angleGap=(gradientEndAngle-gradientStartAngle)/gradientArcNum;if(angleGap===Math.PI*2)angleGap=Math.PI*2-.001;for(var i=0;iendAngle){arcEndAngle=endAngle;doBreak=true}ctx.arc(rx,ry,r,arcStartAngle,arcEndAngle);ctx.strokeStyle=color;ctx.stroke();if(doBreak)break}}};var numberText={shape:{number:[],content:"",position:[0,0],toFixed:0},validator:function validator(_ref7){var shape=_ref7.shape;var number=shape.number,content=shape.content,position=shape.position;if(!(number instanceof Array)||typeof content!=="string"||!(position instanceof Array)){console.error("NumberText shape configuration is abnormal!");return false}return true},draw:function draw(_ref8,_ref9){var ctx=_ref8.ctx;var shape=_ref9.shape;ctx.beginPath();var number=shape.number,content=shape.content,position=shape.position,toFixed=shape.toFixed;var textSegments=content.split("{nt}");var lastSegmentIndex=textSegments.length-1;var textString="";textSegments.forEach(function(t,i){var currentNumber=number[i];if(i===lastSegmentIndex)currentNumber="";if(typeof currentNumber==="number")currentNumber=currentNumber.toFixed(toFixed);textString+=t+(currentNumber||"")});ctx.closePath();ctx.strokeText.apply(ctx,[textString].concat((0,_toConsumableArray2["default"])(position)));ctx.fillText.apply(ctx,[textString].concat((0,_toConsumableArray2["default"])(position)))}};var lineIcon={shape:{x:0,y:0,w:0,h:0},validator:function validator(_ref10){var shape=_ref10.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"){console.error("lineIcon shape configuration is abnormal!");return false}return true},draw:function draw(_ref11,_ref12){var ctx=_ref11.ctx;var shape=_ref12.shape;ctx.beginPath();var x=shape.x,y=shape.y,w=shape.w,h=shape.h;var halfH=h/2;ctx.strokeStyle=ctx.fillStyle;ctx.moveTo(x,y+halfH);ctx.lineTo(x+w,y+halfH);ctx.lineWidth=1;ctx.stroke();ctx.beginPath();var radius=halfH-5*2;if(radius<=0)radius=3;ctx.arc(x+w/2,y+halfH,radius,0,Math.PI*2);ctx.lineWidth=5;ctx.stroke();ctx.fillStyle="#fff";ctx.fill()},hoverCheck:function hoverCheck(position,_ref13){var shape=_ref13.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;return(0,_util.checkPointIsInRect)(position,x,y,w,h)},setGraphCenter:function setGraphCenter(e,_ref14){var shape=_ref14.shape,style=_ref14.style;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;style.graphCenter=[x+w/2,y+h/2]}};(0,_cRender.extendNewGraph)("pie",pie);(0,_cRender.extendNewGraph)("agArc",agArc);(0,_cRender.extendNewGraph)("numberText",numberText);(0,_cRender.extendNewGraph)("lineIcon",lineIcon)},{"../util/index":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],29:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"changeDefaultConfig",{enumerable:true,get:function get(){return _config.changeDefaultConfig}});exports["default"]=void 0;var _charts=_interopRequireDefault(require("./class/charts.class"));var _config=require("./config");var _default=_charts["default"];exports["default"]=_default},{"./class/charts.class":2,"./config":9,"@babel/runtime/helpers/interopRequireDefault":36}],30:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.filterNonNumber=filterNonNumber;exports.deepMerge=deepMerge;exports.mulAdd=mulAdd;exports.mergeSameStackData=mergeSameStackData;exports.getTwoPointDistance=getTwoPointDistance;exports.getLinearGradientColor=getLinearGradientColor;exports.getPolylineLength=getPolylineLength;exports.getPointToLineDistance=getPointToLineDistance;exports.initNeedSeries=initNeedSeries;exports.radianToAngle=radianToAngle;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _util=require("@jiaminghi/c-render/lib/plugin/util");function filterNonNumber(array){return array.filter(function(n){return typeof n==="number"})}function deepMerge(target,merged){for(var key in merged){target[key]=target[key]&&(0,_typeof2["default"])(target[key])==="object"?deepMerge(target[key],merged[key]):target[key]=merged[key]}return target}function mulAdd(nums){nums=filterNonNumber(nums);return nums.reduce(function(all,num){return all+num},0)}function mergeSameStackData(item,series){var stack=item.stack;if(!stack)return(0,_toConsumableArray2["default"])(item.data);var stacks=series.filter(function(_ref){var s=_ref.stack;return s===stack});var index=stacks.findIndex(function(_ref2){var d=_ref2.data;return d===item.data});var datas=stacks.splice(0,index+1).map(function(_ref3){var data=_ref3.data;return data});var dataLength=datas[0].length;return new Array(dataLength).fill(0).map(function(foo,i){return mulAdd(datas.map(function(d){return d[i]}))})}function getTwoPointDistance(pointOne,pointTwo){var minusX=Math.abs(pointOne[0]-pointTwo[0]);var minusY=Math.abs(pointOne[1]-pointTwo[1]);return Math.sqrt(minusX*minusX+minusY*minusY)}function getLinearGradientColor(ctx,begin,end,color){if(!ctx||!begin||!end||!color.length)return;var colors=color;typeof colors==="string"&&(colors=[color,color]);var linearGradientColor=ctx.createLinearGradient.apply(ctx,(0,_toConsumableArray2["default"])(begin).concat((0,_toConsumableArray2["default"])(end)));var colorGap=1/(colors.length-1);colors.forEach(function(c,i){return linearGradientColor.addColorStop(colorGap*i,c)});return linearGradientColor}function getPolylineLength(points){var lineSegments=new Array(points.length-1).fill(0).map(function(foo,i){return[points[i],points[i+1]]});var lengths=lineSegments.map(function(item){return getTwoPointDistance.apply(void 0,(0,_toConsumableArray2["default"])(item))});return mulAdd(lengths)}function getPointToLineDistance(point,linePointOne,linePointTwo){var a=getTwoPointDistance(point,linePointOne);var b=getTwoPointDistance(point,linePointTwo);var c=getTwoPointDistance(linePointOne,linePointTwo);return.5*Math.sqrt((a+b+c)*(a+b-c)*(a+c-b)*(b+c-a))/c}function initNeedSeries(series,config,type){series=series.filter(function(_ref4){var st=_ref4.type;return st===type});series=series.map(function(item){return deepMerge((0,_util.deepClone)(config,true),item)});return series.filter(function(_ref5){var show=_ref5.show;return show})}function radianToAngle(radian){return radian/Math.PI*180}},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],31:[function(require,module,exports){function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}module.exports=_arrayWithHoles},{}],32:[function(require,module,exports){function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i1&&arguments[1]!==undefined?arguments[1]:5;var segmentsNum=bezierCurve.length-1;var startPoint=bezierCurve[0];var endPoint=bezierCurve[segmentsNum][2];var segments=bezierCurve.slice(1);var getSegmentTPointFuns=segments.map(function(seg,i){var beginPoint=i===0?startPoint:segments[i-1][2];return createGetBezierCurveTPointFun.apply(void 0,[beginPoint].concat((0,_toConsumableArray2["default"])(seg)))});var segmentPointsNum=new Array(segmentsNum).fill(defaultSegmentPointsNum);var segmentPoints=getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum);var result=calcUniformPointsByIteration(segmentPoints,getSegmentTPointFuns,segments,precision);result.segmentPoints.push(endPoint);return result}function createGetBezierCurveTPointFun(beginPoint,controlPoint1,controlPoint2,endPoint){return function(t){var tSubed1=1-t;var tSubed1Pow3=pow(tSubed1,3);var tSubed1Pow2=pow(tSubed1,2);var tPow3=pow(t,3);var tPow2=pow(t,2);return[beginPoint[0]*tSubed1Pow3+3*controlPoint1[0]*t*tSubed1Pow2+3*controlPoint2[0]*tPow2*tSubed1+endPoint[0]*tPow3,beginPoint[1]*tSubed1Pow3+3*controlPoint1[1]*t*tSubed1Pow2+3*controlPoint2[1]*tPow2*tSubed1+endPoint[1]*tPow3]}}function getTwoPointDistance(_ref,_ref2){var _ref3=(0,_slicedToArray2["default"])(_ref,2),ax=_ref3[0],ay=_ref3[1];var _ref4=(0,_slicedToArray2["default"])(_ref2,2),bx=_ref4[0],by=_ref4[1];return sqrt(pow(ax-bx,2)+pow(ay-by,2))}function getNumsSum(nums){return nums.reduce(function(sum,num){return sum+num},0)}function getSegmentPointsDistance(segmentPoints){return segmentPoints.map(function(points,i){return new Array(points.length-1).fill(0).map(function(temp,j){return getTwoPointDistance(points[j],points[j+1])})})}function getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum){return getSegmentTPointFuns.map(function(getSegmentTPointFun,i){var tGap=1/segmentPointsNum[i];return new Array(segmentPointsNum[i]).fill("").map(function(foo,j){return getSegmentTPointFun(j*tGap)})})}function getAllDeviations(segmentPointsDistance,avgLength){return segmentPointsDistance.map(function(seg){return seg.map(function(s){return abs(s-avgLength)})}).map(function(seg){return getNumsSum(seg)}).reduce(function(total,v){return total+v},0)}function calcUniformPointsByIteration(segmentPoints,getSegmentTPointFuns,segments,precision){var rounds=4;var cycles=1;var _loop=function _loop(){var totalPointsNum=segmentPoints.reduce(function(total,seg){return total+seg.length},0);segmentPoints.forEach(function(seg,i){return seg.push(segments[i][2])});var segmentPointsDistance=getSegmentPointsDistance(segmentPoints);var lineSegmentNum=segmentPointsDistance.reduce(function(total,seg){return total+seg.length},0);var segmentlength=segmentPointsDistance.map(function(seg){return getNumsSum(seg)});var totalLength=getNumsSum(segmentlength);var avgLength=totalLength/lineSegmentNum;var allDeviations=getAllDeviations(segmentPointsDistance,avgLength);if(allDeviations<=precision)return"break";totalPointsNum=ceil(avgLength/precision*totalPointsNum*1.1);var segmentPointsNum=segmentlength.map(function(length){return ceil(length/totalLength*totalPointsNum)});segmentPoints=getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum);totalPointsNum=segmentPoints.reduce(function(total,seg){return total+seg.length},0);var segmentPointsForLength=JSON.parse(JSON.stringify(segmentPoints));segmentPointsForLength.forEach(function(seg,i){return seg.push(segments[i][2])});segmentPointsDistance=getSegmentPointsDistance(segmentPointsForLength);lineSegmentNum=segmentPointsDistance.reduce(function(total,seg){return total+seg.length},0);segmentlength=segmentPointsDistance.map(function(seg){return getNumsSum(seg)});totalLength=getNumsSum(segmentlength);avgLength=totalLength/lineSegmentNum;var stepSize=1/totalPointsNum/10;getSegmentTPointFuns.forEach(function(getSegmentTPointFun,i){var currentSegmentPointsNum=segmentPointsNum[i];var t=new Array(currentSegmentPointsNum).fill("").map(function(foo,j){return j/segmentPointsNum[i]});for(var r=0;r1)t[j]=1;if(t[j]<0)t[j]=0;segmentPoints[i][j]=getSegmentTPointFun(t[j])}}});rounds*=4;cycles++};do{var _ret=_loop();if(_ret==="break")break}while(rounds<=1025);segmentPoints=segmentPoints.reduce(function(all,seg){return all.concat(seg)},[]);return{segmentPoints:segmentPoints,cycles:cycles,rounds:rounds}}function bezierCurveToPolyline(bezierCurve){var precision=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(!bezierCurve){console.error("bezierCurveToPolyline: Missing parameters!");return false}if(!(bezierCurve instanceof Array)){console.error("bezierCurveToPolyline: Parameter bezierCurve must be an array!");return false}if(typeof precision!=="number"){console.error("bezierCurveToPolyline: Parameter precision must be a number!");return false}var _abstractBezierCurveT=abstractBezierCurveToPolyline(bezierCurve,precision),segmentPoints=_abstractBezierCurveT.segmentPoints;return segmentPoints}function getBezierCurveLength(bezierCurve){var precision=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(!bezierCurve){console.error("getBezierCurveLength: Missing parameters!");return false}if(!(bezierCurve instanceof Array)){console.error("getBezierCurveLength: Parameter bezierCurve must be an array!");return false}if(typeof precision!=="number"){console.error("getBezierCurveLength: Parameter precision must be a number!");return false}var _abstractBezierCurveT2=abstractBezierCurveToPolyline(bezierCurve,precision),segmentPoints=_abstractBezierCurveT2.segmentPoints;var pointsDistance=getSegmentPointsDistance([segmentPoints])[0];var length=getNumsSum(pointsDistance);return length}var _default=bezierCurveToPolyline;exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42}],46:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));function polylineToBezierCurve(polyline){var close=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var offsetA=arguments.length>2&&arguments[2]!==undefined?arguments[2]:.25;var offsetB=arguments.length>3&&arguments[3]!==undefined?arguments[3]:.25;if(!(polyline instanceof Array)){console.error("polylineToBezierCurve: Parameter polyline must be an array!");return false}if(polyline.length<=2){console.error("polylineToBezierCurve: Converting to a curve requires at least 3 points!");return false}var startPoint=polyline[0];var bezierCurveLineNum=polyline.length-1;var bezierCurvePoints=new Array(bezierCurveLineNum).fill(0).map(function(foo,i){return[].concat((0,_toConsumableArray2["default"])(getBezierCurveLineControlPoints(polyline,i,close,offsetA,offsetB)),[polyline[i+1]])});if(close)closeBezierCurve(bezierCurvePoints,startPoint);bezierCurvePoints.unshift(polyline[0]);return bezierCurvePoints}function getBezierCurveLineControlPoints(polyline,index){var close=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var offsetA=arguments.length>3&&arguments[3]!==undefined?arguments[3]:.25;var offsetB=arguments.length>4&&arguments[4]!==undefined?arguments[4]:.25;var pointNum=polyline.length;if(pointNum<3||index>=pointNum)return;var beforePointIndex=index-1;if(beforePointIndex<0)beforePointIndex=close?pointNum+beforePointIndex:0;var afterPointIndex=index+1;if(afterPointIndex>=pointNum)afterPointIndex=close?afterPointIndex-pointNum:pointNum-1;var afterNextPointIndex=index+2;if(afterNextPointIndex>=pointNum)afterNextPointIndex=close?afterNextPointIndex-pointNum:pointNum-1;var pointBefore=polyline[beforePointIndex];var pointMiddle=polyline[index];var pointAfter=polyline[afterPointIndex];var pointAfterNext=polyline[afterNextPointIndex];return[[pointMiddle[0]+offsetA*(pointAfter[0]-pointBefore[0]),pointMiddle[1]+offsetA*(pointAfter[1]-pointBefore[1])],[pointAfter[0]-offsetB*(pointAfterNext[0]-pointMiddle[0]),pointAfter[1]-offsetB*(pointAfterNext[1]-pointMiddle[1])]]}function closeBezierCurve(bezierCurve,startPoint){var firstSubCurve=bezierCurve[0];var lastSubCurve=bezierCurve.slice(-1)[0];bezierCurve.push([getSymmetryPoint(lastSubCurve[1],lastSubCurve[2]),getSymmetryPoint(firstSubCurve[0],startPoint),startPoint]);return bezierCurve}function getSymmetryPoint(point,centerPoint){var _point=(0,_slicedToArray2["default"])(point,2),px=_point[0],py=_point[1];var _centerPoint=(0,_slicedToArray2["default"])(centerPoint,2),cx=_centerPoint[0],cy=_centerPoint[1];var minusX=cx-px;var minusY=cy-py;return[cx+minusX,cy+minusY]}var _default=polylineToBezierCurve;exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42}],47:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"bezierCurveToPolyline",{enumerable:true,get:function get(){return _bezierCurveToPolyline.bezierCurveToPolyline}});Object.defineProperty(exports,"getBezierCurveLength",{enumerable:true,get:function get(){return _bezierCurveToPolyline.getBezierCurveLength}});Object.defineProperty(exports,"polylineToBezierCurve",{enumerable:true,get:function get(){return _polylineToBezierCurve["default"]}});exports["default"]=void 0;var _bezierCurveToPolyline=require("./core/bezierCurveToPolyline");var _polylineToBezierCurve=_interopRequireDefault(require("./core/polylineToBezierCurve"));var _default={bezierCurveToPolyline:_bezierCurveToPolyline.bezierCurveToPolyline,getBezierCurveLength:_bezierCurveToPolyline.getBezierCurveLength,polylineToBezierCurve:_polylineToBezierCurve["default"]};exports["default"]=_default},{"./core/bezierCurveToPolyline":45,"./core/polylineToBezierCurve":46,"@babel/runtime/helpers/interopRequireDefault":36}],48:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _color=_interopRequireDefault(require("@jiaminghi/color"));var _bezierCurve=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../plugin/util");var _graphs=_interopRequireDefault(require("../config/graphs"));var _graph=_interopRequireDefault(require("./graph.class"));function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i0&&arguments[0]!==undefined?arguments[0]:{};var name=config.name;if(!name){console.error("add Missing parameters!");return}var graphConfig=_graphs["default"].get(name);if(!graphConfig){console.warn("No corresponding graph configuration found!");return}var graph=new _graph["default"](graphConfig,config);if(!graph.validator(graph))return;graph.render=this;this.graphs.push(graph);this.sortGraphsByIndex();this.drawAllGraph();return graph};CRender.prototype.sortGraphsByIndex=function(){var graphs=this.graphs;graphs.sort(function(a,b){if(a.index>b.index)return 1;if(a.index===b.index)return 0;if(a.index1&&arguments[1]!==undefined?arguments[1]:undefined;if(!attrName||change===undefined)return false;var isObject=(0,_typeof2["default"])(this[attrName])==="object";if(isObject)change=(0,_util.deepClone)(change,true);var render=this.render;if(attrName==="style"){this.style.update(change)}else if(isObject){Object.assign(this[attrName],change)}else{this[attrName]=change}if(attrName==="index")render.sortGraphsByIndex();render.drawAllGraph()};Graph.prototype.animation=function(){var _ref2=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(attrName,change){var wait,changeRoot,changeKeys,beforeState,animationFrame,animationCurve,animationDelay,animationFrameState,render,_args2=arguments;return _regenerator["default"].wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:wait=_args2.length>2&&_args2[2]!==undefined?_args2[2]:false;if(!(attrName!=="shape"&&attrName!=="style")){_context2.next=4;break}console.error("Only supported shape and style animation!");return _context2.abrupt("return");case 4:change=(0,_util.deepClone)(change,true);if(attrName==="style")this.style.colorProcessor(change);changeRoot=this[attrName];changeKeys=Object.keys(change);beforeState={};changeKeys.forEach(function(key){return beforeState[key]=changeRoot[key]});animationFrame=this.animationFrame,animationCurve=this.animationCurve,animationDelay=this.animationDelay;animationFrameState=(0,_transition["default"])(animationCurve,beforeState,change,animationFrame,true);this.animationRoot.push(changeRoot);this.animationKeys.push(changeKeys);this.animationFrameState.push(animationFrameState);if(!wait){_context2.next=17;break}return _context2.abrupt("return");case 17:if(!(animationDelay>0)){_context2.next=20;break}_context2.next=20;return delay(animationDelay);case 20:render=this.render;return _context2.abrupt("return",new Promise(function(){var _ref3=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(resolve){return _regenerator["default"].wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return render.launchAnimation();case 2:resolve();case 3:case"end":return _context.stop()}}},_callee)}));return function(_x3){return _ref3.apply(this,arguments)}}()));case 22:case"end":return _context2.stop()}}},_callee2,this)}));return function(_x,_x2){return _ref2.apply(this,arguments)}}();Graph.prototype.turnNextAnimationFrame=function(timeStamp){var animationDelay=this.animationDelay,animationRoot=this.animationRoot,animationKeys=this.animationKeys,animationFrameState=this.animationFrameState,animationPause=this.animationPause;if(animationPause)return;if(Date.now()-timeStamp1&&arguments[1]!==undefined?arguments[1]:false;var processor=reverse?_color.getColorFromRgbValue:_color.getRgbaValue;var colorProcessorKeys=["fill","stroke","shadowColor"];var allKeys=Object.keys(style);var colorKeys=allKeys.filter(function(key){return colorProcessorKeys.find(function(k){return k===key})});colorKeys.forEach(function(key){return style[key]=processor(style[key])});var gradientColor=style.gradientColor,colors=style.colors;if(gradientColor)style.gradientColor=gradientColor.map(function(c){return processor(c)});if(colors){var colorsKeys=Object.keys(colors);colorsKeys.forEach(function(key){return colors[key]=processor(colors[key])})}};Style.prototype.initStyle=function(ctx){initTransform(ctx,this);initGraphStyle(ctx,this);initGradient(ctx,this)};function initTransform(ctx,style){ctx.save();var graphCenter=style.graphCenter,rotate=style.rotate,scale=style.scale,translate=style.translate;if(!(graphCenter instanceof Array))return;ctx.translate.apply(ctx,(0,_toConsumableArray2["default"])(graphCenter));if(rotate)ctx.rotate(rotate*Math.PI/180);if(scale instanceof Array)ctx.scale.apply(ctx,(0,_toConsumableArray2["default"])(scale));if(translate)ctx.translate.apply(ctx,(0,_toConsumableArray2["default"])(translate));ctx.translate(-graphCenter[0],-graphCenter[1])}var autoSetStyleKeys=["lineCap","lineJoin","lineDashOffset","shadowOffsetX","shadowOffsetY","lineWidth","textAlign","textBaseline"];function initGraphStyle(ctx,style){var fill=style.fill,stroke=style.stroke,shadowColor=style.shadowColor,opacity=style.opacity;autoSetStyleKeys.forEach(function(key){if(key||typeof key==="number")ctx[key]=style[key]});fill=(0,_toConsumableArray2["default"])(fill);stroke=(0,_toConsumableArray2["default"])(stroke);shadowColor=(0,_toConsumableArray2["default"])(shadowColor);fill[3]*=opacity;stroke[3]*=opacity;shadowColor[3]*=opacity;ctx.fillStyle=(0,_color.getColorFromRgbValue)(fill);ctx.strokeStyle=(0,_color.getColorFromRgbValue)(stroke);ctx.shadowColor=(0,_color.getColorFromRgbValue)(shadowColor);var lineDash=style.lineDash,shadowBlur=style.shadowBlur;if(lineDash){lineDash=lineDash.map(function(v){return v>=0?v:0});ctx.setLineDash(lineDash)}if(typeof shadowBlur==="number")ctx.shadowBlur=shadowBlur>0?shadowBlur:.001;var fontStyle=style.fontStyle,fontVarient=style.fontVarient,fontWeight=style.fontWeight,fontSize=style.fontSize,fontFamily=style.fontFamily;ctx.font=fontStyle+" "+fontVarient+" "+fontWeight+" "+fontSize+"px"+" "+fontFamily}function initGradient(ctx,style){if(!gradientValidator(style))return;var gradientColor=style.gradientColor,gradientParams=style.gradientParams,gradientType=style.gradientType,gradientWith=style.gradientWith,gradientStops=style.gradientStops,opacity=style.opacity;gradientColor=gradientColor.map(function(color){var colorOpacity=color[3]*opacity;var clonedColor=(0,_toConsumableArray2["default"])(color);clonedColor[3]=colorOpacity;return clonedColor});gradientColor=gradientColor.map(function(c){return(0,_color.getColorFromRgbValue)(c)});if(gradientStops==="auto")gradientStops=getAutoColorStops(gradientColor);var gradient=ctx["create".concat(gradientType.slice(0,1).toUpperCase()+gradientType.slice(1),"Gradient")].apply(ctx,(0,_toConsumableArray2["default"])(gradientParams));gradientStops.forEach(function(stop,i){return gradient.addColorStop(stop,gradientColor[i])});ctx["".concat(gradientWith,"Style")]=gradient}function gradientValidator(style){var gradientColor=style.gradientColor,gradientParams=style.gradientParams,gradientType=style.gradientType,gradientWith=style.gradientWith,gradientStops=style.gradientStops;if(!gradientColor||!gradientParams)return false;if(gradientColor.length===1){console.warn("The gradient needs to provide at least two colors");return false}if(gradientType!=="linear"&&gradientType!=="radial"){console.warn("GradientType only supports linear or radial, current value is "+gradientType);return false}var gradientParamsLength=gradientParams.length;if(gradientType==="linear"&&gradientParamsLength!==4||gradientType==="radial"&&gradientParamsLength!==6){console.warn("The expected length of gradientParams is "+(gradientType==="linear"?"4":"6"));return false}if(gradientWith!=="fill"&&gradientWith!=="stroke"){console.warn("GradientWith only supports fill or stroke, current value is "+gradientWith);return false}if(gradientStops!=="auto"&&!(gradientStops instanceof Array)){console.warn("gradientStops only supports 'auto' or Number Array ([0, .5, 1]), current value is "+gradientStops);return false}return true}function getAutoColorStops(color){var stopGap=1/(color.length-1);return color.map(function(foo,i){return stopGap*i})}Style.prototype.restoreTransform=function(ctx){ctx.restore()};Style.prototype.update=function(change){this.colorProcessor(change);Object.assign(this,change)};Style.prototype.getStyle=function(){var clonedStyle=(0,_util.deepClone)(this,true);this.colorProcessor(clonedStyle,true);return clonedStyle}},{"../plugin/util":54,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/color":56}],51:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.extendNewGraph=extendNewGraph;exports["default"]=exports.text=exports.bezierCurve=exports.smoothline=exports.polyline=exports.regPolygon=exports.sector=exports.arc=exports.ring=exports.rect=exports.ellipse=exports.circle=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _bezierCurve2=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../plugin/util");var _canvas=require("../plugin/canvas");var polylineToBezierCurve=_bezierCurve2["default"].polylineToBezierCurve,bezierCurveToPolyline=_bezierCurve2["default"].bezierCurveToPolyline;var circle={shape:{rx:0,ry:0,r:0},validator:function validator(_ref){var shape=_ref.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;if(typeof rx!=="number"||typeof ry!=="number"||typeof r!=="number"){console.error("Circle shape configuration is abnormal!");return false}return true},draw:function draw(_ref2,_ref3){var ctx=_ref2.ctx;var shape=_ref3.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r;ctx.arc(rx,ry,r>0?r:.01,0,Math.PI*2);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref4){var shape=_ref4.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;return(0,_util.checkPointIsInCircle)(position,rx,ry,r)},setGraphCenter:function setGraphCenter(e,_ref5){var shape=_ref5.shape,style=_ref5.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref6,_ref7){var movementX=_ref6.movementX,movementY=_ref6.movementY;var shape=_ref7.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.circle=circle;var ellipse={shape:{rx:0,ry:0,hr:0,vr:0},validator:function validator(_ref8){var shape=_ref8.shape;var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;if(typeof rx!=="number"||typeof ry!=="number"||typeof hr!=="number"||typeof vr!=="number"){console.error("Ellipse shape configuration is abnormal!");return false}return true},draw:function draw(_ref9,_ref10){var ctx=_ref9.ctx;var shape=_ref10.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;ctx.ellipse(rx,ry,hr>0?hr:.01,vr>0?vr:.01,0,0,Math.PI*2);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref11){var shape=_ref11.shape;var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;var a=Math.max(hr,vr);var b=Math.min(hr,vr);var c=Math.sqrt(a*a-b*b);var leftFocusPoint=[rx-c,ry];var rightFocusPoint=[rx+c,ry];var distance=(0,_util.getTwoPointDistance)(position,leftFocusPoint)+(0,_util.getTwoPointDistance)(position,rightFocusPoint);return distance<=2*a},setGraphCenter:function setGraphCenter(e,_ref12){var shape=_ref12.shape,style=_ref12.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref13,_ref14){var movementX=_ref13.movementX,movementY=_ref13.movementY;var shape=_ref14.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.ellipse=ellipse;var rect={shape:{x:0,y:0,w:0,h:0},validator:function validator(_ref15){var shape=_ref15.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"){console.error("Rect shape configuration is abnormal!");return false}return true},draw:function draw(_ref16,_ref17){var ctx=_ref16.ctx;var shape=_ref17.shape;ctx.beginPath();var x=shape.x,y=shape.y,w=shape.w,h=shape.h;ctx.rect(x,y,w,h);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref18){var shape=_ref18.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;return(0,_util.checkPointIsInRect)(position,x,y,w,h)},setGraphCenter:function setGraphCenter(e,_ref19){var shape=_ref19.shape,style=_ref19.style;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;style.graphCenter=[x+w/2,y+h/2]},move:function move(_ref20,_ref21){var movementX=_ref20.movementX,movementY=_ref20.movementY;var shape=_ref21.shape;this.attr("shape",{x:shape.x+movementX,y:shape.y+movementY})}};exports.rect=rect;var ring={shape:{rx:0,ry:0,r:0},validator:function validator(_ref22){var shape=_ref22.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;if(typeof rx!=="number"||typeof ry!=="number"||typeof r!=="number"){console.error("Ring shape configuration is abnormal!");return false}return true},draw:function draw(_ref23,_ref24){var ctx=_ref23.ctx;var shape=_ref24.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r;ctx.arc(rx,ry,r>0?r:.01,0,Math.PI*2);ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref25){var shape=_ref25.shape,style=_ref25.style;var rx=shape.rx,ry=shape.ry,r=shape.r;var lineWidth=style.lineWidth;var halfLineWidth=lineWidth/2;var minDistance=r-halfLineWidth;var maxDistance=r+halfLineWidth;var distance=(0,_util.getTwoPointDistance)(position,[rx,ry]);return distance>=minDistance&&distance<=maxDistance},setGraphCenter:function setGraphCenter(e,_ref26){var shape=_ref26.shape,style=_ref26.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref27,_ref28){var movementX=_ref27.movementX,movementY=_ref27.movementY;var shape=_ref28.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.ring=ring;var arc={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref29){var shape=_ref29.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Arc shape configuration is abnormal!");return false}return true},draw:function draw(_ref30,_ref31){var ctx=_ref30.ctx;var shape=_ref31.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;ctx.arc(rx,ry,r>0?r:.001,startAngle,endAngle,!clockWise);ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref32){var shape=_ref32.shape,style=_ref32.style;var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;var lineWidth=style.lineWidth;var halfLineWidth=lineWidth/2;var insideRadius=r-halfLineWidth;var outsideRadius=r+halfLineWidth;return!(0,_util.checkPointIsInSector)(position,rx,ry,insideRadius,startAngle,endAngle,clockWise)&&(0,_util.checkPointIsInSector)(position,rx,ry,outsideRadius,startAngle,endAngle,clockWise)},setGraphCenter:function setGraphCenter(e,_ref33){var shape=_ref33.shape,style=_ref33.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref34,_ref35){var movementX=_ref34.movementX,movementY=_ref34.movementY;var shape=_ref35.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.arc=arc;var sector={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref36){var shape=_ref36.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Sector shape configuration is abnormal!");return false}return true},draw:function draw(_ref37,_ref38){var ctx=_ref37.ctx;var shape=_ref38.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;ctx.arc(rx,ry,r>0?r:.01,startAngle,endAngle,!clockWise);ctx.lineTo(rx,ry);ctx.closePath();ctx.stroke();ctx.fill()},hoverCheck:function hoverCheck(position,_ref39){var shape=_ref39.shape;var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;return(0,_util.checkPointIsInSector)(position,rx,ry,r,startAngle,endAngle,clockWise)},setGraphCenter:function setGraphCenter(e,_ref40){var shape=_ref40.shape,style=_ref40.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref41,_ref42){var movementX=_ref41.movementX,movementY=_ref41.movementY;var shape=_ref42.shape;var rx=shape.rx,ry=shape.ry;this.attr("shape",{rx:rx+movementX,ry:ry+movementY})}};exports.sector=sector;var regPolygon={shape:{rx:0,ry:0,r:0,side:0},validator:function validator(_ref43){var shape=_ref43.shape;var side=shape.side;var keys=["rx","ry","r","side"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("RegPolygon shape configuration is abnormal!");return false}if(side<3){console.error("RegPolygon at least trigon!");return false}return true},draw:function draw(_ref44,_ref45){var ctx=_ref44.ctx;var shape=_ref45.shape,cache=_ref45.cache;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,side=shape.side;if(!cache.points||cache.rx!==rx||cache.ry!==ry||cache.r!==r||cache.side!==side){var _points=(0,_util.getRegularPolygonPoints)(rx,ry,r,side);Object.assign(cache,{points:_points,rx:rx,ry:ry,r:r,side:side})}var points=cache.points;(0,_canvas.drawPolylinePath)(ctx,points);ctx.closePath();ctx.stroke();ctx.fill()},hoverCheck:function hoverCheck(position,_ref46){var cache=_ref46.cache;var points=cache.points;return(0,_util.checkPointIsInPolygon)(position,points)},setGraphCenter:function setGraphCenter(e,_ref47){var shape=_ref47.shape,style=_ref47.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref48,_ref49){var movementX=_ref48.movementX,movementY=_ref48.movementY;var shape=_ref49.shape,cache=_ref49.cache;var rx=shape.rx,ry=shape.ry;cache.rx+=movementX;cache.ry+=movementY;this.attr("shape",{rx:rx+movementX,ry:ry+movementY});cache.points=cache.points.map(function(_ref50){var _ref51=(0,_slicedToArray2["default"])(_ref50,2),x=_ref51[0],y=_ref51[1];return[x+movementX,y+movementY]})}};exports.regPolygon=regPolygon;var polyline={shape:{points:[],close:false},validator:function validator(_ref52){var shape=_ref52.shape;var points=shape.points;if(!(points instanceof Array)){console.error("Polyline points should be an array!");return false}return true},draw:function draw(_ref53,_ref54){var ctx=_ref53.ctx;var shape=_ref54.shape,lineWidth=_ref54.style.lineWidth;ctx.beginPath();var points=shape.points,close=shape.close;if(lineWidth===1)points=(0,_util.eliminateBlur)(points);(0,_canvas.drawPolylinePath)(ctx,points);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref55){var shape=_ref55.shape,style=_ref55.style;var points=shape.points,close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,points)}else{return(0,_util.checkPointIsNearPolyline)(position,points,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref56){var shape=_ref56.shape,style=_ref56.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref57,_ref58){var movementX=_ref57.movementX,movementY=_ref57.movementY;var shape=_ref58.shape;var points=shape.points;var moveAfterPoints=points.map(function(_ref59){var _ref60=(0,_slicedToArray2["default"])(_ref59,2),x=_ref60[0],y=_ref60[1];return[x+movementX,y+movementY]});this.attr("shape",{points:moveAfterPoints})}};exports.polyline=polyline;var smoothline={shape:{points:[],close:false},validator:function validator(_ref61){var shape=_ref61.shape;var points=shape.points;if(!(points instanceof Array)){console.error("Smoothline points should be an array!");return false}return true},draw:function draw(_ref62,_ref63){var ctx=_ref62.ctx;var shape=_ref63.shape,cache=_ref63.cache;var points=shape.points,close=shape.close;if(!cache.points||cache.points.toString()!==points.toString()){var _bezierCurve=polylineToBezierCurve(points,close);var hoverPoints=bezierCurveToPolyline(_bezierCurve);Object.assign(cache,{points:(0,_util.deepClone)(points,true),bezierCurve:_bezierCurve,hoverPoints:hoverPoints})}var bezierCurve=cache.bezierCurve;ctx.beginPath();(0,_canvas.drawBezierCurvePath)(ctx,bezierCurve.slice(1),bezierCurve[0]);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref64){var cache=_ref64.cache,shape=_ref64.shape,style=_ref64.style;var hoverPoints=cache.hoverPoints;var close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,hoverPoints)}else{return(0,_util.checkPointIsNearPolyline)(position,hoverPoints,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref65){var shape=_ref65.shape,style=_ref65.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref66,_ref67){var movementX=_ref66.movementX,movementY=_ref66.movementY;var shape=_ref67.shape,cache=_ref67.cache;var points=shape.points;var moveAfterPoints=points.map(function(_ref68){var _ref69=(0,_slicedToArray2["default"])(_ref68,2),x=_ref69[0],y=_ref69[1];return[x+movementX,y+movementY]});cache.points=moveAfterPoints;var _cache$bezierCurve$=(0,_slicedToArray2["default"])(cache.bezierCurve[0],2),fx=_cache$bezierCurve$[0],fy=_cache$bezierCurve$[1];var curves=cache.bezierCurve.slice(1);cache.bezierCurve=[[fx+movementX,fy+movementY]].concat((0,_toConsumableArray2["default"])(curves.map(function(curve){return curve.map(function(_ref70){var _ref71=(0,_slicedToArray2["default"])(_ref70,2),x=_ref71[0],y=_ref71[1];return[x+movementX,y+movementY]})})));cache.hoverPoints=cache.hoverPoints.map(function(_ref72){var _ref73=(0,_slicedToArray2["default"])(_ref72,2),x=_ref73[0],y=_ref73[1];return[x+movementX,y+movementY]});this.attr("shape",{points:moveAfterPoints})}};exports.smoothline=smoothline;var bezierCurve={shape:{points:[],close:false},validator:function validator(_ref74){var shape=_ref74.shape;var points=shape.points;if(!(points instanceof Array)){console.error("BezierCurve points should be an array!");return false}return true},draw:function draw(_ref75,_ref76){var ctx=_ref75.ctx;var shape=_ref76.shape,cache=_ref76.cache;var points=shape.points,close=shape.close;if(!cache.points||cache.points.toString()!==points.toString()){var hoverPoints=bezierCurveToPolyline(points,20);Object.assign(cache,{points:(0,_util.deepClone)(points,true),hoverPoints:hoverPoints})}ctx.beginPath();(0,_canvas.drawBezierCurvePath)(ctx,points.slice(1),points[0]);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref77){var cache=_ref77.cache,shape=_ref77.shape,style=_ref77.style;var hoverPoints=cache.hoverPoints;var close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,hoverPoints)}else{return(0,_util.checkPointIsNearPolyline)(position,hoverPoints,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref78){var shape=_ref78.shape,style=_ref78.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref79,_ref80){var movementX=_ref79.movementX,movementY=_ref79.movementY;var shape=_ref80.shape,cache=_ref80.cache;var points=shape.points;var _points$=(0,_slicedToArray2["default"])(points[0],2),fx=_points$[0],fy=_points$[1];var curves=points.slice(1);var bezierCurve=[[fx+movementX,fy+movementY]].concat((0,_toConsumableArray2["default"])(curves.map(function(curve){return curve.map(function(_ref81){var _ref82=(0,_slicedToArray2["default"])(_ref81,2),x=_ref82[0],y=_ref82[1];return[x+movementX,y+movementY]})})));cache.points=bezierCurve;cache.hoverPoints=cache.hoverPoints.map(function(_ref83){var _ref84=(0,_slicedToArray2["default"])(_ref83,2),x=_ref84[0],y=_ref84[1];return[x+movementX,y+movementY]});this.attr("shape",{points:bezierCurve})}};exports.bezierCurve=bezierCurve;var text={shape:{content:"",position:[],maxWidth:undefined,rowGap:0},validator:function validator(_ref85){var shape=_ref85.shape;var content=shape.content,position=shape.position,rowGap=shape.rowGap;if(typeof content!=="string"){console.error("Text content should be a string!");return false}if(!(position instanceof Array)){console.error("Text position should be an array!");return false}if(typeof rowGap!=="number"){console.error("Text rowGap should be a number!");return false}return true},draw:function draw(_ref86,_ref87){var ctx=_ref86.ctx;var shape=_ref87.shape;var content=shape.content,position=shape.position,maxWidth=shape.maxWidth,rowGap=shape.rowGap;var textBaseline=ctx.textBaseline,font=ctx.font;var fontSize=parseInt(font.replace(/\D/g,""));var _position=position,_position2=(0,_slicedToArray2["default"])(_position,2),x=_position2[0],y=_position2[1];content=content.split("\n");var rowNum=content.length;var lineHeight=fontSize+rowGap;var allHeight=rowNum*lineHeight-rowGap;var offset=0;if(textBaseline==="middle"){offset=allHeight/2;y+=fontSize/2}if(textBaseline==="bottom"){offset=allHeight;y+=fontSize}position=new Array(rowNum).fill(0).map(function(foo,i){return[x,y+i*lineHeight-offset]});ctx.beginPath();content.forEach(function(text,i){ctx.fillText.apply(ctx,[text].concat((0,_toConsumableArray2["default"])(position[i]),[maxWidth]));ctx.strokeText.apply(ctx,[text].concat((0,_toConsumableArray2["default"])(position[i]),[maxWidth]))});ctx.closePath()},hoverCheck:function hoverCheck(position,_ref88){var shape=_ref88.shape,style=_ref88.style;return false},setGraphCenter:function setGraphCenter(e,_ref89){var shape=_ref89.shape,style=_ref89.style;var position=shape.position;style.graphCenter=(0,_toConsumableArray2["default"])(position)},move:function move(_ref90,_ref91){var movementX=_ref90.movementX,movementY=_ref90.movementY;var shape=_ref91.shape;var _shape$position=(0,_slicedToArray2["default"])(shape.position,2),x=_shape$position[0],y=_shape$position[1];this.attr("shape",{position:[x+movementX,y+movementY]})}};exports.text=text;var graphs=new Map([["circle",circle],["ellipse",ellipse],["rect",rect],["ring",ring],["arc",arc],["sector",sector],["regPolygon",regPolygon],["polyline",polyline],["smoothline",smoothline],["bezierCurve",bezierCurve],["text",text]]);var _default=graphs;exports["default"]=_default;function extendNewGraph(name,config){if(!name||!config){console.error("ExtendNewGraph Missing Parameters!");return}if(!config.shape){console.error("Required attribute of shape to extendNewGraph!");return}if(!config.validator){console.error("Required function of validator to extendNewGraph!");return}if(!config.draw){console.error("Required function of draw to extendNewGraph!");return}graphs.set(name,config)}},{"../plugin/canvas":53,"../plugin/util":54,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/bezier-curve":47}],52:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CRender",{enumerable:true,get:function get(){return _crender["default"]}});Object.defineProperty(exports,"extendNewGraph",{enumerable:true,get:function get(){return _graphs.extendNewGraph}});exports["default"]=void 0;var _crender=_interopRequireDefault(require("./class/crender.class"));var _graphs=require("./config/graphs");var _default=_crender["default"];exports["default"]=_default},{"./class/crender.class":48,"./config/graphs":51,"@babel/runtime/helpers/interopRequireDefault":36}],53:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.drawPolylinePath=drawPolylinePath;exports.drawBezierCurvePath=drawBezierCurvePath;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));function drawPolylinePath(ctx,points){var beginPath=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var closePath=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(!ctx||points.length<2)return false;if(beginPath)ctx.beginPath();points.forEach(function(point,i){return point&&(i===0?ctx.moveTo.apply(ctx,(0,_toConsumableArray2["default"])(point)):ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(point)))});if(closePath)ctx.closePath()}function drawBezierCurvePath(ctx,points){var moveTo=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var beginPath=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var closePath=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(!ctx||!points)return false;if(beginPath)ctx.beginPath();if(moveTo)ctx.moveTo.apply(ctx,(0,_toConsumableArray2["default"])(moveTo));points.forEach(function(item){return item&&ctx.bezierCurveTo.apply(ctx,(0,_toConsumableArray2["default"])(item[0]).concat((0,_toConsumableArray2["default"])(item[1]),(0,_toConsumableArray2["default"])(item[2])))});if(closePath)ctx.closePath()}var _default={drawPolylinePath:drawPolylinePath,drawBezierCurvePath:drawBezierCurvePath};exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42}],54:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.deepClone=deepClone;exports.eliminateBlur=eliminateBlur;exports.checkPointIsInCircle=checkPointIsInCircle;exports.getTwoPointDistance=getTwoPointDistance;exports.checkPointIsInPolygon=checkPointIsInPolygon;exports.checkPointIsInSector=checkPointIsInSector;exports.checkPointIsNearPolyline=checkPointIsNearPolyline;exports.checkPointIsInRect=checkPointIsInRect;exports.getRotatePointPos=getRotatePointPos;exports.getScalePointPos=getScalePointPos;exports.getTranslatePointPos=getTranslatePointPos;exports.getDistanceBetweenPointAndLine=getDistanceBetweenPointAndLine;exports.getCircleRadianPoint=getCircleRadianPoint;exports.getRegularPolygonPoints=getRegularPolygonPoints;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var abs=Math.abs,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,max=Math.max,min=Math.min,PI=Math.PI;function deepClone(object){var recursion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!object)return object;var parse=JSON.parse,stringify=JSON.stringify;if(!recursion)return parse(stringify(object));var clonedObj=object instanceof Array?[]:{};if(object&&(0,_typeof2["default"])(object)==="object"){for(var key in object){if(object.hasOwnProperty(key)){if(object[key]&&(0,_typeof2["default"])(object[key])==="object"){clonedObj[key]=deepClone(object[key],true)}else{clonedObj[key]=object[key]}}}}return clonedObj}function eliminateBlur(points){return points.map(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),x=_ref2[0],y=_ref2[1];return[parseInt(x)+.5,parseInt(y)+.5]})}function checkPointIsInCircle(point,rx,ry,r){return getTwoPointDistance(point,[rx,ry])<=r}function getTwoPointDistance(_ref3,_ref4){var _ref5=(0,_slicedToArray2["default"])(_ref3,2),xa=_ref5[0],ya=_ref5[1];var _ref6=(0,_slicedToArray2["default"])(_ref4,2),xb=_ref6[0],yb=_ref6[1];var minusX=abs(xa-xb);var minusY=abs(ya-yb);return sqrt(minusX*minusX+minusY*minusY)}function checkPointIsInPolygon(point,polygon){var counter=0;var _point=(0,_slicedToArray2["default"])(point,2),x=_point[0],y=_point[1];var pointNum=polygon.length;for(var i=1,p1=polygon[0];i<=pointNum;i++){var p2=polygon[i%pointNum];if(x>min(p1[0],p2[0])&&x<=max(p1[0],p2[0])){if(y<=max(p1[1],p2[1])){if(p1[0]!==p2[0]){var xinters=(x-p1[0])*(p2[1]-p1[1])/(p2[0]-p1[0])+p1[1];if(p1[1]===p2[1]||y<=xinters){counter++}}}}p1=p2}return counter%2===1}function checkPointIsInSector(point,rx,ry,r,startAngle,endAngle,clockWise){if(!point)return false;if(getTwoPointDistance(point,[rx,ry])>r)return false;if(!clockWise){var _deepClone=deepClone([endAngle,startAngle]);var _deepClone2=(0,_slicedToArray2["default"])(_deepClone,2);startAngle=_deepClone2[0];endAngle=_deepClone2[1]}var reverseBE=startAngle>endAngle;if(reverseBE){var _ref7=[endAngle,startAngle];startAngle=_ref7[0];endAngle=_ref7[1]}var minus=endAngle-startAngle;if(minus>=PI*2)return true;var _point2=(0,_slicedToArray2["default"])(point,2),x=_point2[0],y=_point2[1];var _getCircleRadianPoint=getCircleRadianPoint(rx,ry,r,startAngle),_getCircleRadianPoint2=(0,_slicedToArray2["default"])(_getCircleRadianPoint,2),bx=_getCircleRadianPoint2[0],by=_getCircleRadianPoint2[1];var _getCircleRadianPoint3=getCircleRadianPoint(rx,ry,r,endAngle),_getCircleRadianPoint4=(0,_slicedToArray2["default"])(_getCircleRadianPoint3,2),ex=_getCircleRadianPoint4[0],ey=_getCircleRadianPoint4[1];var vPoint=[x-rx,y-ry];var vBArm=[bx-rx,by-ry];var vEArm=[ex-rx,ey-ry];var reverse=minus>PI;if(reverse){var _deepClone3=deepClone([vEArm,vBArm]);var _deepClone4=(0,_slicedToArray2["default"])(_deepClone3,2);vBArm=_deepClone4[0];vEArm=_deepClone4[1]}var inSector=isClockWise(vBArm,vPoint)&&!isClockWise(vEArm,vPoint);if(reverse)inSector=!inSector;if(reverseBE)inSector=!inSector;return inSector}function isClockWise(vArm,vPoint){var _vArm=(0,_slicedToArray2["default"])(vArm,2),ax=_vArm[0],ay=_vArm[1];var _vPoint=(0,_slicedToArray2["default"])(vPoint,2),px=_vPoint[0],py=_vPoint[1];return-ay*px+ax*py>0}function checkPointIsNearPolyline(point,polyline,lineWidth){var halfLineWidth=lineWidth/2;var moveUpPolyline=polyline.map(function(_ref8){var _ref9=(0,_slicedToArray2["default"])(_ref8,2),x=_ref9[0],y=_ref9[1];return[x,y-halfLineWidth]});var moveDownPolyline=polyline.map(function(_ref10){var _ref11=(0,_slicedToArray2["default"])(_ref10,2),x=_ref11[0],y=_ref11[1];return[x,y+halfLineWidth]});var polygon=[].concat((0,_toConsumableArray2["default"])(moveUpPolyline),(0,_toConsumableArray2["default"])(moveDownPolyline.reverse()));return checkPointIsInPolygon(point,polygon)}function checkPointIsInRect(_ref12,x,y,width,height){var _ref13=(0,_slicedToArray2["default"])(_ref12,2),px=_ref13[0],py=_ref13[1];if(pxx+width)return false;if(py>y+height)return false;return true}function getRotatePointPos(){var rotate=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var point=arguments.length>1?arguments[1]:undefined;var origin=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[0,0];if(!point)return false;if(rotate%360===0)return point;var _point3=(0,_slicedToArray2["default"])(point,2),x=_point3[0],y=_point3[1];var _origin=(0,_slicedToArray2["default"])(origin,2),ox=_origin[0],oy=_origin[1];rotate*=PI/180;return[(x-ox)*cos(rotate)-(y-oy)*sin(rotate)+ox,(x-ox)*sin(rotate)+(y-oy)*cos(rotate)+oy]}function getScalePointPos(){var scale=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[1,1];var point=arguments.length>1?arguments[1]:undefined;var origin=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[0,0];if(!point)return false;if(scale===1)return point;var _point4=(0,_slicedToArray2["default"])(point,2),x=_point4[0],y=_point4[1];var _origin2=(0,_slicedToArray2["default"])(origin,2),ox=_origin2[0],oy=_origin2[1];var _scale=(0,_slicedToArray2["default"])(scale,2),xs=_scale[0],ys=_scale[1];var relativePosX=x-ox;var relativePosY=y-oy;return[relativePosX*xs+ox,relativePosY*ys+oy]}function getTranslatePointPos(translate,point){if(!translate||!point)return false;var _point5=(0,_slicedToArray2["default"])(point,2),x=_point5[0],y=_point5[1];var _translate=(0,_slicedToArray2["default"])(translate,2),tx=_translate[0],ty=_translate[1];return[x+tx,y+ty]}function getDistanceBetweenPointAndLine(point,lineBegin,lineEnd){if(!point||!lineBegin||!lineEnd)return false;var _point6=(0,_slicedToArray2["default"])(point,2),x=_point6[0],y=_point6[1];var _lineBegin=(0,_slicedToArray2["default"])(lineBegin,2),x1=_lineBegin[0],y1=_lineBegin[1];var _lineEnd=(0,_slicedToArray2["default"])(lineEnd,2),x2=_lineEnd[0],y2=_lineEnd[1];var a=y2-y1;var b=x1-x2;var c=y1*(x2-x1)-x1*(y2-y1);var molecule=abs(a*x+b*y+c);var denominator=sqrt(a*a+b*b);return molecule/denominator}function getCircleRadianPoint(x,y,radius,radian){return[x+cos(radian)*radius,y+sin(radian)*radius]}function getRegularPolygonPoints(rx,ry,r,side){var minus=arguments.length>4&&arguments[4]!==undefined?arguments[4]:PI*-.5;var radianGap=PI*2/side;var radians=new Array(side).fill("").map(function(t,i){return i*radianGap+minus});return radians.map(function(radian){return getCircleRadianPoint(rx,ry,r,radian)})}var _default={deepClone:deepClone,eliminateBlur:eliminateBlur,checkPointIsInCircle:checkPointIsInCircle,checkPointIsInPolygon:checkPointIsInPolygon,checkPointIsInSector:checkPointIsInSector,checkPointIsNearPolyline:checkPointIsNearPolyline,getTwoPointDistance:getTwoPointDistance,getRotatePointPos:getRotatePointPos,getScalePointPos:getScalePointPos,getTranslatePointPos:getTranslatePointPos,getCircleRadianPoint:getCircleRadianPoint,getRegularPolygonPoints:getRegularPolygonPoints,getDistanceBetweenPointAndLine:getDistanceBetweenPointAndLine};exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43}],55:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _default=new Map([["transparent","rgba(0,0,0,0)"],["black","#000000"],["silver","#C0C0C0"],["gray","#808080"],["white","#FFFFFF"],["maroon","#800000"],["red","#FF0000"],["purple","#800080"],["fuchsia","#FF00FF"],["green","#008000"],["lime","#00FF00"],["olive","#808000"],["yellow","#FFFF00"],["navy","#000080"],["blue","#0000FF"],["teal","#008080"],["aqua","#00FFFF"],["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["blanchedalmond","#ffebcd"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["oldlace","#fdf5e6"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["whitesmoke","#f5f5f5"],["yellowgreen","#9acd32"]]);exports["default"]=_default},{}],56:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getRgbValue=getRgbValue;exports.getRgbaValue=getRgbaValue;exports.getOpacity=getOpacity;exports.toRgb=toRgb;exports.toHex=toHex;exports.getColorFromRgbValue=getColorFromRgbValue;exports.darken=darken;exports.lighten=lighten;exports.fade=fade;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _keywords=_interopRequireDefault(require("./config/keywords"));var hexReg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;var rgbReg=/^(rgb|rgba|RGB|RGBA)/;var rgbaReg=/^(rgba|RGBA)/;function validator(color){var isHex=hexReg.test(color);var isRgb=rgbReg.test(color);if(isHex||isRgb)return color;color=getColorByKeyword(color);if(!color){console.error("Color: Invalid color!");return false}return color}function getColorByKeyword(keyword){if(!keyword){console.error("getColorByKeywords: Missing parameters!");return false}if(!_keywords["default"].has(keyword))return false;return _keywords["default"].get(keyword)}function getRgbValue(color){if(!color){console.error("getRgbValue: Missing parameters!");return false}color=validator(color);if(!color)return false;var isHex=hexReg.test(color);var isRgb=rgbReg.test(color);var lowerColor=color.toLowerCase();if(isHex)return getRgbValueFromHex(lowerColor);if(isRgb)return getRgbValueFromRgb(lowerColor)}function getRgbValueFromHex(color){color=color.replace("#","");if(color.length===3)color=Array.from(color).map(function(hexNum){return hexNum+hexNum}).join("");color=color.split("");return new Array(3).fill(0).map(function(t,i){return parseInt("0x".concat(color[i*2]).concat(color[i*2+1]))})}function getRgbValueFromRgb(color){return color.replace(/rgb\(|rgba\(|\)/g,"").split(",").slice(0,3).map(function(n){return parseInt(n)})}function getRgbaValue(color){if(!color){console.error("getRgbaValue: Missing parameters!");return false}var colorValue=getRgbValue(color);if(!colorValue)return false;colorValue.push(getOpacity(color));return colorValue}function getOpacity(color){if(!color){console.error("getOpacity: Missing parameters!");return false}color=validator(color);if(!color)return false;var isRgba=rgbaReg.test(color);if(!isRgba)return 1;color=color.toLowerCase();return Number(color.split(",").slice(-1)[0].replace(/[)|\s]/g,""))}function toRgb(color,opacity){if(!color){console.error("toRgb: Missing parameters!");return false}var rgbValue=getRgbValue(color);if(!rgbValue)return false;var addOpacity=typeof opacity==="number";if(addOpacity)return"rgba("+rgbValue.join(",")+",".concat(opacity,")");return"rgb("+rgbValue.join(",")+")"}function toHex(color){if(!color){console.error("toHex: Missing parameters!");return false}if(hexReg.test(color))return color;color=getRgbValue(color);if(!color)return false;return"#"+color.map(function(n){return Number(n).toString(16)}).map(function(n){return n==="0"?"00":n}).join("")}function getColorFromRgbValue(value){if(!value){console.error("getColorFromRgbValue: Missing parameters!");return false}var valueLength=value.length;if(valueLength!==3&&valueLength!==4){console.error("getColorFromRgbValue: Value is illegal!");return false}var color=valueLength===3?"rgb(":"rgba(";color+=value.join(",")+")";return color}function darken(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!color){console.error("darken: Missing parameters!");return false}var rgbaValue=getRgbaValue(color);if(!rgbaValue)return false;rgbaValue=rgbaValue.map(function(v,i){return i===3?v:v-Math.ceil(2.55*percent)}).map(function(v){return v<0?0:v});return getColorFromRgbValue(rgbaValue)}function lighten(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!color){console.error("lighten: Missing parameters!");return false}var rgbaValue=getRgbaValue(color);if(!rgbaValue)return false;rgbaValue=rgbaValue.map(function(v,i){return i===3?v:v+Math.ceil(2.55*percent)}).map(function(v){return v>255?255:v});return getColorFromRgbValue(rgbaValue)}function fade(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;if(!color){console.error("fade: Missing parameters!");return false}var rgbValue=getRgbValue(color);if(!rgbValue)return false;var rgbaValue=[].concat((0,_toConsumableArray2["default"])(rgbValue),[percent/100]);return getColorFromRgbValue(rgbaValue)}var _default={fade:fade,toHex:toHex,toRgb:toRgb,darken:darken,lighten:lighten,getOpacity:getOpacity,getRgbValue:getRgbValue,getRgbaValue:getRgbaValue,getColorFromRgbValue:getColorFromRgbValue};exports["default"]=_default},{"./config/keywords":55,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42}],57:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=exports.easeInOutBounce=exports.easeOutBounce=exports.easeInBounce=exports.easeInOutElastic=exports.easeOutElastic=exports.easeInElastic=exports.easeInOutBack=exports.easeOutBack=exports.easeInBack=exports.easeInOutQuint=exports.easeOutQuint=exports.easeInQuint=exports.easeInOutQuart=exports.easeOutQuart=exports.easeInQuart=exports.easeInOutCubic=exports.easeOutCubic=exports.easeInCubic=exports.easeInOutQuad=exports.easeOutQuad=exports.easeInQuad=exports.easeInOutSine=exports.easeOutSine=exports.easeInSine=exports.linear=void 0;var linear=[[[0,1],"",[.33,.67]],[[1,0],[.67,.33]]];exports.linear=linear;var easeInSine=[[[0,1]],[[.538,.564],[.169,.912],[.88,.196]],[[1,0]]];exports.easeInSine=easeInSine;var easeOutSine=[[[0,1]],[[.444,.448],[.169,.736],[.718,.16]],[[1,0]]];exports.easeOutSine=easeOutSine;var easeInOutSine=[[[0,1]],[[.5,.5],[.2,1],[.8,0]],[[1,0]]];exports.easeInOutSine=easeInOutSine;var easeInQuad=[[[0,1]],[[.55,.584],[.231,.904],[.868,.264]],[[1,0]]];exports.easeInQuad=easeInQuad;var easeOutQuad=[[[0,1]],[[.413,.428],[.065,.816],[.76,.04]],[[1,0]]];exports.easeOutQuad=easeOutQuad;var easeInOutQuad=[[[0,1]],[[.5,.5],[.3,.9],[.7,.1]],[[1,0]]];exports.easeInOutQuad=easeInOutQuad;var easeInCubic=[[[0,1]],[[.679,.688],[.366,.992],[.992,.384]],[[1,0]]];exports.easeInCubic=easeInCubic;var easeOutCubic=[[[0,1]],[[.321,.312],[.008,.616],[.634,.008]],[[1,0]]];exports.easeOutCubic=easeOutCubic;var easeInOutCubic=[[[0,1]],[[.5,.5],[.3,1],[.7,0]],[[1,0]]];exports.easeInOutCubic=easeInOutCubic;var easeInQuart=[[[0,1]],[[.812,.74],[.611,.988],[1.013,.492]],[[1,0]]];exports.easeInQuart=easeInQuart;var easeOutQuart=[[[0,1]],[[.152,.244],[.001,.448],[.285,-.02]],[[1,0]]];exports.easeOutQuart=easeOutQuart;var easeInOutQuart=[[[0,1]],[[.5,.5],[.4,1],[.6,0]],[[1,0]]];exports.easeInOutQuart=easeInOutQuart;var easeInQuint=[[[0,1]],[[.857,.856],[.714,1],[1,.712]],[[1,0]]];exports.easeInQuint=easeInQuint;var easeOutQuint=[[[0,1]],[[.108,.2],[.001,.4],[.214,-.012]],[[1,0]]];exports.easeOutQuint=easeOutQuint;var easeInOutQuint=[[[0,1]],[[.5,.5],[.5,1],[.5,0]],[[1,0]]];exports.easeInOutQuint=easeInOutQuint;var easeInBack=[[[0,1]],[[.667,.896],[.38,1.184],[.955,.616]],[[1,0]]];exports.easeInBack=easeInBack;var easeOutBack=[[[0,1]],[[.335,.028],[.061,.22],[.631,-.18]],[[1,0]]];exports.easeOutBack=easeOutBack;var easeInOutBack=[[[0,1]],[[.5,.5],[.4,1.4],[.6,-.4]],[[1,0]]];exports.easeInOutBack=easeInOutBack;var easeInElastic=[[[0,1]],[[.474,.964],[.382,.988],[.557,.952]],[[.619,1.076],[.565,1.088],[.669,1.08]],[[.77,.916],[.712,.924],[.847,.904]],[[.911,1.304],[.872,1.316],[.961,1.34]],[[1,0]]];exports.easeInElastic=easeInElastic;var easeOutElastic=[[[0,1]],[[.073,-.32],[.034,-.328],[.104,-.344]],[[.191,.092],[.11,.06],[.256,.08]],[[.31,-.076],[.26,-.068],[.357,-.076]],[[.432,.032],[.362,.028],[.683,-.004]],[[1,0]]];exports.easeOutElastic=easeOutElastic;var easeInOutElastic=[[[0,1]],[[.21,.94],[.167,.884],[.252,.98]],[[.299,1.104],[.256,1.092],[.347,1.108]],[[.5,.496],[.451,.672],[.548,.324]],[[.696,-.108],[.652,-.112],[.741,-.124]],[[.805,.064],[.756,.012],[.866,.096]],[[1,0]]];exports.easeInOutElastic=easeInOutElastic;var easeInBounce=[[[0,1]],[[.148,1],[.075,.868],[.193,.848]],[[.326,1],[.276,.836],[.405,.712]],[[.6,1],[.511,.708],[.671,.348]],[[1,0]]];exports.easeInBounce=easeInBounce;var easeOutBounce=[[[0,1]],[[.357,.004],[.27,.592],[.376,.252]],[[.604,-.004],[.548,.312],[.669,.184]],[[.82,0],[.749,.184],[.905,.132]],[[1,0]]];exports.easeOutBounce=easeOutBounce;var easeInOutBounce=[[[0,1]],[[.102,1],[.05,.864],[.117,.86]],[[.216,.996],[.208,.844],[.227,.808]],[[.347,.996],[.343,.8],[.48,.292]],[[.635,.004],[.511,.676],[.656,.208]],[[.787,0],[.76,.2],[.795,.144]],[[.905,-.004],[.899,.164],[.944,.144]],[[1,0]]];exports.easeInOutBounce=easeInOutBounce;var _default=new Map([["linear",linear],["easeInSine",easeInSine],["easeOutSine",easeOutSine],["easeInOutSine",easeInOutSine],["easeInQuad",easeInQuad],["easeOutQuad",easeOutQuad],["easeInOutQuad",easeInOutQuad],["easeInCubic",easeInCubic],["easeOutCubic",easeOutCubic],["easeInOutCubic",easeInOutCubic],["easeInQuart",easeInQuart],["easeOutQuart",easeOutQuart],["easeInOutQuart",easeInOutQuart],["easeInQuint",easeInQuint],["easeOutQuint",easeOutQuint],["easeInOutQuint",easeInOutQuint],["easeInBack",easeInBack],["easeOutBack",easeOutBack],["easeInOutBack",easeInOutBack],["easeInElastic",easeInElastic],["easeOutElastic",easeOutElastic],["easeInOutElastic",easeInOutElastic],["easeInBounce",easeInBounce],["easeOutBounce",easeOutBounce],["easeInOutBounce",easeInOutBounce]]);exports["default"]=_default},{}],58:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.transition=transition;exports.injectNewCurve=injectNewCurve;exports["default"]=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _curves=_interopRequireDefault(require("./config/curves"));var defaultTransitionBC="linear";function transition(tBC){var startState=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var endState=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var frameNum=arguments.length>3&&arguments[3]!==undefined?arguments[3]:30;var deep=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(!checkParams.apply(void 0,arguments))return false;try{var bezierCurve=getBezierCurve(tBC);var frameStateProgress=getFrameStateProgress(bezierCurve,frameNum);if(!deep||typeof endState==="number")return getTransitionState(startState,endState,frameStateProgress);return recursionTransitionState(startState,endState,frameStateProgress)}catch(_unused){console.warn("Transition parameter may be abnormal!");return[endState]}}function checkParams(tBC){var startState=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var endState=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var frameNum=arguments.length>3&&arguments[3]!==undefined?arguments[3]:30;if(!tBC||startState===false||endState===false||!frameNum){console.error("transition: Missing Parameters!");return false}if((0,_typeof2["default"])(startState)!==(0,_typeof2["default"])(endState)){console.error("transition: Inconsistent Status Types!");return false}var stateType=(0,_typeof2["default"])(endState);if(stateType==="string"||stateType==="boolean"||!tBC.length){console.error("transition: Unsupported Data Type of State!");return false}if(!_curves["default"].has(tBC)&&!(tBC instanceof Array)){console.warn("transition: Transition curve not found, default curve will be used!")}return true}function getBezierCurve(tBC){var bezierCurve="";if(_curves["default"].has(tBC)){bezierCurve=_curves["default"].get(tBC)}else if(tBC instanceof Array){bezierCurve=tBC}else{bezierCurve=_curves["default"].get(defaultTransitionBC)}return bezierCurve}function getFrameStateProgress(bezierCurve,frameNum){var tMinus=1/(frameNum-1);var tState=new Array(frameNum).fill(0).map(function(t,i){return i*tMinus});var frameState=tState.map(function(t){return getFrameStateFromT(bezierCurve,t)});return frameState}function getFrameStateFromT(bezierCurve,t){var tBezierCurvePoint=getBezierCurvePointFromT(bezierCurve,t);var bezierCurvePointT=getBezierCurvePointTFromReT(tBezierCurvePoint,t);return getBezierCurveTState(tBezierCurvePoint,bezierCurvePointT)}function getBezierCurvePointFromT(bezierCurve,t){var lastIndex=bezierCurve.length-1;var begin="",end="";bezierCurve.findIndex(function(item,i){if(i===lastIndex)return;begin=item;end=bezierCurve[i+1];var currentMainPointX=begin[0][0];var nextMainPointX=end[0][0];return t>=currentMainPointX&&t=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){this.complete(entry.completion,entry.afterLoc);resetTryEntry(entry);return ContinueSentinel}}},catch:function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};if(this.method==="next"){this.arg=undefined}return ContinueSentinel}};return exports}(typeof module==="object"?module.exports:{});try{regeneratorRuntime=runtime}catch(accidentalStrictMode){Function("r","regeneratorRuntime = r")(runtime)}},{}]},{},[1]); \ No newline at end of file +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i1&&arguments[1]!==undefined?arguments[1]:false;if(!option||(0,_typeof2["default"])(option)!=="object"){console.error("setOption Missing parameters!");return false}if(animationEnd)this.render.graphs.forEach(function(graph){return graph.animationEnd()});var optionCloned=(0,_util.deepClone)(option,true);(0,_core.mergeColor)(this,optionCloned);(0,_core.grid)(this,optionCloned);(0,_core.axis)(this,optionCloned);(0,_core.radarAxis)(this,optionCloned);(0,_core.title)(this,optionCloned);(0,_core.bar)(this,optionCloned);(0,_core.line)(this,optionCloned);(0,_core.pie)(this,optionCloned);(0,_core.radar)(this,optionCloned);(0,_core.gauge)(this,optionCloned);(0,_core.legend)(this,optionCloned);this.option=option;this.render.launchAnimation()};Charts.prototype.resize=function(){var container=this.container,canvas=this.canvas,render=this.render,option=this.option;var clientWidth=container.clientWidth,clientHeight=container.clientHeight;canvas.setAttribute("width",clientWidth);canvas.setAttribute("height",clientHeight);render.area=[clientWidth,clientHeight];this.setOption(option)}},{"../core":20,"../extend/index":28,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/plugin/util":54}],3:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.doUpdate=doUpdate;exports.Updater=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var Updater=function Updater(config,series){(0,_classCallCheck2["default"])(this,Updater);var chart=config.chart,key=config.key,getGraphConfig=config.getGraphConfig;if(typeof getGraphConfig!=="function"){console.warn("Updater need function getGraphConfig!");return}if(!chart[key])this.graphs=chart[key]=[];Object.assign(this,config);this.update(series)};exports.Updater=Updater;Updater.prototype.update=function(series){var _this=this;var graphs=this.graphs,beforeUpdate=this.beforeUpdate;delRedundanceGraph(this,series);if(!series.length)return;var beforeUpdateType=(0,_typeof2["default"])(beforeUpdate);series.forEach(function(seriesItem,i){if(beforeUpdateType==="function")beforeUpdate(graphs,seriesItem,i,_this);var cache=graphs[i];if(cache){changeGraphs(cache,seriesItem,i,_this)}else{addGraphs(graphs,seriesItem,i,_this)}})};function delRedundanceGraph(updater,series){var graphs=updater.graphs,render=updater.chart.render;var cacheGraphNum=graphs.length;var needGraphNum=series.length;if(cacheGraphNum>needGraphNum){var needDelGraphs=graphs.splice(needGraphNum);needDelGraphs.forEach(function(item){return item.forEach(function(g){return render.delGraph(g)})})}}function changeGraphs(cache,seriesItem,i,updater){var getGraphConfig=updater.getGraphConfig,render=updater.chart.render,beforeChange=updater.beforeChange;var configs=getGraphConfig(seriesItem,updater);balanceGraphsNum(cache,configs,render);cache.forEach(function(graph,j){var config=configs[j];if(typeof beforeChange==="function")beforeChange(graph,config);updateGraphConfigByKey(graph,config)})}function balanceGraphsNum(graphs,graphConfig,render){var cacheGraphNum=graphs.length;var needGraphNum=graphConfig.length;if(needGraphNum>cacheGraphNum){var lastCacheGraph=graphs.slice(-1)[0];var needAddGraphNum=needGraphNum-cacheGraphNum;var needAddGraphs=new Array(needAddGraphNum).fill(0).map(function(foo){return render.clone(lastCacheGraph)});graphs.push.apply(graphs,(0,_toConsumableArray2["default"])(needAddGraphs))}else if(needGraphNum0&&arguments[0]!==undefined?arguments[0]:{},chart=_ref.chart,series=_ref.series,key=_ref.key,getGraphConfig=_ref.getGraphConfig,getStartGraphConfig=_ref.getStartGraphConfig,beforeChange=_ref.beforeChange,beforeUpdate=_ref.beforeUpdate,afterAddGraph=_ref.afterAddGraph;if(chart[key]){chart[key].update(series)}else{chart[key]=new Updater({chart:chart,key:key,getGraphConfig:getGraphConfig,getStartGraphConfig:getStartGraphConfig,beforeChange:beforeChange,beforeUpdate:beforeUpdate,afterAddGraph:afterAddGraph},series)}}},{"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.yAxisConfig=exports.xAxisConfig=void 0;var xAxisConfig={name:"",show:true,position:"bottom",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:false,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.xAxisConfig=xAxisConfig;var yAxisConfig={name:"",show:true,position:"left",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:true,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.yAxisConfig=yAxisConfig},{}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.barConfig=void 0;var barConfig={show:true,name:"",stack:"",shapeType:"normal",echelonOffset:10,barWidth:"auto",barGap:"30%",barCategoryGap:"20%",xAxisIndex:0,yAxisIndex:0,data:[],backgroundBar:{show:false,width:"auto",style:{fill:"rgba(200, 200, 200, .4)"}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},gradient:{color:[],local:true},barStyle:{},independentColor:false,independentColors:[],rLevel:0,animationCurve:"easeOutCubic",animationFrame:50};exports.barConfig=barConfig},{}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.colorConfig=void 0;var colorConfig=["#37a2da","#32c5e9","#67e0e3","#9fe6b8","#ffdb5c","#ff9f7f","#fb7293","#e062ae","#e690d1","#e7bcf3","#9d96f5","#8378ea","#96bfff"];exports.colorConfig=colorConfig},{}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gaugeConfig=void 0;var gaugeConfig={show:true,name:"",radius:"60%",center:["50%","50%"],startAngle:-(Math.PI/4)*5,endAngle:Math.PI/4,min:0,max:100,splitNum:5,arcLineWidth:15,data:[],dataItemStyle:{},axisTick:{show:true,tickLength:6,style:{stroke:"#999",lineWidth:1}},axisLabel:{show:true,data:[],formatter:null,labelGap:5,style:{}},pointer:{show:true,valueIndex:0,style:{scale:[1,1],fill:"#fb7293"}},details:{show:false,formatter:null,offset:[0,0],valueToFixed:0,position:"center",style:{fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle"}},backgroundArc:{show:true,style:{stroke:"#e0e0e0"}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.gaugeConfig=gaugeConfig},{}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gridConfig=void 0;var gridConfig={left:"10%",right:"10%",top:60,bottom:60,style:{fill:"rgba(0, 0, 0, 0)"},rLevel:-30,animationCurve:"easeOutCubic",animationFrame:30};exports.gridConfig=gridConfig},{}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.changeDefaultConfig=changeDefaultConfig;Object.defineProperty(exports,"colorConfig",{enumerable:true,get:function get(){return _color.colorConfig}});Object.defineProperty(exports,"gridConfig",{enumerable:true,get:function get(){return _grid.gridConfig}});Object.defineProperty(exports,"xAxisConfig",{enumerable:true,get:function get(){return _axis.xAxisConfig}});Object.defineProperty(exports,"yAxisConfig",{enumerable:true,get:function get(){return _axis.yAxisConfig}});Object.defineProperty(exports,"titleConfig",{enumerable:true,get:function get(){return _title.titleConfig}});Object.defineProperty(exports,"lineConfig",{enumerable:true,get:function get(){return _line.lineConfig}});Object.defineProperty(exports,"barConfig",{enumerable:true,get:function get(){return _bar.barConfig}});Object.defineProperty(exports,"pieConfig",{enumerable:true,get:function get(){return _pie.pieConfig}});Object.defineProperty(exports,"radarAxisConfig",{enumerable:true,get:function get(){return _radarAxis.radarAxisConfig}});Object.defineProperty(exports,"radarConfig",{enumerable:true,get:function get(){return _radar.radarConfig}});Object.defineProperty(exports,"gaugeConfig",{enumerable:true,get:function get(){return _gauge.gaugeConfig}});Object.defineProperty(exports,"legendConfig",{enumerable:true,get:function get(){return _legend.legendConfig}});exports.keys=void 0;var _color=require("./color");var _grid=require("./grid");var _axis=require("./axis");var _title=require("./title");var _line=require("./line");var _bar=require("./bar");var _pie=require("./pie");var _radarAxis=require("./radarAxis");var _radar=require("./radar");var _gauge=require("./gauge");var _legend=require("./legend");var _util=require("../util");var allConfig={colorConfig:_color.colorConfig,gridConfig:_grid.gridConfig,xAxisConfig:_axis.xAxisConfig,yAxisConfig:_axis.yAxisConfig,titleConfig:_title.titleConfig,lineConfig:_line.lineConfig,barConfig:_bar.barConfig,pieConfig:_pie.pieConfig,radarAxisConfig:_radarAxis.radarAxisConfig,radarConfig:_radar.radarConfig,gaugeConfig:_gauge.gaugeConfig,legendConfig:_legend.legendConfig};function changeDefaultConfig(key,config){if(!allConfig["".concat(key,"Config")]){console.warn("Change default config Error - Invalid key!");return}(0,_util.deepMerge)(allConfig["".concat(key,"Config")],config)}var keys=["color","title","legend","xAxis","yAxis","grid","radarAxis","line","bar","pie","radar","gauge"];exports.keys=keys},{"../util":30,"./axis":4,"./bar":5,"./color":6,"./gauge":7,"./grid":8,"./legend":10,"./line":11,"./pie":12,"./radar":13,"./radarAxis":14,"./title":15}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.legendConfig=void 0;var legendConfig={show:true,orient:"horizontal",left:"auto",right:"auto",top:"auto",bottom:"auto",itemGap:10,iconWidth:25,iconHeight:10,selectAble:true,data:[],textStyle:{fontFamily:"Arial",fontSize:13,fill:"#000"},iconStyle:{},textUnselectedStyle:{fontFamily:"Arial",fontSize:13,fill:"#999"},iconUnselectedStyle:{fill:"#999"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.legendConfig=legendConfig},{}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.lineConfig=void 0;var lineConfig={show:true,name:"",stack:"",smooth:false,xAxisIndex:0,yAxisIndex:0,data:[],lineStyle:{lineWidth:1},linePoint:{show:true,radius:2,style:{fill:"#fff",lineWidth:1}},lineArea:{show:false,gradient:[],style:{opacity:.5}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.lineConfig=lineConfig},{}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.pieConfig=void 0;var pieConfig={show:true,name:"",radius:"50%",center:["50%","50%"],startAngle:-Math.PI/2,roseType:false,roseSort:true,roseIncrement:"auto",data:[],insideLabel:{show:false,formatter:"{percent}%",style:{fontSize:10,fill:"#fff",textAlign:"center",textBaseline:"middle"}},outsideLabel:{show:true,formatter:"{name}",style:{fontSize:11},labelLineBendGap:"20%",labelLineEndLength:50,labelLineStyle:{lineWidth:1}},pieStyle:{},percentToFixed:0,rLevel:10,animationDelayGap:60,animationCurve:"easeOutCubic",startAnimationCurve:"easeOutBack",animationFrame:50};exports.pieConfig=pieConfig},{}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarConfig=void 0;var radarConfig={show:true,name:"",data:[],radarStyle:{lineWidth:1},point:{show:true,radius:2,style:{fill:"#fff"}},label:{show:true,offset:[0,0],labelGap:5,formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarConfig=radarConfig},{}],14:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarAxisConfig=void 0;var radarAxisConfig={show:true,center:["50%","50%"],radius:"65%",startAngle:-Math.PI/2,splitNum:5,polygon:false,axisLabel:{show:true,labelGap:15,color:[],style:{fill:"#333"}},axisLine:{show:true,color:[],style:{stroke:"#999",lineWidth:1}},splitLine:{show:true,color:[],style:{stroke:"#d4d4d4",lineWidth:1}},splitArea:{show:false,color:["#f5f5f5","#e6e6e6"],style:{}},rLevel:-10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarAxisConfig=radarAxisConfig},{}],15:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.titleConfig=void 0;var titleConfig={show:true,text:"",offset:[0,-20],style:{fill:"#333",fontSize:17,fontWeight:"bold",textAlign:"center",textBaseline:"bottom"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.titleConfig=titleConfig},{}],16:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.axis=axis;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _config=require("../config");var _util=require("../util");var _util2=require("@jiaminghi/c-render/lib/plugin/util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var allAxis=[];if(xAxis&&yAxis&&series){allAxis=getAllAxis(xAxis,yAxis);allAxis=mergeDefaultAxisConfig(allAxis);allAxis=allAxis.filter(function(_ref){var show=_ref.show;return show});allAxis=mergeDefaultBoundaryGap(allAxis);allAxis=calcAxisLabelData(allAxis,series);allAxis=setAxisPosition(allAxis);allAxis=calcAxisLinePosition(allAxis,chart);allAxis=calcAxisTickPosition(allAxis,chart);allAxis=calcAxisNamePosition(allAxis,chart);allAxis=calcSplitLinePosition(allAxis,chart)}(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLine",getGraphConfig:getLineConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisTick",getGraphConfig:getTickConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLabel",getGraphConfig:getLabelConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisName",getGraphConfig:getNameConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"splitLine",getGraphConfig:getSplitLineConfig});chart.axisData=allAxis}function getAllAxis(xAxis,yAxis){var allXAxis=[],allYAxis=[];if(xAxis instanceof Array){var _allXAxis;(_allXAxis=allXAxis).push.apply(_allXAxis,(0,_toConsumableArray2["default"])(xAxis))}else{allXAxis.push(xAxis)}if(yAxis instanceof Array){var _allYAxis;(_allYAxis=allYAxis).push.apply(_allYAxis,(0,_toConsumableArray2["default"])(yAxis))}else{allYAxis.push(yAxis)}allXAxis.splice(2);allYAxis.splice(2);allXAxis=allXAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"x"})});allYAxis=allYAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"y"})});return[].concat((0,_toConsumableArray2["default"])(allXAxis),(0,_toConsumableArray2["default"])(allYAxis))}function mergeDefaultAxisConfig(allAxis){var xAxis=allAxis.filter(function(_ref2){var axis=_ref2.axis;return axis==="x"});var yAxis=allAxis.filter(function(_ref3){var axis=_ref3.axis;return axis==="y"});xAxis=xAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.xAxisConfig),axis)});yAxis=yAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.yAxisConfig),axis)});return[].concat((0,_toConsumableArray2["default"])(xAxis),(0,_toConsumableArray2["default"])(yAxis))}function mergeDefaultBoundaryGap(allAxis){var valueAxis=allAxis.filter(function(_ref4){var data=_ref4.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref5){var data=_ref5.data;return data!=="value"});valueAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=false});labelAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=true});return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcAxisLabelData(allAxis,series){var valueAxis=allAxis.filter(function(_ref6){var data=_ref6.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref7){var data=_ref7.data;return data instanceof Array});valueAxis=calcValueAxisLabelData(valueAxis,series);labelAxis=calcLabelAxisLabelData(labelAxis);return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcValueAxisLabelData(valueAxis,series){return valueAxis.map(function(axis){var minMaxValue=getValueAxisMaxMinValue(axis,series);var _getTrueMinMax=getTrueMinMax(axis,minMaxValue),_getTrueMinMax2=(0,_slicedToArray2["default"])(_getTrueMinMax,2),min=_getTrueMinMax2[0],max=_getTrueMinMax2[1];var interval=getValueInterval(min,max,axis);var formatter=axis.axisLabel.formatter;var label=[];if(minMaxValue[0]===minMaxValue[1]){label=minMaxValue}else if(min<0&&max>0){label=getValueAxisLabelFromZero(min,max,interval)}else{label=getValueAxisLabelFromMin(min,max,interval)}label=label.map(function(l){return parseFloat(l.toFixed(2))});return _objectSpread({},axis,{maxValue:label.slice(-1)[0],minValue:label[0],label:getAfterFormatterLabel(label,formatter)})})}function getValueAxisMaxMinValue(axis,series){series=series.filter(function(_ref8){var show=_ref8.show,type=_ref8.type;if(show===false)return false;if(type==="pie")return false;return true});if(series.length===0)return[0,0];var index=axis.index,axisType=axis.axis;series=mergeStackData(series);var axisName=axisType+"Axis";var valueSeries=series.filter(function(s){return s[axisName]===index});if(!valueSeries.length)valueSeries=series;return getSeriesMinMaxValue(valueSeries)}function getSeriesMinMaxValue(series){if(!series)return;var minValue=Math.min.apply(Math,(0,_toConsumableArray2["default"])(series.map(function(_ref9){var data=_ref9.data;return Math.min.apply(Math,(0,_toConsumableArray2["default"])((0,_util.filterNonNumber)(data)))})));var maxValue=Math.max.apply(Math,(0,_toConsumableArray2["default"])(series.map(function(_ref10){var data=_ref10.data;return Math.max.apply(Math,(0,_toConsumableArray2["default"])((0,_util.filterNonNumber)(data)))})));return[minValue,maxValue]}function mergeStackData(series){var seriesCloned=(0,_util2.deepClone)(series,true);series.forEach(function(item,i){var data=(0,_util.mergeSameStackData)(item,series);seriesCloned[i].data=data});return seriesCloned}function getTrueMinMax(_ref11,_ref12){var min=_ref11.min,max=_ref11.max,axis=_ref11.axis;var _ref13=(0,_slicedToArray2["default"])(_ref12,2),minValue=_ref13[0],maxValue=_ref13[1];var minType=(0,_typeof2["default"])(min),maxType=(0,_typeof2["default"])(max);if(!testMinMaxType(min)){min=axisConfig[axis+"AxisConfig"].min;minType="string"}if(!testMinMaxType(max)){max=axisConfig[axis+"AxisConfig"].max;maxType="string"}if(minType==="string"){min=parseInt(minValue-abs(minValue*parseFloat(min)/100));var lever=getValueLever(min);min=parseFloat((min/lever-.1).toFixed(1))*lever}if(maxType==="string"){max=parseInt(maxValue+abs(maxValue*parseFloat(max)/100));var _lever=getValueLever(max);max=parseFloat((max/_lever+.1).toFixed(1))*_lever}return[min,max]}function getValueLever(value){var valueString=abs(value).toString();var valueLength=valueString.length;var firstZeroIndex=valueString.replace(/0*$/g,"").indexOf("0");var pow10Num=valueLength-1;if(firstZeroIndex!==-1)pow10Num-=firstZeroIndex;return pow(10,pow10Num)}function testMinMaxType(val){var valType=(0,_typeof2["default"])(val);var isValidString=valType==="string"&&/^\d+%$/.test(val);var isValidNumber=valType==="number";return isValidString||isValidNumber}function getValueAxisLabelFromZero(min,max,interval){var negative=[],positive=[];var currentNegative=0,currentPositive=0;do{negative.push(currentNegative-=interval)}while(currentNegative>min);do{positive.push(currentPositive+=interval)}while(currentPositive1)valueInterval=parseInt(valueInterval.toString().replace(/\d$/,"0"));if(valueInterval===0)valueInterval=1;if(typeof minInterval==="number"&&valueIntervalmaxInterval)return maxInterval;return valueInterval}function setAxisPosition(allAxis){var xAxis=allAxis.filter(function(_ref14){var axis=_ref14.axis;return axis==="x"});var yAxis=allAxis.filter(function(_ref15){var axis=_ref15.axis;return axis==="y"});if(xAxis[0]&&!xAxis[0].position)xAxis[0].position=_config.xAxisConfig.position;if(xAxis[1]&&!xAxis[1].position){xAxis[1].position=xAxis[0].position==="bottom"?"top":"bottom"}if(yAxis[0]&&!yAxis[0].position)yAxis[0].position=_config.yAxisConfig.position;if(yAxis[1]&&!yAxis[1].position){yAxis[1].position=yAxis[0].position==="left"?"right":"left"}return[].concat((0,_toConsumableArray2["default"])(xAxis),(0,_toConsumableArray2["default"])(yAxis))}function calcAxisLinePosition(allAxis,chart){var _chart$gridArea=chart.gridArea,x=_chart$gridArea.x,y=_chart$gridArea.y,w=_chart$gridArea.w,h=_chart$gridArea.h;allAxis=allAxis.map(function(axis){var position=axis.position;var linePosition=[];if(position==="left"){linePosition=[[x,y],[x,y+h]].reverse()}else if(position==="right"){linePosition=[[x+w,y],[x+w,y+h]].reverse()}else if(position==="top"){linePosition=[[x,y],[x+w,y]]}else if(position==="bottom"){linePosition=[[x,y+h],[x+w,y+h]]}return _objectSpread({},axis,{linePosition:linePosition})});return allAxis}function calcAxisTickPosition(allAxis,chart){return allAxis.map(function(axisItem){var axis=axisItem.axis,linePosition=axisItem.linePosition,position=axisItem.position,label=axisItem.label,boundaryGap=axisItem.boundaryGap;if(typeof boundaryGap!=="boolean")boundaryGap=axisConfig[axis+"AxisConfig"].boundaryGap;var labelNum=label.length;var _linePosition=(0,_slicedToArray2["default"])(linePosition,2),_linePosition$=(0,_slicedToArray2["default"])(_linePosition[0],2),startX=_linePosition$[0],startY=_linePosition$[1],_linePosition$2=(0,_slicedToArray2["default"])(_linePosition[1],2),endX=_linePosition$2[0],endY=_linePosition$2[1];var gapLength=axis==="x"?endX-startX:endY-startY;var gap=gapLength/(boundaryGap?labelNum:labelNum-1);var tickPosition=new Array(labelNum).fill(0).map(function(foo,i){if(axis==="x"){return[startX+gap*(boundaryGap?i+.5:i),startY]}return[startX,startY+gap*(boundaryGap?i+.5:i)]});var tickLinePosition=getTickLinePosition(axis,boundaryGap,position,tickPosition,gap);return _objectSpread({},axisItem,{tickPosition:tickPosition,tickLinePosition:tickLinePosition,tickGap:gap})})}function getTickLinePosition(axisType,boundaryGap,position,tickPosition,gap){var index=axisType==="x"?1:0;var plus=5;if(axisType==="x"&&position==="top")plus=-5;if(axisType==="y"&&position==="left")plus=-5;var tickLinePosition=tickPosition.map(function(lineStart){var lineEnd=(0,_util2.deepClone)(lineStart);lineEnd[index]+=plus;return[(0,_util2.deepClone)(lineStart),lineEnd]});if(!boundaryGap)return tickLinePosition;index=axisType==="x"?0:1;plus=gap/2;tickLinePosition.forEach(function(_ref16){var _ref17=(0,_slicedToArray2["default"])(_ref16,2),lineStart=_ref17[0],lineEnd=_ref17[1];lineStart[index]+=plus;lineEnd[index]+=plus});return tickLinePosition}function calcAxisNamePosition(allAxis,chart){return allAxis.map(function(axisItem){var nameGap=axisItem.nameGap,nameLocation=axisItem.nameLocation,position=axisItem.position,linePosition=axisItem.linePosition;var _linePosition2=(0,_slicedToArray2["default"])(linePosition,2),lineStart=_linePosition2[0],lineEnd=_linePosition2[1];var namePosition=(0,_toConsumableArray2["default"])(lineStart);if(nameLocation==="end")namePosition=(0,_toConsumableArray2["default"])(lineEnd);if(nameLocation==="center"){namePosition[0]=(lineStart[0]+lineEnd[0])/2;namePosition[1]=(lineStart[1]+lineEnd[1])/2}var index=0;if(position==="top"&&nameLocation==="center")index=1;if(position==="bottom"&&nameLocation==="center")index=1;if(position==="left"&&nameLocation!=="center")index=1;if(position==="right"&&nameLocation!=="center")index=1;var plus=nameGap;if(position==="top"&&nameLocation!=="end")plus*=-1;if(position==="left"&&nameLocation!=="start")plus*=-1;if(position==="bottom"&&nameLocation==="start")plus*=-1;if(position==="right"&&nameLocation==="end")plus*=-1;namePosition[index]+=plus;return _objectSpread({},axisItem,{namePosition:namePosition})})}function calcSplitLinePosition(allAxis,chart){var _chart$gridArea2=chart.gridArea,w=_chart$gridArea2.w,h=_chart$gridArea2.h;return allAxis.map(function(axisItem){var tickLinePosition=axisItem.tickLinePosition,position=axisItem.position,boundaryGap=axisItem.boundaryGap;var index=0,plus=w;if(position==="top"||position==="bottom")index=1;if(position==="top"||position==="bottom")plus=h;if(position==="right"||position==="bottom")plus*=-1;var splitLinePosition=tickLinePosition.map(function(_ref18){var _ref19=(0,_slicedToArray2["default"])(_ref18,1),startPoint=_ref19[0];var endPoint=(0,_toConsumableArray2["default"])(startPoint);endPoint[index]+=plus;return[(0,_toConsumableArray2["default"])(startPoint),endPoint]});if(!boundaryGap)splitLinePosition.shift();return _objectSpread({},axisItem,{splitLinePosition:splitLinePosition})})}function getLineConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;return[{name:"polyline",index:rLevel,visible:axisItem.axisLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getLineShape(axisItem),style:getLineStyle(axisItem)}]}function getLineShape(axisItem){var linePosition=axisItem.linePosition;return{points:linePosition}}function getLineStyle(axisItem){return axisItem.axisLine.style}function getTickConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getTickShapes(axisItem);var style=getTickStyle(axisItem);return shapes.map(function(shape){return{name:"polyline",index:rLevel,visible:axisItem.axisTick.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getTickShapes(axisItem){var tickLinePosition=axisItem.tickLinePosition;return tickLinePosition.map(function(points){return{points:points}})}function getTickStyle(axisItem){return axisItem.axisTick.style}function getLabelConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getLabelShapes(axisItem);var styles=getLabelStyle(axisItem,shapes);return shapes.map(function(shape,i){return{name:"text",index:rLevel,visible:axisItem.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:styles[i],setGraphCenter:function setGraphCenter(){return void 0}}})}function getLabelShapes(axisItem){var label=axisItem.label,tickPosition=axisItem.tickPosition,position=axisItem.position;return tickPosition.map(function(point,i){return{position:getLabelRealPosition(point,position),content:label[i].toString()}})}function getLabelRealPosition(points,position){var index=0,plus=10;if(position==="top"||position==="bottom")index=1;if(position==="top"||position==="left")plus=-10;points=(0,_util2.deepClone)(points);points[index]+=plus;return points}function getLabelStyle(axisItem,shapes){var position=axisItem.position;var style=axisItem.axisLabel.style;var align=getAxisLabelRealAlign(position);style=(0,_util.deepMerge)(align,style);var styles=shapes.map(function(_ref20){var position=_ref20.position;return _objectSpread({},style,{graphCenter:position})});return styles}function getAxisLabelRealAlign(position){if(position==="left")return{textAlign:"right",textBaseline:"middle"};if(position==="right")return{textAlign:"left",textBaseline:"middle"};if(position==="top")return{textAlign:"center",textBaseline:"bottom"};if(position==="bottom")return{textAlign:"center",textBaseline:"top"}}function getNameConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;return[{name:"text",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getNameShape(axisItem),style:getNameStyle(axisItem)}]}function getNameShape(axisItem){var name=axisItem.name,namePosition=axisItem.namePosition;return{content:name,position:namePosition}}function getNameStyle(axisItem){var nameLocation=axisItem.nameLocation,position=axisItem.position,style=axisItem.nameTextStyle;var align=getNameRealAlign(position,nameLocation);return(0,_util.deepMerge)(align,style)}function getNameRealAlign(position,location){if(position==="top"&&location==="start"||position==="bottom"&&location==="start"||position==="left"&&location==="center")return{textAlign:"right",textBaseline:"middle"};if(position==="top"&&location==="end"||position==="bottom"&&location==="end"||position==="right"&&location==="center")return{textAlign:"left",textBaseline:"middle"};if(position==="top"&&location==="center"||position==="left"&&location==="end"||position==="right"&&location==="end")return{textAlign:"center",textBaseline:"bottom"};if(position==="bottom"&&location==="center"||position==="left"&&location==="start"||position==="right"&&location==="start")return{textAlign:"center",textBaseline:"top"}}function getSplitLineConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getSplitLineShapes(axisItem);var style=getSplitLineStyle(axisItem);return shapes.map(function(shape){return{name:"polyline",index:rLevel,visible:axisItem.splitLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getSplitLineShapes(axisItem){var splitLinePosition=axisItem.splitLinePosition;return splitLinePosition.map(function(points){return{points:points}})}function getSplitLineStyle(axisItem){return axisItem.splitLine.style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],17:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.bar=bar;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _config=require("../config");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var bars=[];if(xAxis&&yAxis&&series){bars=(0,_util2.initNeedSeries)(series,_config.barConfig,"bar");bars=setBarAxis(bars,chart);bars=setBarPositionData(bars,chart);bars=calcBarsPosition(bars,chart)}(0,_updater.doUpdate)({chart:chart,series:bars.slice(-1),key:"backgroundBar",getGraphConfig:getBackgroundBarConfig});bars.reverse();(0,_updater.doUpdate)({chart:chart,series:bars,key:"bar",getGraphConfig:getBarConfig,getStartGraphConfig:getStartBarConfig,beforeUpdate:beforeUpdateBar});(0,_updater.doUpdate)({chart:chart,series:bars,key:"barLabel",getGraphConfig:getLabelConfig})}function setBarAxis(bars,chart){var axisData=chart.axisData;bars.forEach(function(bar){var xAxisIndex=bar.xAxisIndex,yAxisIndex=bar.yAxisIndex;if(typeof xAxisIndex!=="number")xAxisIndex=0;if(typeof yAxisIndex!=="number")yAxisIndex=0;var xAxis=axisData.find(function(_ref){var axis=_ref.axis,index=_ref.index;return"".concat(axis).concat(index)==="x".concat(xAxisIndex)});var yAxis=axisData.find(function(_ref2){var axis=_ref2.axis,index=_ref2.index;return"".concat(axis).concat(index)==="y".concat(yAxisIndex)});var axis=[xAxis,yAxis];var valueAxisIndex=axis.findIndex(function(_ref3){var data=_ref3.data;return data==="value"});bar.valueAxis=axis[valueAxisIndex];bar.labelAxis=axis[1-valueAxisIndex]});return bars}function setBarPositionData(bars,chart){var labelBarGroup=groupBarByLabelAxis(bars);labelBarGroup.forEach(function(group){setBarIndex(group);setBarNum(group);setBarCategoryWidth(group,chart);setBarWidthAndGap(group);setBarAllWidthAndGap(group)});return bars}function setBarIndex(bars){var stacks=getBarStack(bars);stacks=stacks.map(function(stack){return{stack:stack,index:-1}});var currentIndex=0;bars.forEach(function(bar){var stack=bar.stack;if(!stack){bar.barIndex=currentIndex;currentIndex++}else{var stackData=stacks.find(function(_ref4){var s=_ref4.stack;return s===stack});if(stackData.index===-1){stackData.index=currentIndex;currentIndex++}bar.barIndex=stackData.index}})}function groupBarByLabelAxis(bars){var labelAxis=bars.map(function(_ref5){var _ref5$labelAxis=_ref5.labelAxis,axis=_ref5$labelAxis.axis,index=_ref5$labelAxis.index;return axis+index});labelAxis=(0,_toConsumableArray2["default"])(new Set(labelAxis));return labelAxis.map(function(axisIndex){return bars.filter(function(_ref6){var _ref6$labelAxis=_ref6.labelAxis,axis=_ref6$labelAxis.axis,index=_ref6$labelAxis.index;return axis+index===axisIndex})})}function getBarStack(bars){var stacks=[];bars.forEach(function(_ref7){var stack=_ref7.stack;if(stack)stacks.push(stack)});return(0,_toConsumableArray2["default"])(new Set(stacks))}function setBarNum(bars){var barNum=(0,_toConsumableArray2["default"])(new Set(bars.map(function(_ref8){var barIndex=_ref8.barIndex;return barIndex}))).length;bars.forEach(function(bar){return bar.barNum=barNum})}function setBarCategoryWidth(bars){var lastBar=bars.slice(-1)[0];var barCategoryGap=lastBar.barCategoryGap,tickGap=lastBar.labelAxis.tickGap;var barCategoryWidth=0;if(typeof barCategoryGap==="number"){barCategoryWidth=barCategoryGap}else{barCategoryWidth=(1-parseInt(barCategoryGap)/100)*tickGap}bars.forEach(function(bar){return bar.barCategoryWidth=barCategoryWidth})}function setBarWidthAndGap(bars){var _bars$slice$=bars.slice(-1)[0],barCategoryWidth=_bars$slice$.barCategoryWidth,barWidth=_bars$slice$.barWidth,barGap=_bars$slice$.barGap,barNum=_bars$slice$.barNum;var widthAndGap=[];if(typeof barWidth==="number"||barWidth!=="auto"){widthAndGap=getBarWidthAndGapWithPercentOrNumber(barCategoryWidth,barWidth,barGap,barNum)}else if(barWidth==="auto"){widthAndGap=getBarWidthAndGapWidthAuto(barCategoryWidth,barWidth,barGap,barNum)}var _widthAndGap=widthAndGap,_widthAndGap2=(0,_slicedToArray2["default"])(_widthAndGap,2),width=_widthAndGap2[0],gap=_widthAndGap2[1];bars.forEach(function(bar){bar.barWidth=width;bar.barGap=gap})}function getBarWidthAndGapWithPercentOrNumber(barCategoryWidth,barWidth,barGap){var width=0,gap=0;if(typeof barWidth==="number"){width=barWidth}else{width=parseInt(barWidth)/100*barCategoryWidth}if(typeof barGap==="number"){gap=barGap}else{gap=parseInt(barGap)/100*width}return[width,gap]}function getBarWidthAndGapWidthAuto(barCategoryWidth,barWidth,barGap,barNum){var width=0,gap=0;var barItemWidth=barCategoryWidth/barNum;if(typeof barGap==="number"){gap=barGap;width=barItemWidth-gap}else{var percent=10+parseInt(barGap)/10;if(percent===0){width=barItemWidth*2;gap=-width}else{width=barItemWidth/percent*10;gap=barItemWidth-width}}return[width,gap]}function setBarAllWidthAndGap(bars){var _bars$slice$2=bars.slice(-1)[0],barGap=_bars$slice$2.barGap,barWidth=_bars$slice$2.barWidth,barNum=_bars$slice$2.barNum;var barAllWidthAndGap=(barGap+barWidth)*barNum-barGap;bars.forEach(function(bar){return bar.barAllWidthAndGap=barAllWidthAndGap})}function calcBarsPosition(bars,chart){bars=calcBarValueAxisCoordinate(bars);bars=calcBarLabelAxisCoordinate(bars);bars=eliminateNullBarLabelAxis(bars);bars=keepSameNumBetweenBarAndData(bars);return bars}function calcBarLabelAxisCoordinate(bars){return bars.map(function(bar){var labelAxis=bar.labelAxis,barAllWidthAndGap=bar.barAllWidthAndGap,barGap=bar.barGap,barWidth=bar.barWidth,barIndex=bar.barIndex;var tickGap=labelAxis.tickGap,tickPosition=labelAxis.tickPosition,axis=labelAxis.axis;var coordinateIndex=axis==="x"?0:1;var barLabelAxisPos=tickPosition.map(function(tick,i){var barCategoryStartPos=tickPosition[i][coordinateIndex]-tickGap/2;var barItemsStartPos=barCategoryStartPos+(tickGap-barAllWidthAndGap)/2;return barItemsStartPos+(barIndex+.5)*barWidth+barIndex*barGap});return _objectSpread({},bar,{barLabelAxisPos:barLabelAxisPos})})}function calcBarValueAxisCoordinate(bars){return bars.map(function(bar){var data=(0,_util2.mergeSameStackData)(bar,bars);data=eliminateNonNumberData(bar,data);var _bar$valueAxis=bar.valueAxis,axis=_bar$valueAxis.axis,minValue=_bar$valueAxis.minValue,maxValue=_bar$valueAxis.maxValue,linePosition=_bar$valueAxis.linePosition;var startPos=getValuePos(minValue,maxValue,minValue<0?0:minValue,linePosition,axis);var endPos=data.map(function(v){return getValuePos(minValue,maxValue,v,linePosition,axis)});var barValueAxisPos=endPos.map(function(p){return[startPos,p]});return _objectSpread({},bar,{barValueAxisPos:barValueAxisPos})})}function eliminateNonNumberData(barItem,barData){var data=barItem.data;return barData.map(function(v,i){return typeof data[i]==="number"?v:null}).filter(function(d){return d!==null})}function eliminateNullBarLabelAxis(bars){return bars.map(function(bar){var barLabelAxisPos=bar.barLabelAxisPos,data=bar.data;data.forEach(function(d,i){if(typeof d==="number")return;barLabelAxisPos[i]=null});return _objectSpread({},bar,{barLabelAxisPos:barLabelAxisPos.filter(function(p){return p!==null})})})}function keepSameNumBetweenBarAndData(bars){bars.forEach(function(bar){var data=bar.data,barLabelAxisPos=bar.barLabelAxisPos,barValueAxisPos=bar.barValueAxisPos;var dataNum=data.filter(function(d){return typeof d==="number"}).length;var axisPosNum=barLabelAxisPos.length;if(axisPosNum>dataNum){barLabelAxisPos.splice(dataNum);barValueAxisPos.splice(dataNum)}});return bars}function getValuePos(min,max,value,linePosition,axis){if(typeof value!=="number")return null;var valueMinus=max-min;var coordinateIndex=axis==="x"?0:1;var posMinus=linePosition[1][coordinateIndex]-linePosition[0][coordinateIndex];var percent=(value-min)/valueMinus;if(valueMinus===0)percent=0;var pos=percent*posMinus;return pos+linePosition[0][coordinateIndex]}function getBackgroundBarConfig(barItem){var animationCurve=barItem.animationCurve,animationFrame=barItem.animationFrame,rLevel=barItem.rLevel;var shapes=getBackgroundBarShapes(barItem);var style=getBackgroundBarStyle(barItem);return shapes.map(function(shape){return{name:"rect",index:rLevel,visible:barItem.backgroundBar.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getBackgroundBarShapes(barItem){var labelAxis=barItem.labelAxis,valueAxis=barItem.valueAxis;var tickPosition=labelAxis.tickPosition;var axis=valueAxis.axis,linePosition=valueAxis.linePosition;var width=getBackgroundBarWidth(barItem);var haltWidth=width/2;var posIndex=axis==="x"?0:1;var centerPos=tickPosition.map(function(p){return p[1-posIndex]});var _ref9=[linePosition[0][posIndex],linePosition[1][posIndex]],start=_ref9[0],end=_ref9[1];return centerPos.map(function(center){if(axis==="x"){return{x:start,y:center-haltWidth,w:end-start,h:width}}else{return{x:center-haltWidth,y:end,w:width,h:start-end}}})}function getBackgroundBarWidth(barItem){var barAllWidthAndGap=barItem.barAllWidthAndGap,barCategoryWidth=barItem.barCategoryWidth,backgroundBar=barItem.backgroundBar;var width=backgroundBar.width;if(typeof width==="number")return width;if(width==="auto")return barAllWidthAndGap;return parseInt(width)/100*barCategoryWidth}function getBackgroundBarStyle(barItem){return barItem.backgroundBar.style}function getBarConfig(barItem){var barLabelAxisPos=barItem.barLabelAxisPos,animationCurve=barItem.animationCurve,animationFrame=barItem.animationFrame,rLevel=barItem.rLevel;var name=getBarName(barItem);return barLabelAxisPos.map(function(foo,i){return{name:name,index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getBarShape(barItem,i),style:getBarStyle(barItem,i)}})}function getBarName(barItem){var shapeType=barItem.shapeType;if(shapeType==="leftEchelon"||shapeType==="rightEchelon")return"polyline";return"rect"}function getBarShape(barItem,i){var shapeType=barItem.shapeType;if(shapeType==="leftEchelon"){return getLeftEchelonShape(barItem,i)}else if(shapeType==="rightEchelon"){return getRightEchelonShape(barItem,i)}else{return getNormalBarShape(barItem,i)}}function getLeftEchelonShape(barItem,i){var barValueAxisPos=barItem.barValueAxisPos,barLabelAxisPos=barItem.barLabelAxisPos,barWidth=barItem.barWidth,echelonOffset=barItem.echelonOffset;var _barValueAxisPos$i=(0,_slicedToArray2["default"])(barValueAxisPos[i],2),start=_barValueAxisPos$i[0],end=_barValueAxisPos$i[1];var labelAxisPos=barLabelAxisPos[i];var halfWidth=barWidth/2;var valueAxis=barItem.valueAxis.axis;var points=[];if(valueAxis==="x"){points[0]=[end,labelAxisPos-halfWidth];points[1]=[end,labelAxisPos+halfWidth];points[2]=[start,labelAxisPos+halfWidth];points[3]=[start+echelonOffset,labelAxisPos-halfWidth];if(end-start1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var gauges=(0,_util2.initNeedSeries)(series,_gauge.gaugeConfig,"gauge");gauges=calcGaugesCenter(gauges,chart);gauges=calcGaugesRadius(gauges,chart);gauges=calcGaugesDataRadiusAndLineWidth(gauges,chart);gauges=calcGaugesDataAngles(gauges,chart);gauges=calcGaugesDataGradient(gauges,chart);gauges=calcGaugesAxisTickPosition(gauges,chart);gauges=calcGaugesLabelPositionAndAlign(gauges,chart);gauges=calcGaugesLabelData(gauges,chart);gauges=calcGaugesDetailsPosition(gauges,chart);gauges=calcGaugesDetailsContent(gauges,chart);(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeAxisTick",getGraphConfig:getAxisTickConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeAxisLabel",getGraphConfig:getAxisLabelConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeBackgroundArc",getGraphConfig:getBackgroundArcConfig,getStartGraphConfig:getStartBackgroundArcConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeArc",getGraphConfig:getArcConfig,getStartGraphConfig:getStartArcConfig,beforeChange:beforeChangeArc});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugePointer",getGraphConfig:getPointerConfig,getStartGraphConfig:getStartPointerConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeDetails",getGraphConfig:getDetailsConfig})}function calcGaugesCenter(gauges,chart){var area=chart.render.area;gauges.forEach(function(gaugeItem){var center=gaugeItem.center;center=center.map(function(pos,i){if(typeof pos==="number")return pos;return parseInt(pos)/100*area[i]});gaugeItem.center=center});return gauges}function calcGaugesRadius(gauges,chart){var area=chart.render.area;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;gauges.forEach(function(gaugeItem){var radius=gaugeItem.radius;if(typeof radius!=="number"){radius=parseInt(radius)/100*maxRadius}gaugeItem.radius=radius});return gauges}function calcGaugesDataRadiusAndLineWidth(gauges,chart){var area=chart.render.area;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;gauges.forEach(function(gaugeItem){var radius=gaugeItem.radius,data=gaugeItem.data,arcLineWidth=gaugeItem.arcLineWidth;data.forEach(function(item){var arcRadius=item.radius,lineWidth=item.lineWidth;if(!arcRadius)arcRadius=radius;if(typeof arcRadius!=="number")arcRadius=parseInt(arcRadius)/100*maxRadius;item.radius=arcRadius;if(!lineWidth)lineWidth=arcLineWidth;item.lineWidth=lineWidth})});return gauges}function calcGaugesDataAngles(gauges,chart){gauges.forEach(function(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,data=gaugeItem.data,min=gaugeItem.min,max=gaugeItem.max;var angleMinus=endAngle-startAngle;var valueMinus=max-min;data.forEach(function(item){var value=item.value;var itemAngle=Math.abs((value-min)/valueMinus*angleMinus);item.startAngle=startAngle;item.endAngle=startAngle+itemAngle})});return gauges}function calcGaugesDataGradient(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data;data.forEach(function(item){var color=item.color,gradient=item.gradient;if(!gradient||!gradient.length)gradient=color;if(!(gradient instanceof Array))gradient=[gradient];item.gradient=gradient})});return gauges}function calcGaugesAxisTickPosition(gauges,chart){gauges.forEach(function(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,splitNum=gaugeItem.splitNum,center=gaugeItem.center,radius=gaugeItem.radius,arcLineWidth=gaugeItem.arcLineWidth,axisTick=gaugeItem.axisTick;var tickLength=axisTick.tickLength,lineWidth=axisTick.style.lineWidth;var angles=endAngle-startAngle;var outerRadius=radius-arcLineWidth/2;var innerRadius=outerRadius-tickLength;var angleGap=angles/(splitNum-1);var arcLength=2*Math.PI*radius*angles/(Math.PI*2);var offset=Math.ceil(lineWidth/2)/arcLength*angles;gaugeItem.tickAngles=[];gaugeItem.tickInnerRadius=[];gaugeItem.tickPosition=new Array(splitNum).fill(0).map(function(foo,i){var angle=startAngle+angleGap*i;if(i===0)angle+=offset;if(i===splitNum-1)angle-=offset;gaugeItem.tickAngles[i]=angle;gaugeItem.tickInnerRadius[i]=innerRadius;return[_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([outerRadius,angle])),_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([innerRadius,angle]))]})});return gauges}function calcGaugesLabelPositionAndAlign(gauges,chart){gauges.forEach(function(gaugeItem){var center=gaugeItem.center,tickInnerRadius=gaugeItem.tickInnerRadius,tickAngles=gaugeItem.tickAngles,labelGap=gaugeItem.axisLabel.labelGap;var position=tickAngles.map(function(angle,i){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([tickInnerRadius[i]-labelGap,tickAngles[i]]))});var align=position.map(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),x=_ref2[0],y=_ref2[1];return{textAlign:x>center[0]?"right":"left",textBaseline:y>center[1]?"bottom":"top"}});gaugeItem.labelPosition=position;gaugeItem.labelAlign=align});return gauges}function calcGaugesLabelData(gauges,chart){gauges.forEach(function(gaugeItem){var axisLabel=gaugeItem.axisLabel,min=gaugeItem.min,max=gaugeItem.max,splitNum=gaugeItem.splitNum;var data=axisLabel.data,formatter=axisLabel.formatter;var valueGap=(max-min)/(splitNum-1);var value=new Array(splitNum).fill(0).map(function(foo,i){return parseInt(min+valueGap*i)});var formatterType=(0,_typeof2["default"])(formatter);data=(0,_util2.deepMerge)(value,data).map(function(v,i){var label=v;if(formatterType==="string"){label=formatter.replace("{value}",v)}if(formatterType==="function"){label=formatter({value:v,index:i})}return label});axisLabel.data=data});return gauges}function calcGaugesDetailsPosition(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data,details=gaugeItem.details,center=gaugeItem.center;var position=details.position,offset=details.offset;var detailsPosition=data.map(function(_ref3){var startAngle=_ref3.startAngle,endAngle=_ref3.endAngle,radius=_ref3.radius;var point=null;if(position==="center"){point=center}else if(position==="start"){point=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,startAngle]))}else if(position==="end"){point=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,endAngle]))}return getOffsetedPoint(point,offset)});gaugeItem.detailsPosition=detailsPosition});return gauges}function calcGaugesDetailsContent(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data,details=gaugeItem.details;var formatter=details.formatter;var formatterType=(0,_typeof2["default"])(formatter);var contents=data.map(function(dataItem){var content=dataItem.value;if(formatterType==="string"){content=formatter.replace("{value}","{nt}");content=content.replace("{name}",dataItem.name)}if(formatterType==="function")content=formatter(dataItem);return content.toString()});gaugeItem.detailsContent=contents});return gauges}function getOffsetedPoint(_ref4,_ref5){var _ref6=(0,_slicedToArray2["default"])(_ref4,2),x=_ref6[0],y=_ref6[1];var _ref7=(0,_slicedToArray2["default"])(_ref5,2),ox=_ref7[0],oy=_ref7[1];return[x+ox,y+oy]}function getAxisTickConfig(gaugeItem){var tickPosition=gaugeItem.tickPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return tickPosition.map(function(foo,i){return{name:"polyline",index:rLevel,visible:gaugeItem.axisTick.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisTickShape(gaugeItem,i),style:getAxisTickStyle(gaugeItem,i)}})}function getAxisTickShape(gaugeItem,i){var tickPosition=gaugeItem.tickPosition;return{points:tickPosition[i]}}function getAxisTickStyle(gaugeItem,i){var style=gaugeItem.axisTick.style;return style}function getAxisLabelConfig(gaugeItem){var labelPosition=gaugeItem.labelPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return labelPosition.map(function(foo,i){return{name:"text",index:rLevel,visible:gaugeItem.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLabelShape(gaugeItem,i),style:getAxisLabelStyle(gaugeItem,i)}})}function getAxisLabelShape(gaugeItem,i){var labelPosition=gaugeItem.labelPosition,data=gaugeItem.axisLabel.data;return{content:data[i].toString(),position:labelPosition[i]}}function getAxisLabelStyle(gaugeItem,i){var labelAlign=gaugeItem.labelAlign,axisLabel=gaugeItem.axisLabel;var style=axisLabel.style;return(0,_util2.deepMerge)(_objectSpread({},labelAlign[i]),style)}function getBackgroundArcConfig(gaugeItem){var animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return[{name:"arc",index:rLevel,visible:gaugeItem.backgroundArc.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getGaugeBackgroundArcShape(gaugeItem),style:getGaugeBackgroundArcStyle(gaugeItem)}]}function getGaugeBackgroundArcShape(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,center=gaugeItem.center,radius=gaugeItem.radius;return{rx:center[0],ry:center[1],r:radius,startAngle:startAngle,endAngle:endAngle}}function getGaugeBackgroundArcStyle(gaugeItem){var backgroundArc=gaugeItem.backgroundArc,arcLineWidth=gaugeItem.arcLineWidth;var style=backgroundArc.style;return(0,_util2.deepMerge)({lineWidth:arcLineWidth},style)}function getStartBackgroundArcConfig(gaugeItem){var config=getBackgroundArcConfig(gaugeItem)[0];var shape=_objectSpread({},config.shape);shape.endAngle=config.shape.startAngle;config.shape=shape;return[config]}function getArcConfig(gaugeItem){var data=gaugeItem.data,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return data.map(function(foo,i){return{name:"agArc",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getGaugeArcShape(gaugeItem,i),style:getGaugeArcStyle(gaugeItem,i)}})}function getGaugeArcShape(gaugeItem,i){var data=gaugeItem.data,center=gaugeItem.center,gradientEndAngle=gaugeItem.endAngle;var _data$i=data[i],radius=_data$i.radius,startAngle=_data$i.startAngle,endAngle=_data$i.endAngle,localGradient=_data$i.localGradient;if(localGradient)gradientEndAngle=endAngle;return{rx:center[0],ry:center[1],r:radius,startAngle:startAngle,endAngle:endAngle,gradientEndAngle:gradientEndAngle}}function getGaugeArcStyle(gaugeItem,i){var data=gaugeItem.data,dataItemStyle=gaugeItem.dataItemStyle;var _data$i2=data[i],lineWidth=_data$i2.lineWidth,gradient=_data$i2.gradient;gradient=gradient.map(function(c){return(0,_color.getRgbaValue)(c)});return(0,_util2.deepMerge)({lineWidth:lineWidth,gradient:gradient},dataItemStyle)}function getStartArcConfig(gaugeItem){var configs=getArcConfig(gaugeItem);configs.map(function(config){var shape=_objectSpread({},config.shape);shape.endAngle=config.shape.startAngle;config.shape=shape});return configs}function beforeChangeArc(graph,config){var graphGradient=graph.style.gradient;var cacheNum=graphGradient.length;var needNum=config.style.gradient.length;if(cacheNum>needNum){graphGradient.splice(needNum)}else{var last=graphGradient.slice(-1)[0];graphGradient.push.apply(graphGradient,(0,_toConsumableArray2["default"])(new Array(needNum-cacheNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(last)})))}}function getPointerConfig(gaugeItem){var animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,center=gaugeItem.center,rLevel=gaugeItem.rLevel;return[{name:"polyline",index:rLevel,visible:gaugeItem.pointer.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getPointerShape(gaugeItem),style:getPointerStyle(gaugeItem),setGraphCenter:function setGraphCenter(foo,graph){graph.style.graphCenter=center}}]}function getPointerShape(gaugeItem){var center=gaugeItem.center;return{points:getPointerPoints(center),close:true}}function getPointerStyle(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,min=gaugeItem.min,max=gaugeItem.max,data=gaugeItem.data,pointer=gaugeItem.pointer,center=gaugeItem.center;var valueIndex=pointer.valueIndex,style=pointer.style;var value=data[valueIndex]?data[valueIndex].value:0;var angle=(value-min)/(max-min)*(endAngle-startAngle)+startAngle+Math.PI/2;return(0,_util2.deepMerge)({rotate:(0,_util2.radianToAngle)(angle),scale:[1,1],graphCenter:center},style)}function getPointerPoints(_ref8){var _ref9=(0,_slicedToArray2["default"])(_ref8,2),x=_ref9[0],y=_ref9[1];var point1=[x,y-40];var point2=[x+5,y];var point3=[x,y+10];var point4=[x-5,y];return[point1,point2,point3,point4]}function getStartPointerConfig(gaugeItem){var startAngle=gaugeItem.startAngle;var config=getPointerConfig(gaugeItem)[0];config.style.rotate=(0,_util2.radianToAngle)(startAngle+Math.PI/2);return[config]}function getDetailsConfig(gaugeItem){var detailsPosition=gaugeItem.detailsPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;var visible=gaugeItem.details.show;return detailsPosition.map(function(foo,i){return{name:"numberText",index:rLevel,visible:visible,animationCurve:animationCurve,animationFrame:animationFrame,shape:getDetailsShape(gaugeItem,i),style:getDetailsStyle(gaugeItem,i)}})}function getDetailsShape(gaugeItem,i){var detailsPosition=gaugeItem.detailsPosition,detailsContent=gaugeItem.detailsContent,data=gaugeItem.data,details=gaugeItem.details;var position=detailsPosition[i];var content=detailsContent[i];var dataValue=data[i].value;var toFixed=details.valueToFixed;return{number:[dataValue],content:content,position:position,toFixed:toFixed}}function getDetailsStyle(gaugeItem,i){var details=gaugeItem.details,data=gaugeItem.data;var style=details.style;var color=data[i].color;return(0,_util2.deepMerge)({fill:color},style)}},{"../class/updater.class":3,"../config/gauge":7,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],19:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.grid=grid;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var grid=option.grid;grid=(0,_util2.deepMerge)((0,_util.deepClone)(_config.gridConfig,true),grid||{});(0,_updater.doUpdate)({chart:chart,series:[grid],key:"grid",getGraphConfig:getGridConfig})}function getGridConfig(gridItem,updater){var animationCurve=gridItem.animationCurve,animationFrame=gridItem.animationFrame,rLevel=gridItem.rLevel;var shape=getGridShape(gridItem,updater);var style=getGridStyle(gridItem);updater.chart.gridArea=_objectSpread({},shape);return[{name:"rect",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}]}function getGridShape(gridItem,updater){var _updater$chart$render=(0,_slicedToArray2["default"])(updater.chart.render.area,2),w=_updater$chart$render[0],h=_updater$chart$render[1];var left=getNumberValue(gridItem.left,w);var right=getNumberValue(gridItem.right,w);var top=getNumberValue(gridItem.top,h);var bottom=getNumberValue(gridItem.bottom,h);var width=w-left-right;var height=h-top-bottom;return{x:left,y:top,w:width,h:height}}function getNumberValue(val,all){if(typeof val==="number")return val;if(typeof val!=="string")return 0;return all*parseInt(val)/100}function getGridStyle(gridItem){var style=gridItem.style;return style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@jiaminghi/c-render/lib/plugin/util":54}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"mergeColor",{enumerable:true,get:function get(){return _mergeColor.mergeColor}});Object.defineProperty(exports,"title",{enumerable:true,get:function get(){return _title.title}});Object.defineProperty(exports,"grid",{enumerable:true,get:function get(){return _grid.grid}});Object.defineProperty(exports,"axis",{enumerable:true,get:function get(){return _axis.axis}});Object.defineProperty(exports,"line",{enumerable:true,get:function get(){return _line.line}});Object.defineProperty(exports,"bar",{enumerable:true,get:function get(){return _bar.bar}});Object.defineProperty(exports,"pie",{enumerable:true,get:function get(){return _pie.pie}});Object.defineProperty(exports,"radarAxis",{enumerable:true,get:function get(){return _radarAxis.radarAxis}});Object.defineProperty(exports,"radar",{enumerable:true,get:function get(){return _radar.radar}});Object.defineProperty(exports,"gauge",{enumerable:true,get:function get(){return _gauge.gauge}});Object.defineProperty(exports,"legend",{enumerable:true,get:function get(){return _legend.legend}});var _mergeColor=require("./mergeColor");var _title=require("./title");var _grid=require("./grid");var _axis=require("./axis");var _line=require("./line");var _bar=require("./bar");var _pie=require("./pie");var _radarAxis=require("./radarAxis");var _radar=require("./radar");var _gauge=require("./gauge");var _legend=require("./legend")},{"./axis":16,"./bar":17,"./gauge":18,"./grid":19,"./legend":21,"./line":22,"./mergeColor":23,"./pie":24,"./radar":25,"./radarAxis":26,"./title":27}],21:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.legend=legend;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function legend(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var legend=option.legend;if(legend){legend=(0,_util2.deepMerge)((0,_util.deepClone)(_config.legendConfig,true),legend);legend=initLegendData(legend);legend=filterInvalidData(legend,option,chart);legend=calcLegendTextWidth(legend,chart);legend=calcLegendPosition(legend,chart);legend=[legend]}else{legend=[]}(0,_updater.doUpdate)({chart:chart,series:legend,key:"legendIcon",getGraphConfig:getIconConfig});(0,_updater.doUpdate)({chart:chart,series:legend,key:"legendText",getGraphConfig:getTextConfig})}function initLegendData(legend){var data=legend.data;legend.data=data.map(function(item){var itemType=(0,_typeof2["default"])(item);if(itemType==="string"){return{name:item}}else if(itemType==="object"){return item}return{name:""}});return legend}function filterInvalidData(legend,option,chart){var series=option.series;var legendStatus=chart.legendStatus;var data=legend.data.filter(function(item){var name=item.name;var result=series.find(function(_ref){var sn=_ref.name;return name===sn});if(!result)return false;if(!item.color)item.color=result.color;if(!item.icon)item.icon=result.type;return item});if(!legendStatus||legendStatus.length!==legend.data.length)legendStatus=new Array(legend.data.length).fill(true);data.forEach(function(item,i){return item.status=legendStatus[i]});legend.data=data;chart.legendStatus=legendStatus;return legend}function calcLegendTextWidth(legend,chart){var ctx=chart.render.ctx;var data=legend.data,textStyle=legend.textStyle,textUnselectedStyle=legend.textUnselectedStyle;data.forEach(function(item){var status=item.status,name=item.name;item.textWidth=getTextWidth(ctx,name,status?textStyle:textUnselectedStyle)});return legend}function getTextWidth(ctx,text,style){ctx.font=getFontConfig(style);return ctx.measureText(text).width}function getFontConfig(style){var fontFamily=style.fontFamily,fontSize=style.fontSize;return"".concat(fontSize,"px ").concat(fontFamily)}function calcLegendPosition(legend,chart){var orient=legend.orient;if(orient==="vertical"){calcVerticalPosition(legend,chart)}else{calcHorizontalPosition(legend,chart)}return legend}function calcHorizontalPosition(legend,chart){var iconHeight=legend.iconHeight,itemGap=legend.itemGap;var lines=calcDefaultHorizontalPosition(legend,chart);var xOffsets=lines.map(function(line){return getHorizontalXOffset(line,legend,chart)});var yOffset=getHorizontalYOffset(legend,chart);var align={textAlign:"left",textBaseline:"middle"};lines.forEach(function(line,i){return line.forEach(function(item){var iconPosition=item.iconPosition,textPosition=item.textPosition;var xOffset=xOffsets[i];var realYOffset=yOffset+i*(itemGap+iconHeight);item.iconPosition=mergeOffset(iconPosition,[xOffset,realYOffset]);item.textPosition=mergeOffset(textPosition,[xOffset,realYOffset]);item.align=align})})}function calcDefaultHorizontalPosition(legend,chart){var data=legend.data,iconWidth=legend.iconWidth;var w=chart.render.area[0];var startIndex=0;var lines=[[]];data.forEach(function(item,i){var beforeWidth=getBeforeWidth(startIndex,i,legend);var endXPos=beforeWidth+iconWidth+5+item.textWidth;if(endXPos>=w){startIndex=i;beforeWidth=getBeforeWidth(startIndex,i,legend);lines.push([])}item.iconPosition=[beforeWidth,0];item.textPosition=[beforeWidth+iconWidth+5,0];lines.slice(-1)[0].push(item)});return lines}function getBeforeWidth(startIndex,currentIndex,legend){var data=legend.data,iconWidth=legend.iconWidth,itemGap=legend.itemGap;var beforeItem=data.slice(startIndex,currentIndex);return(0,_util2.mulAdd)(beforeItem.map(function(_ref2){var textWidth=_ref2.textWidth;return textWidth}))+(currentIndex-startIndex)*(itemGap+5+iconWidth)}function getHorizontalXOffset(data,legend,chart){var left=legend.left,right=legend.right,iconWidth=legend.iconWidth,itemGap=legend.itemGap;var w=chart.render.area[0];var dataNum=data.length;var allWidth=(0,_util2.mulAdd)(data.map(function(_ref3){var textWidth=_ref3.textWidth;return textWidth}))+dataNum*(5+iconWidth)+(dataNum-1)*itemGap;var horizontal=[left,right].findIndex(function(pos){return pos!=="auto"});if(horizontal===-1){return(w-allWidth)/2}else if(horizontal===0){if(typeof left==="number")return left;return parseInt(left)/100*w}else{if(typeof right!=="number")right=parseInt(right)/100*w;return w-(allWidth+right)}}function getHorizontalYOffset(legend,chart){var top=legend.top,bottom=legend.bottom,iconHeight=legend.iconHeight;var h=chart.render.area[1];var vertical=[top,bottom].findIndex(function(pos){return pos!=="auto"});var halfIconHeight=iconHeight/2;if(vertical===-1){var _chart$gridArea=chart.gridArea,y=_chart$gridArea.y,height=_chart$gridArea.h;return y+height+45-halfIconHeight}else if(vertical===0){if(typeof top==="number")return top-halfIconHeight;return parseInt(top)/100*h-halfIconHeight}else{if(typeof bottom!=="number")bottom=parseInt(bottom)/100*h;return h-bottom-halfIconHeight}}function mergeOffset(_ref4,_ref5){var _ref6=(0,_slicedToArray2["default"])(_ref4,2),x=_ref6[0],y=_ref6[1];var _ref7=(0,_slicedToArray2["default"])(_ref5,2),ox=_ref7[0],oy=_ref7[1];return[x+ox,y+oy]}function calcVerticalPosition(legend,chart){var _getVerticalXOffset=getVerticalXOffset(legend,chart),_getVerticalXOffset2=(0,_slicedToArray2["default"])(_getVerticalXOffset,2),isRight=_getVerticalXOffset2[0],xOffset=_getVerticalXOffset2[1];var yOffset=getVerticalYOffset(legend,chart);calcDefaultVerticalPosition(legend,isRight);var align={textAlign:"left",textBaseline:"middle"};legend.data.forEach(function(item){var textPosition=item.textPosition,iconPosition=item.iconPosition;item.textPosition=mergeOffset(textPosition,[xOffset,yOffset]);item.iconPosition=mergeOffset(iconPosition,[xOffset,yOffset]);item.align=align})}function getVerticalXOffset(legend,chart){var left=legend.left,right=legend.right;var w=chart.render.area[0];var horizontal=[left,right].findIndex(function(pos){return pos!=="auto"});if(horizontal===-1){return[true,w-10]}else{var offset=[left,right][horizontal];if(typeof offset!=="number")offset=parseInt(offset)/100*w;return[Boolean(horizontal),offset]}}function getVerticalYOffset(legend,chart){var iconHeight=legend.iconHeight,itemGap=legend.itemGap,data=legend.data,top=legend.top,bottom=legend.bottom;var h=chart.render.area[1];var dataNum=data.length;var allHeight=dataNum*iconHeight+(dataNum-1)*itemGap;var vertical=[top,bottom].findIndex(function(pos){return pos!=="auto"});if(vertical===-1){return(h-allHeight)/2}else{var offset=[top,bottom][vertical];if(typeof offset!=="number")offset=parseInt(offset)/100*h;if(vertical===1)offset=h-offset-allHeight;return offset}}function calcDefaultVerticalPosition(legend,isRight){var data=legend.data,iconWidth=legend.iconWidth,iconHeight=legend.iconHeight,itemGap=legend.itemGap;var halfIconHeight=iconHeight/2;data.forEach(function(item,i){var textWidth=item.textWidth;var yPos=(iconHeight+itemGap)*i+halfIconHeight;var iconXPos=isRight?0-iconWidth:0;var textXpos=isRight?iconXPos-5-textWidth:iconWidth+5;item.iconPosition=[iconXPos,yPos];item.textPosition=[textXpos,yPos]})}function getIconConfig(legendItem,updater){var data=legendItem.data,selectAble=legendItem.selectAble,animationCurve=legendItem.animationCurve,animationFrame=legendItem.animationFrame,rLevel=legendItem.rLevel;return data.map(function(item,i){return(0,_defineProperty2["default"])({name:item.icon==="line"?"lineIcon":"rect",index:rLevel,visible:legendItem.show,hover:selectAble,click:selectAble,animationCurve:animationCurve,animationFrame:animationFrame,shape:getIconShape(legendItem,i),style:getIconStyle(legendItem,i)},"click",createClickCallBack(legendItem,i,updater))})}function getIconShape(legendItem,i){var data=legendItem.data,iconWidth=legendItem.iconWidth,iconHeight=legendItem.iconHeight;var _data$i$iconPosition=(0,_slicedToArray2["default"])(data[i].iconPosition,2),x=_data$i$iconPosition[0],y=_data$i$iconPosition[1];var halfIconHeight=iconHeight/2;return{x:x,y:y-halfIconHeight,w:iconWidth,h:iconHeight}}function getIconStyle(legendItem,i){var data=legendItem.data,iconStyle=legendItem.iconStyle,iconUnselectedStyle=legendItem.iconUnselectedStyle;var _data$i=data[i],status=_data$i.status,color=_data$i.color;var style=status?iconStyle:iconUnselectedStyle;return(0,_util2.deepMerge)({fill:color},style)}function getTextConfig(legendItem,updater){var data=legendItem.data,selectAble=legendItem.selectAble,animationCurve=legendItem.animationCurve,animationFrame=legendItem.animationFrame,rLevel=legendItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:legendItem.show,hover:selectAble,animationCurve:animationCurve,animationFrame:animationFrame,hoverRect:getTextHoverRect(legendItem,i),shape:getTextShape(legendItem,i),style:getTextStyle(legendItem,i),click:createClickCallBack(legendItem,i,updater)}})}function getTextShape(legendItem,i){var _legendItem$data$i=legendItem.data[i],textPosition=_legendItem$data$i.textPosition,name=_legendItem$data$i.name;return{content:name,position:textPosition}}function getTextStyle(legendItem,i){var textStyle=legendItem.textStyle,textUnselectedStyle=legendItem.textUnselectedStyle;var _legendItem$data$i2=legendItem.data[i],status=_legendItem$data$i2.status,align=_legendItem$data$i2.align;var style=status?textStyle:textUnselectedStyle;return(0,_util2.deepMerge)((0,_util.deepClone)(style,true),align)}function getTextHoverRect(legendItem,i){var textStyle=legendItem.textStyle,textUnselectedStyle=legendItem.textUnselectedStyle;var _legendItem$data$i3=legendItem.data[i],status=_legendItem$data$i3.status,_legendItem$data$i3$t=(0,_slicedToArray2["default"])(_legendItem$data$i3.textPosition,2),x=_legendItem$data$i3$t[0],y=_legendItem$data$i3$t[1],textWidth=_legendItem$data$i3.textWidth;var style=status?textStyle:textUnselectedStyle;var fontSize=style.fontSize;return[x,y-fontSize/2,textWidth,fontSize]}function createClickCallBack(legendItem,index,updater){var name=legendItem.data[index].name;return function(){var _updater$chart=updater.chart,legendStatus=_updater$chart.legendStatus,option=_updater$chart.option;var status=!legendStatus[index];var change=option.series.find(function(_ref9){var sn=_ref9.name;return sn===name});change.show=status;legendStatus[index]=status;updater.chart.setOption(option)}}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],22:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.line=line;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _updater=require("../class/updater.class");var _config=require("../config");var _bezierCurve=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var lines=[];if(xAxis&&yAxis&&series){lines=(0,_util.initNeedSeries)(series,_config.lineConfig,"line");lines=calcLinesPosition(lines,chart)}(0,_updater.doUpdate)({chart:chart,series:lines,key:"lineArea",getGraphConfig:getLineAreaConfig,getStartGraphConfig:getStartLineAreaConfig,beforeUpdate:beforeUpdateLineAndArea,beforeChange:beforeChangeLineAndArea});(0,_updater.doUpdate)({chart:chart,series:lines,key:"line",getGraphConfig:getLineConfig,getStartGraphConfig:getStartLineConfig,beforeUpdate:beforeUpdateLineAndArea,beforeChange:beforeChangeLineAndArea});(0,_updater.doUpdate)({chart:chart,series:lines,key:"linePoint",getGraphConfig:getPointConfig,getStartGraphConfig:getStartPointConfig});(0,_updater.doUpdate)({chart:chart,series:lines,key:"lineLabel",getGraphConfig:getLabelConfig})}function calcLinesPosition(lines,chart){var axisData=chart.axisData;return lines.map(function(lineItem){var lineData=(0,_util.mergeSameStackData)(lineItem,lines);lineData=mergeNonNumber(lineItem,lineData);var lineAxis=getLineAxis(lineItem,axisData);var linePosition=getLinePosition(lineData,lineAxis);var lineFillBottomPos=getLineFillBottomPos(lineAxis);return _objectSpread({},lineItem,{linePosition:linePosition.filter(function(p){return p}),lineFillBottomPos:lineFillBottomPos})})}function mergeNonNumber(lineItem,lineData){var data=lineItem.data;return lineData.map(function(v,i){return typeof data[i]==="number"?v:null})}function getLineAxis(line,axisData){var xAxisIndex=line.xAxisIndex,yAxisIndex=line.yAxisIndex;var xAxis=axisData.find(function(_ref){var axis=_ref.axis,index=_ref.index;return axis==="x"&&index===xAxisIndex});var yAxis=axisData.find(function(_ref2){var axis=_ref2.axis,index=_ref2.index;return axis==="y"&&index===yAxisIndex});return[xAxis,yAxis]}function getLinePosition(lineData,lineAxis){var valueAxisIndex=lineAxis.findIndex(function(_ref3){var data=_ref3.data;return data==="value"});var valueAxis=lineAxis[valueAxisIndex];var labelAxis=lineAxis[1-valueAxisIndex];var linePosition=valueAxis.linePosition,axis=valueAxis.axis;var tickPosition=labelAxis.tickPosition;var tickNum=tickPosition.length;var valueAxisPosIndex=axis==="x"?0:1;var valueAxisStartPos=linePosition[0][valueAxisPosIndex];var valueAxisEndPos=linePosition[1][valueAxisPosIndex];var valueAxisPosMinus=valueAxisEndPos-valueAxisStartPos;var maxValue=valueAxis.maxValue,minValue=valueAxis.minValue;var valueMinus=maxValue-minValue;var position=new Array(tickNum).fill(0).map(function(foo,i){var v=lineData[i];if(typeof v!=="number")return null;var valuePercent=(v-minValue)/valueMinus;if(valueMinus===0)valuePercent=0;return valuePercent*valueAxisPosMinus+valueAxisStartPos});return position.map(function(vPos,i){if(i>=tickNum||typeof vPos!=="number")return null;var pos=[vPos,tickPosition[i][1-valueAxisPosIndex]];if(valueAxisPosIndex===0)return pos;pos.reverse();return pos})}function getLineFillBottomPos(lineAxis){var valueAxis=lineAxis.find(function(_ref4){var data=_ref4.data;return data==="value"});var axis=valueAxis.axis,linePosition=valueAxis.linePosition,minValue=valueAxis.minValue,maxValue=valueAxis.maxValue;var changeIndex=axis==="x"?0:1;var changeValue=linePosition[0][changeIndex];if(minValue<0&&maxValue>0){var valueMinus=maxValue-minValue;var posMinus=Math.abs(linePosition[0][changeIndex]-linePosition[1][changeIndex]);var offset=Math.abs(minValue)/valueMinus*posMinus;if(axis==="y")offset*=-1;changeValue+=offset}return{changeIndex:changeIndex,changeValue:changeValue}}function getLineAreaConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,lineFillBottomPos=lineItem.lineFillBottomPos,rLevel=lineItem.rLevel;return[{name:getLineGraphName(lineItem),index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,visible:lineItem.lineArea.show,lineFillBottomPos:lineFillBottomPos,shape:getLineAndAreaShape(lineItem),style:getLineAreaStyle(lineItem),drawed:lineAreaDrawed}]}function getLineAndAreaShape(lineItem){var linePosition=lineItem.linePosition;return{points:linePosition}}function getLineAreaStyle(lineItem){var lineArea=lineItem.lineArea,color=lineItem.color;var gradient=lineArea.gradient,style=lineArea.style;var fillColor=[style.fill||color];var gradientColor=(0,_util.deepMerge)(fillColor,gradient);if(gradientColor.length===1)gradientColor.push(gradientColor[0]);var gradientParams=getGradientParams(lineItem);style=_objectSpread({},style,{stroke:"rgba(0, 0, 0, 0)"});return(0,_util.deepMerge)({gradientColor:gradientColor,gradientParams:gradientParams,gradientType:"linear",gradientWith:"fill"},style)}function getGradientParams(lineItem){var lineFillBottomPos=lineItem.lineFillBottomPos,linePosition=lineItem.linePosition;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;var mainPos=linePosition.map(function(p){return p[changeIndex]});var maxPos=Math.max.apply(Math,(0,_toConsumableArray2["default"])(mainPos));var minPos=Math.min.apply(Math,(0,_toConsumableArray2["default"])(mainPos));var beginPos=maxPos;if(changeIndex===1)beginPos=minPos;if(changeIndex===1){return[0,beginPos,0,changeValue]}else{return[beginPos,0,changeValue,0]}}function lineAreaDrawed(_ref5,_ref6){var lineFillBottomPos=_ref5.lineFillBottomPos,shape=_ref5.shape;var ctx=_ref6.ctx;var points=shape.points;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;var linePoint1=(0,_toConsumableArray2["default"])(points[points.length-1]);var linePoint2=(0,_toConsumableArray2["default"])(points[0]);linePoint1[changeIndex]=changeValue;linePoint2[changeIndex]=changeValue;ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(linePoint1));ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(linePoint2));ctx.closePath();ctx.fill()}function getStartLineAreaConfig(lineItem){var config=getLineAreaConfig(lineItem)[0];var style=_objectSpread({},config.style);style.opacity=0;config.style=style;return[config]}function beforeUpdateLineAndArea(graphs,lineItem,i,updater){var cache=graphs[i];if(!cache)return;var currentName=getLineGraphName(lineItem);var render=updater.chart.render;var name=cache[0].name;var delAll=currentName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeLineAndArea(graph,config){var points=config.shape.points;var graphPoints=graph.shape.points;var graphPointsNum=graphPoints.length;var pointsNum=points.length;if(pointsNum>graphPointsNum){var lastPoint=graphPoints.slice(-1)[0];var newAddPoints=new Array(pointsNum-graphPointsNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(lastPoint)});graphPoints.push.apply(graphPoints,(0,_toConsumableArray2["default"])(newAddPoints))}else if(pointsNum1&&arguments[1]!==undefined?arguments[1]:false;if(!smooth)return(0,_util.getPolylineLength)(points);var curve=polylineToBezierCurve(points);return getBezierCurveLength(curve)}function getStartLineConfig(lineItem){var lineDash=lineItem.lineStyle.lineDash;var config=getLineConfig(lineItem)[0];var realLineDash=config.style.lineDash;if(lineDash){realLineDash=[0,0]}else{realLineDash=(0,_toConsumableArray2["default"])(realLineDash).reverse()}config.style.lineDash=realLineDash;return[config]}function getPointConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,rLevel=lineItem.rLevel;var shapes=getPointShapes(lineItem);var style=getPointStyle(lineItem);return shapes.map(function(shape){return{name:"circle",index:rLevel+2,visible:lineItem.linePoint.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getPointShapes(lineItem){var linePosition=lineItem.linePosition,radius=lineItem.linePoint.radius;return linePosition.map(function(_ref7){var _ref8=(0,_slicedToArray2["default"])(_ref7,2),rx=_ref8[0],ry=_ref8[1];return{r:radius,rx:rx,ry:ry}})}function getPointStyle(lineItem){var color=lineItem.color,style=lineItem.linePoint.style;return(0,_util.deepMerge)({stroke:color},style)}function getStartPointConfig(lineItem){var configs=getPointConfig(lineItem);configs.forEach(function(config){config.shape.r=.1});return configs}function getLabelConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,rLevel=lineItem.rLevel;var shapes=getLabelShapes(lineItem);var style=getLabelStyle(lineItem);return shapes.map(function(shape,i){return{name:"text",index:rLevel+3,visible:lineItem.label.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getLabelShapes(lineItem){var contents=formatterLabel(lineItem);var position=getLabelPosition(lineItem);return contents.map(function(content,i){return{content:content,position:position[i]}})}function getLabelPosition(lineItem){var linePosition=lineItem.linePosition,lineFillBottomPos=lineItem.lineFillBottomPos,label=lineItem.label;var position=label.position,offset=label.offset;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;return linePosition.map(function(pos){if(position==="bottom"){pos=(0,_toConsumableArray2["default"])(pos);pos[changeIndex]=changeValue}if(position==="center"){var bottom=(0,_toConsumableArray2["default"])(pos);bottom[changeIndex]=changeValue;pos=getCenterLabelPoint(pos,bottom)}return getOffsetedPoint(pos,offset)})}function getOffsetedPoint(_ref9,_ref10){var _ref11=(0,_slicedToArray2["default"])(_ref9,2),x=_ref11[0],y=_ref11[1];var _ref12=(0,_slicedToArray2["default"])(_ref10,2),ox=_ref12[0],oy=_ref12[1];return[x+ox,y+oy]}function getCenterLabelPoint(_ref13,_ref14){var _ref15=(0,_slicedToArray2["default"])(_ref13,2),ax=_ref15[0],ay=_ref15[1];var _ref16=(0,_slicedToArray2["default"])(_ref14,2),bx=_ref16[0],by=_ref16[1];return[(ax+bx)/2,(ay+by)/2]}function formatterLabel(lineItem){var data=lineItem.data,formatter=lineItem.label.formatter;data=data.filter(function(d){return typeof d==="number"}).map(function(d){return d.toString()});if(!formatter)return data;var type=(0,_typeof2["default"])(formatter);if(type==="string")return data.map(function(d){return formatter.replace("{value}",d)});if(type==="function")return data.map(function(value,index){return formatter({value:value,index:index})});return data}function getLabelStyle(lineItem){var color=lineItem.color,style=lineItem.label.style;return(0,_util.deepMerge)({fill:color},style)}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/bezier-curve":47}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.mergeColor=mergeColor;var _config=require("../config");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function mergeColor(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var defaultColor=(0,_util.deepClone)(_config.colorConfig,true);var color=option.color,series=option.series;if(!series)series=[];if(!color)color=[];option.color=color=(0,_util2.deepMerge)(defaultColor,color);if(!series.length)return;var colorNum=color.length;series.forEach(function(item,i){if(item.color)return;item.color=color[i%colorNum]});var pies=series.filter(function(_ref){var type=_ref.type;return type==="pie"});pies.forEach(function(pie){return pie.data.forEach(function(di,i){return di.color=color[i%colorNum]})});var gauges=series.filter(function(_ref2){var type=_ref2.type;return type==="gauge"});gauges.forEach(function(gauge){return gauge.data.forEach(function(di,i){return di.color=color[i%colorNum]})});var barWithIndependentColor=series.filter(function(_ref3){var type=_ref3.type,independentColor=_ref3.independentColor;return type==="bar"&&independentColor});barWithIndependentColor.forEach(function(bar){if(bar.independentColors)return;bar.independentColors=color})}},{"../config":9,"../util":30,"@jiaminghi/c-render/lib/plugin/util":54}],24:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.pie=pie;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _pie=require("../config/pie");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var pies=(0,_util2.initNeedSeries)(series,_pie.pieConfig,"pie");pies=calcPiesCenter(pies,chart);pies=calcPiesRadius(pies,chart);pies=calcRosePiesRadius(pies,chart);pies=calcPiesPercent(pies);pies=calcPiesAngle(pies,chart);pies=calcPiesInsideLabelPos(pies);pies=calcPiesEdgeCenterPos(pies);pies=calcPiesOutSideLabelPos(pies);(0,_updater.doUpdate)({chart:chart,series:pies,key:"pie",getGraphConfig:getPieConfig,getStartGraphConfig:getStartPieConfig,beforeChange:beforeChangePie});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieInsideLabel",getGraphConfig:getInsideLabelConfig});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieOutsideLabelLine",getGraphConfig:getOutsideLabelLineConfig,getStartGraphConfig:getStartOutsideLabelLineConfig});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieOutsideLabel",getGraphConfig:getOutsideLabelConfig,getStartGraphConfig:getStartOutsideLabelConfig})}function calcPiesCenter(pies,chart){var area=chart.render.area;pies.forEach(function(pie){var center=pie.center;center=center.map(function(pos,i){if(typeof pos==="number")return pos;return parseInt(pos)/100*area[i]});pie.center=center});return pies}function calcPiesRadius(pies,chart){var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(chart.render.area))/2;pies.forEach(function(pie){var radius=pie.radius,data=pie.data;radius=getNumberRadius(radius,maxRadius);data.forEach(function(item){var itemRadius=item.radius;if(!itemRadius)itemRadius=radius;itemRadius=getNumberRadius(itemRadius,maxRadius);item.radius=itemRadius});pie.radius=radius});return pies}function getNumberRadius(radius,maxRadius){if(!(radius instanceof Array))radius=[0,radius];radius=radius.map(function(r){if(typeof r==="number")return r;return parseInt(r)/100*maxRadius});return radius}function calcRosePiesRadius(pies,chart){var rosePie=pies.filter(function(_ref){var roseType=_ref.roseType;return roseType});rosePie.forEach(function(pie){var radius=pie.radius,data=pie.data,roseSort=pie.roseSort;var roseIncrement=getRoseIncrement(pie);var dataCopy=(0,_toConsumableArray2["default"])(data);data=sortData(data);data.forEach(function(item,i){item.radius[1]=radius[1]-roseIncrement*i});if(roseSort){data.reverse()}else{pie.data=dataCopy}pie.roseIncrement=roseIncrement});return pies}function sortData(data){return data.sort(function(_ref2,_ref3){var a=_ref2.value;var b=_ref3.value;if(a===b)return 0;if(a>b)return-1;if(a1&&arguments[1]!==undefined?arguments[1]:true;var data=pieItem.data,center=pieItem.center;var centerXPos=center[0];return data.filter(function(_ref9){var edgeCenterPos=_ref9.edgeCenterPos;var xPos=edgeCenterPos[0];if(left)return xPos<=centerXPos;return xPos>centerXPos})}function sortPiesFromTopToBottom(dataItem){dataItem.sort(function(_ref10,_ref11){var _ref10$edgeCenterPos=(0,_slicedToArray2["default"])(_ref10.edgeCenterPos,2),t=_ref10$edgeCenterPos[0],ay=_ref10$edgeCenterPos[1];var _ref11$edgeCenterPos=(0,_slicedToArray2["default"])(_ref11.edgeCenterPos,2),tt=_ref11$edgeCenterPos[0],by=_ref11$edgeCenterPos[1];if(ay>by)return 1;if(ay2&&arguments[2]!==undefined?arguments[2]:true;var center=pieItem.center,outsideLabel=pieItem.outsideLabel;var radius=getLabelLineBendRadius(pieItem);dataItem.forEach(function(item){var edgeCenterPos=item.edgeCenterPos,startAngle=item.startAngle,endAngle=item.endAngle;var labelLineEndLength=outsideLabel.labelLineEndLength;var angle=(startAngle+endAngle)/2;var bendPoint=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,angle]));var endPoint=(0,_toConsumableArray2["default"])(bendPoint);endPoint[0]+=labelLineEndLength*(left?-1:1);item.labelLine=[edgeCenterPos,bendPoint,endPoint];item.labelLineLength=(0,_util2.getPolylineLength)(item.labelLine);item.align={textAlign:"left",textBaseline:"middle"};if(left)item.align.textAlign="right"})}function getPieConfig(pieItem){var data=pieItem.data,animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"pie",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getPieShape(pieItem,i),style:getPieStyle(pieItem,i)}})}function getStartPieConfig(pieItem){var animationDelayGap=pieItem.animationDelayGap,startAnimationCurve=pieItem.startAnimationCurve;var configs=getPieConfig(pieItem);configs.forEach(function(config,i){config.animationCurve=startAnimationCurve;config.animationDelay=i*animationDelayGap;config.shape.or=config.shape.ir});return configs}function beforeChangePie(graph){graph.animationDelay=0}function getPieShape(pieItem,i){var center=pieItem.center,data=pieItem.data;var dataItem=data[i];var radius=dataItem.radius,startAngle=dataItem.startAngle,endAngle=dataItem.endAngle;return{startAngle:startAngle,endAngle:endAngle,ir:radius[0],or:radius[1],rx:center[0],ry:center[1]}}function getPieStyle(pieItem,i){var pieStyle=pieItem.pieStyle,data=pieItem.data;var dataItem=data[i];var color=dataItem.color;return(0,_util2.deepMerge)({fill:color},pieStyle)}function getInsideLabelConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:pieItem.insideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getInsideLabelShape(pieItem,i),style:getInsideLabelStyle(pieItem,i)}})}function getInsideLabelShape(pieItem,i){var insideLabel=pieItem.insideLabel,data=pieItem.data;var formatter=insideLabel.formatter;var dataItem=data[i];var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",dataItem.name);label=label.replace("{percent}",dataItem.percent);label=label.replace("{value}",dataItem.value)}if(formatterType==="function"){label=formatter(dataItem)}return{content:label,position:dataItem.insideLabelPos}}function getInsideLabelStyle(pieItem,i){var style=pieItem.insideLabel.style;return style}function getOutsideLabelLineConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"polyline",index:rLevel,visible:pieItem.outsideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getOutsideLabelLineShape(pieItem,i),style:getOutsideLabelLineStyle(pieItem,i)}})}function getStartOutsideLabelLineConfig(pieItem){var data=pieItem.data;var configs=getOutsideLabelLineConfig(pieItem);configs.forEach(function(config,i){config.style.lineDash=[0,data[i].labelLineLength]});return configs}function getOutsideLabelLineShape(pieItem,i){var data=pieItem.data;var dataItem=data[i];return{points:dataItem.labelLine}}function getOutsideLabelLineStyle(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var labelLineStyle=outsideLabel.labelLineStyle;var color=data[i].color;return(0,_util2.deepMerge)({stroke:color,lineDash:[data[i].labelLineLength,0]},labelLineStyle)}function getOutsideLabelConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:pieItem.outsideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getOutsideLabelShape(pieItem,i),style:getOutsideLabelStyle(pieItem,i)}})}function getStartOutsideLabelConfig(pieItem){var data=pieItem.data;var configs=getOutsideLabelConfig(pieItem);configs.forEach(function(config,i){config.shape.position=data[i].labelLine[1]});return configs}function getOutsideLabelShape(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var formatter=outsideLabel.formatter;var _data$i=data[i],labelLine=_data$i.labelLine,name=_data$i.name,percent=_data$i.percent,value=_data$i.value;var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",name);label=label.replace("{percent}",percent);label=label.replace("{value}",value)}if(formatterType==="function"){label=formatter(data[i])}return{content:label,position:labelLine[2]}}function getOutsideLabelStyle(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var _data$i2=data[i],color=_data$i2.color,align=_data$i2.align;var style=outsideLabel.style;return(0,_util2.deepMerge)(_objectSpread({fill:color},align),style)}},{"../class/updater.class":3,"../config/pie":12,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],25:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.radar=radar;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _index=require("../config/index");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var radars=(0,_util2.initNeedSeries)(series,_index.radarConfig,"radar");radars=calcRadarPosition(radars,chart);radars=calcRadarLabelPosition(radars,chart);radars=calcRadarLabelAlign(radars,chart);(0,_updater.doUpdate)({chart:chart,series:radars,key:"radar",getGraphConfig:getRadarConfig,getStartGraphConfig:getStartRadarConfig,beforeChange:beforeChangeRadar});(0,_updater.doUpdate)({chart:chart,series:radars,key:"radarPoint",getGraphConfig:getPointConfig,getStartGraphConfig:getStartPointConfig});(0,_updater.doUpdate)({chart:chart,series:radars,key:"radarLabel",getGraphConfig:getLabelConfig})}function calcRadarPosition(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var indicator=radarAxis.indicator,axisLineAngles=radarAxis.axisLineAngles,radius=radarAxis.radius,centerPos=radarAxis.centerPos;radars.forEach(function(radarItem){var data=radarItem.data;radarItem.dataRadius=[];radarItem.radarPosition=indicator.map(function(_ref,i){var max=_ref.max,min=_ref.min;var v=data[i];if(typeof max!=="number")max=v;if(typeof min!=="number")min=0;if(typeof v!=="number")v=min;var dataRadius=(v-min)/(max-min)*radius;radarItem.dataRadius[i]=dataRadius;return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([dataRadius,axisLineAngles[i]]))})});return radars}function calcRadarLabelPosition(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var centerPos=radarAxis.centerPos,axisLineAngles=radarAxis.axisLineAngles;radars.forEach(function(radarItem){var dataRadius=radarItem.dataRadius,label=radarItem.label;var labelGap=label.labelGap;radarItem.labelPosition=dataRadius.map(function(r,i){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([r+labelGap,axisLineAngles[i]]))})});return radars}function calcRadarLabelAlign(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var _radarAxis$centerPos=(0,_slicedToArray2["default"])(radarAxis.centerPos,2),x=_radarAxis$centerPos[0],y=_radarAxis$centerPos[1];radars.forEach(function(radarItem){var labelPosition=radarItem.labelPosition;var labelAlign=labelPosition.map(function(_ref2){var _ref3=(0,_slicedToArray2["default"])(_ref2,2),lx=_ref3[0],ly=_ref3[1];var textAlign=lx>x?"left":"right";var textBaseline=ly>y?"top":"bottom";return{textAlign:textAlign,textBaseline:textBaseline}});radarItem.labelAlign=labelAlign});return radars}function getRadarConfig(radarItem){var animationCurve=radarItem.animationCurve,animationFrame=radarItem.animationFrame,rLevel=radarItem.rLevel;return[{name:"polyline",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getRadarShape(radarItem),style:getRadarStyle(radarItem)}]}function getStartRadarConfig(radarItem,updater){var centerPos=updater.chart.radarAxis.centerPos;var config=getRadarConfig(radarItem)[0];var pointNum=config.shape.points.length;var points=new Array(pointNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(centerPos)});config.shape.points=points;return[config]}function getRadarShape(radarItem){var radarPosition=radarItem.radarPosition;return{points:radarPosition,close:true}}function getRadarStyle(radarItem){var radarStyle=radarItem.radarStyle,color=radarItem.color;var colorRgbaValue=(0,_color.getRgbaValue)(color);colorRgbaValue[3]=.5;var radarDefaultColor={stroke:color,fill:(0,_color.getColorFromRgbValue)(colorRgbaValue)};return(0,_util2.deepMerge)(radarDefaultColor,radarStyle)}function beforeChangeRadar(graph,_ref4){var shape=_ref4.shape;var graphPoints=graph.shape.points;var graphPointsNum=graphPoints.length;var pointsNum=shape.points.length;if(pointsNum>graphPointsNum){var lastPoint=graphPoints.slice(-1)[0];var newAddPoints=new Array(pointsNum-graphPointsNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(lastPoint)});graphPoints.push.apply(graphPoints,(0,_toConsumableArray2["default"])(newAddPoints))}else if(pointsNum1&&arguments[1]!==undefined?arguments[1]:{};var radar=option.radar;var radarAxis=[];if(radar){radarAxis=mergeRadarAxisDefaultConfig(radar);radarAxis=calcRadarAxisCenter(radarAxis,chart);radarAxis=calcRadarAxisRingRadius(radarAxis,chart);radarAxis=calcRadarAxisLinePosition(radarAxis);radarAxis=calcRadarAxisAreaRadius(radarAxis);radarAxis=calcRadarAxisLabelPosition(radarAxis);radarAxis=[radarAxis]}var radarAxisForUpdate=radarAxis;if(radarAxis.length&&!radarAxis[0].show)radarAxisForUpdate=[];(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisSplitArea",getGraphConfig:getSplitAreaConfig,beforeUpdate:beforeUpdateSplitArea,beforeChange:beforeChangeSplitArea});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisSplitLine",getGraphConfig:getSplitLineConfig,beforeUpdate:beforeUpdateSplitLine,beforeChange:beforeChangeSplitLine});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisLine",getGraphConfig:getAxisLineConfig});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisLable",getGraphConfig:getAxisLabelConfig});chart.radarAxis=radarAxis[0]}function mergeRadarAxisDefaultConfig(radar){return(0,_util2.deepMerge)((0,_util.deepClone)(_index.radarAxisConfig),radar)}function calcRadarAxisCenter(radarAxis,chart){var area=chart.render.area;var center=radarAxis.center;radarAxis.centerPos=center.map(function(v,i){if(typeof v==="number")return v;return parseInt(v)/100*area[i]});return radarAxis}function calcRadarAxisRingRadius(radarAxis,chart){var area=chart.render.area;var splitNum=radarAxis.splitNum,radius=radarAxis.radius;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;if(typeof radius!=="number")radius=parseInt(radius)/100*maxRadius;var splitGap=radius/splitNum;radarAxis.ringRadius=new Array(splitNum).fill(0).map(function(foo,i){return splitGap*(i+1)});radarAxis.radius=radius;return radarAxis}function calcRadarAxisLinePosition(radarAxis){var indicator=radarAxis.indicator,centerPos=radarAxis.centerPos,radius=radarAxis.radius,startAngle=radarAxis.startAngle;var fullAngle=Math.PI*2;var indicatorNum=indicator.length;var indicatorGap=fullAngle/indicatorNum;var angles=new Array(indicatorNum).fill(0).map(function(foo,i){return indicatorGap*i+startAngle});radarAxis.axisLineAngles=angles;radarAxis.axisLinePosition=angles.map(function(g){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([radius,g]))});return radarAxis}function calcRadarAxisAreaRadius(radarAxis){var ringRadius=radarAxis.ringRadius;var subRadius=ringRadius[0]/2;radarAxis.areaRadius=ringRadius.map(function(r){return r-subRadius});return radarAxis}function calcRadarAxisLabelPosition(radarAxis){var axisLineAngles=radarAxis.axisLineAngles,centerPos=radarAxis.centerPos,radius=radarAxis.radius,axisLabel=radarAxis.axisLabel;radius+=axisLabel.labelGap;radarAxis.axisLabelPosition=axisLineAngles.map(function(angle){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([radius,angle]))});return radarAxis}function getSplitAreaConfig(radarAxis){var areaRadius=radarAxis.areaRadius,polygon=radarAxis.polygon,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;var name=polygon?"regPolygon":"ring";return areaRadius.map(function(foo,i){return{name:name,index:rLevel,visible:radarAxis.splitArea.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getSplitAreaShape(radarAxis,i),style:getSplitAreaStyle(radarAxis,i)}})}function getSplitAreaShape(radarAxis,i){var polygon=radarAxis.polygon,areaRadius=radarAxis.areaRadius,indicator=radarAxis.indicator,centerPos=radarAxis.centerPos;var indicatorNum=indicator.length;var shape={rx:centerPos[0],ry:centerPos[1],r:areaRadius[i]};if(polygon)shape.side=indicatorNum;return shape}function getSplitAreaStyle(radarAxis,i){var splitArea=radarAxis.splitArea,ringRadius=radarAxis.ringRadius,axisLineAngles=radarAxis.axisLineAngles,polygon=radarAxis.polygon,centerPos=radarAxis.centerPos;var color=splitArea.color,style=splitArea.style;style=_objectSpread({fill:"rgba(0, 0, 0, 0)"},style);var lineWidth=ringRadius[0]-0;if(polygon){var point1=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([ringRadius[0],axisLineAngles[0]]));var point2=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([ringRadius[0],axisLineAngles[1]]));lineWidth=(0,_util2.getPointToLineDistance)(centerPos,point1,point2)}style=(0,_util2.deepMerge)((0,_util.deepClone)(style,true),{lineWidth:lineWidth});if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function beforeUpdateSplitArea(graphs,radarAxis,i,updater){var cache=graphs[i];if(!cache)return;var render=updater.chart.render;var polygon=radarAxis.polygon;var name=cache[0].name;var currentName=polygon?"regPolygon":"ring";var delAll=currentName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeSplitArea(graph,config){var side=config.shape.side;if(typeof side!=="number")return;graph.shape.side=side}function getSplitLineConfig(radarAxis){var ringRadius=radarAxis.ringRadius,polygon=radarAxis.polygon,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;var name=polygon?"regPolygon":"ring";return ringRadius.map(function(foo,i){return{name:name,index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,visible:radarAxis.splitLine.show,shape:getSplitLineShape(radarAxis,i),style:getSplitLineStyle(radarAxis,i)}})}function getSplitLineShape(radarAxis,i){var ringRadius=radarAxis.ringRadius,centerPos=radarAxis.centerPos,indicator=radarAxis.indicator,polygon=radarAxis.polygon;var shape={rx:centerPos[0],ry:centerPos[1],r:ringRadius[i]};var indicatorNum=indicator.length;if(polygon)shape.side=indicatorNum;return shape}function getSplitLineStyle(radarAxis,i){var splitLine=radarAxis.splitLine;var color=splitLine.color,style=splitLine.style;style=_objectSpread({fill:"rgba(0, 0, 0, 0)"},style);if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function beforeUpdateSplitLine(graphs,radarAxis,i,updater){var cache=graphs[i];if(!cache)return;var render=updater.chart.render;var polygon=radarAxis.polygon;var name=cache[0].name;var currenName=polygon?"regPolygon":"ring";var delAll=currenName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeSplitLine(graph,config){var side=config.shape.side;if(typeof side!=="number")return;graph.shape.side=side}function getAxisLineConfig(radarAxis){var axisLinePosition=radarAxis.axisLinePosition,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;return axisLinePosition.map(function(foo,i){return{name:"polyline",index:rLevel,visible:radarAxis.axisLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLineShape(radarAxis,i),style:getAxisLineStyle(radarAxis,i)}})}function getAxisLineShape(radarAxis,i){var centerPos=radarAxis.centerPos,axisLinePosition=radarAxis.axisLinePosition;var points=[centerPos,axisLinePosition[i]];return{points:points}}function getAxisLineStyle(radarAxis,i){var axisLine=radarAxis.axisLine;var color=axisLine.color,style=axisLine.style;if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function getAxisLabelConfig(radarAxis){var axisLabelPosition=radarAxis.axisLabelPosition,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;return axisLabelPosition.map(function(foo,i){return{name:"text",index:rLevel,visible:radarAxis.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLableShape(radarAxis,i),style:getAxisLableStyle(radarAxis,i)}})}function getAxisLableShape(radarAxis,i){var axisLabelPosition=radarAxis.axisLabelPosition,indicator=radarAxis.indicator;return{content:indicator[i].name,position:axisLabelPosition[i]}}function getAxisLableStyle(radarAxis,i){var axisLabel=radarAxis.axisLabel,_radarAxis$centerPos=(0,_slicedToArray2["default"])(radarAxis.centerPos,2),x=_radarAxis$centerPos[0],y=_radarAxis$centerPos[1],axisLabelPosition=radarAxis.axisLabelPosition;var color=axisLabel.color,style=axisLabel.style;var _axisLabelPosition$i=(0,_slicedToArray2["default"])(axisLabelPosition[i],2),labelXpos=_axisLabelPosition$i[0],labelYPos=_axisLabelPosition$i[1];var textAlign=labelXpos>x?"left":"right";var textBaseline=labelYPos>y?"top":"bottom";style=(0,_util2.deepMerge)({textAlign:textAlign,textBaseline:textBaseline},style);if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{fill:color[i%colorNum]})}},{"../class/updater.class":3,"../config/index":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render/lib/plugin/util":54}],27:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.title=title;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function title(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var title=[];if(option.title){title[0]=(0,_util2.deepMerge)((0,_util.deepClone)(_config.titleConfig,true),option.title)}(0,_updater.doUpdate)({chart:chart,series:title,key:"title",getGraphConfig:getTitleConfig})}function getTitleConfig(titleItem,updater){var animationCurve=_config.titleConfig.animationCurve,animationFrame=_config.titleConfig.animationFrame,rLevel=_config.titleConfig.rLevel;var shape=getTitleShape(titleItem,updater);var style=getTitleStyle(titleItem);return[{name:"text",index:rLevel,visible:titleItem.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}]}function getTitleShape(titleItem,updater){var offset=titleItem.offset,text=titleItem.text;var _updater$chart$gridAr=updater.chart.gridArea,x=_updater$chart$gridAr.x,y=_updater$chart$gridAr.y,w=_updater$chart$gridAr.w;var _offset=(0,_slicedToArray2["default"])(offset,2),ox=_offset[0],oy=_offset[1];return{content:text,position:[x+w/2+ox,y+oy]}}function getTitleStyle(titleItem){var style=titleItem.style;return style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@jiaminghi/c-render/lib/plugin/util":54}],28:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _cRender=require("@jiaminghi/c-render");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _index=require("../util/index");var pie={shape:{rx:0,ry:0,ir:0,or:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref){var shape=_ref.shape;var keys=["rx","ry","ir","or","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Pie shape configuration is abnormal!");return false}return true},draw:function draw(_ref2,_ref3){var ctx=_ref2.ctx;var shape=_ref3.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,ir=shape.ir,or=shape.or,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;rx=parseInt(rx)+.5;ry=parseInt(ry)+.5;ctx.arc(rx,ry,ir>0?ir:0,startAngle,endAngle,!clockWise);var connectPoint1=(0,_util.getCircleRadianPoint)(rx,ry,or,endAngle).map(function(p){return parseInt(p)+.5});var connectPoint2=(0,_util.getCircleRadianPoint)(rx,ry,ir,startAngle).map(function(p){return parseInt(p)+.5});ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(connectPoint1));ctx.arc(rx,ry,or>0?or:0,endAngle,startAngle,clockWise);ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(connectPoint2));ctx.closePath();ctx.stroke();ctx.fill()}};var agArc={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,gradientStartAngle:null,gradientEndAngle:null},validator:function validator(_ref4){var shape=_ref4.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("AgArc shape configuration is abnormal!");return false}return true},draw:function draw(_ref5,_ref6){var ctx=_ref5.ctx;var shape=_ref6.shape,style=_ref6.style;var gradient=style.gradient;gradient=gradient.map(function(cv){return(0,_color.getColorFromRgbValue)(cv)});if(gradient.length===1){gradient=[gradient[0],gradient[0]]}var gradientArcNum=gradient.length-1;var gradientStartAngle=shape.gradientStartAngle,gradientEndAngle=shape.gradientEndAngle,startAngle=shape.startAngle,endAngle=shape.endAngle,r=shape.r,rx=shape.rx,ry=shape.ry;if(gradientStartAngle===null)gradientStartAngle=startAngle;if(gradientEndAngle===null)gradientEndAngle=endAngle;var angleGap=(gradientEndAngle-gradientStartAngle)/gradientArcNum;if(angleGap===Math.PI*2)angleGap=Math.PI*2-.001;for(var i=0;iendAngle){arcEndAngle=endAngle;doBreak=true}ctx.arc(rx,ry,r,arcStartAngle,arcEndAngle);ctx.strokeStyle=color;ctx.stroke();if(doBreak)break}}};var numberText={shape:{number:[],content:"",position:[0,0],toFixed:0},validator:function validator(_ref7){var shape=_ref7.shape;var number=shape.number,content=shape.content,position=shape.position;if(!(number instanceof Array)||typeof content!=="string"||!(position instanceof Array)){console.error("NumberText shape configuration is abnormal!");return false}return true},draw:function draw(_ref8,_ref9){var ctx=_ref8.ctx;var shape=_ref9.shape;ctx.beginPath();var number=shape.number,content=shape.content,position=shape.position,toFixed=shape.toFixed;var textSegments=content.split("{nt}");var lastSegmentIndex=textSegments.length-1;var textString="";textSegments.forEach(function(t,i){var currentNumber=number[i];if(i===lastSegmentIndex)currentNumber="";if(typeof currentNumber==="number")currentNumber=currentNumber.toFixed(toFixed);textString+=t+(currentNumber||"")});ctx.closePath();ctx.strokeText.apply(ctx,[textString].concat((0,_toConsumableArray2["default"])(position)));ctx.fillText.apply(ctx,[textString].concat((0,_toConsumableArray2["default"])(position)))}};var lineIcon={shape:{x:0,y:0,w:0,h:0},validator:function validator(_ref10){var shape=_ref10.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"){console.error("lineIcon shape configuration is abnormal!");return false}return true},draw:function draw(_ref11,_ref12){var ctx=_ref11.ctx;var shape=_ref12.shape;ctx.beginPath();var x=shape.x,y=shape.y,w=shape.w,h=shape.h;var halfH=h/2;ctx.strokeStyle=ctx.fillStyle;ctx.moveTo(x,y+halfH);ctx.lineTo(x+w,y+halfH);ctx.lineWidth=1;ctx.stroke();ctx.beginPath();var radius=halfH-5*2;if(radius<=0)radius=3;ctx.arc(x+w/2,y+halfH,radius,0,Math.PI*2);ctx.lineWidth=5;ctx.stroke();ctx.fillStyle="#fff";ctx.fill()},hoverCheck:function hoverCheck(position,_ref13){var shape=_ref13.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;return(0,_util.checkPointIsInRect)(position,x,y,w,h)},setGraphCenter:function setGraphCenter(e,_ref14){var shape=_ref14.shape,style=_ref14.style;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;style.graphCenter=[x+w/2,y+h/2]}};(0,_cRender.extendNewGraph)("pie",pie);(0,_cRender.extendNewGraph)("agArc",agArc);(0,_cRender.extendNewGraph)("numberText",numberText);(0,_cRender.extendNewGraph)("lineIcon",lineIcon)},{"../util/index":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],29:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"changeDefaultConfig",{enumerable:true,get:function get(){return _config.changeDefaultConfig}});exports["default"]=void 0;var _charts=_interopRequireDefault(require("./class/charts.class"));var _config=require("./config");var _default=_charts["default"];exports["default"]=_default},{"./class/charts.class":2,"./config":9,"@babel/runtime/helpers/interopRequireDefault":36}],30:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.filterNonNumber=filterNonNumber;exports.deepMerge=deepMerge;exports.mulAdd=mulAdd;exports.mergeSameStackData=mergeSameStackData;exports.getTwoPointDistance=getTwoPointDistance;exports.getLinearGradientColor=getLinearGradientColor;exports.getPolylineLength=getPolylineLength;exports.getPointToLineDistance=getPointToLineDistance;exports.initNeedSeries=initNeedSeries;exports.radianToAngle=radianToAngle;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _util=require("@jiaminghi/c-render/lib/plugin/util");function filterNonNumber(array){return array.filter(function(n){return typeof n==="number"})}function deepMerge(target,merged){for(var key in merged){target[key]=target[key]&&(0,_typeof2["default"])(target[key])==="object"?deepMerge(target[key],merged[key]):target[key]=merged[key]}return target}function mulAdd(nums){nums=filterNonNumber(nums);return nums.reduce(function(all,num){return all+num},0)}function mergeSameStackData(item,series){var stack=item.stack;if(!stack)return(0,_toConsumableArray2["default"])(item.data);var stacks=series.filter(function(_ref){var s=_ref.stack;return s===stack});var index=stacks.findIndex(function(_ref2){var d=_ref2.data;return d===item.data});var datas=stacks.splice(0,index+1).map(function(_ref3){var data=_ref3.data;return data});var dataLength=datas[0].length;return new Array(dataLength).fill(0).map(function(foo,i){return mulAdd(datas.map(function(d){return d[i]}))})}function getTwoPointDistance(pointOne,pointTwo){var minusX=Math.abs(pointOne[0]-pointTwo[0]);var minusY=Math.abs(pointOne[1]-pointTwo[1]);return Math.sqrt(minusX*minusX+minusY*minusY)}function getLinearGradientColor(ctx,begin,end,color){if(!ctx||!begin||!end||!color.length)return;var colors=color;typeof colors==="string"&&(colors=[color,color]);var linearGradientColor=ctx.createLinearGradient.apply(ctx,(0,_toConsumableArray2["default"])(begin).concat((0,_toConsumableArray2["default"])(end)));var colorGap=1/(colors.length-1);colors.forEach(function(c,i){return linearGradientColor.addColorStop(colorGap*i,c)});return linearGradientColor}function getPolylineLength(points){var lineSegments=new Array(points.length-1).fill(0).map(function(foo,i){return[points[i],points[i+1]]});var lengths=lineSegments.map(function(item){return getTwoPointDistance.apply(void 0,(0,_toConsumableArray2["default"])(item))});return mulAdd(lengths)}function getPointToLineDistance(point,linePointOne,linePointTwo){var a=getTwoPointDistance(point,linePointOne);var b=getTwoPointDistance(point,linePointTwo);var c=getTwoPointDistance(linePointOne,linePointTwo);return.5*Math.sqrt((a+b+c)*(a+b-c)*(a+c-b)*(b+c-a))/c}function initNeedSeries(series,config,type){series=series.filter(function(_ref4){var st=_ref4.type;return st===type});series=series.map(function(item){return deepMerge((0,_util.deepClone)(config,true),item)});return series.filter(function(_ref5){var show=_ref5.show;return show})}function radianToAngle(radian){return radian/Math.PI*180}},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],31:[function(require,module,exports){function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}module.exports=_arrayWithHoles},{}],32:[function(require,module,exports){function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i1&&arguments[1]!==undefined?arguments[1]:5;var segmentsNum=bezierCurve.length-1;var startPoint=bezierCurve[0];var endPoint=bezierCurve[segmentsNum][2];var segments=bezierCurve.slice(1);var getSegmentTPointFuns=segments.map(function(seg,i){var beginPoint=i===0?startPoint:segments[i-1][2];return createGetBezierCurveTPointFun.apply(void 0,[beginPoint].concat((0,_toConsumableArray2["default"])(seg)))});var segmentPointsNum=new Array(segmentsNum).fill(defaultSegmentPointsNum);var segmentPoints=getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum);var result=calcUniformPointsByIteration(segmentPoints,getSegmentTPointFuns,segments,precision);result.segmentPoints.push(endPoint);return result}function createGetBezierCurveTPointFun(beginPoint,controlPoint1,controlPoint2,endPoint){return function(t){var tSubed1=1-t;var tSubed1Pow3=pow(tSubed1,3);var tSubed1Pow2=pow(tSubed1,2);var tPow3=pow(t,3);var tPow2=pow(t,2);return[beginPoint[0]*tSubed1Pow3+3*controlPoint1[0]*t*tSubed1Pow2+3*controlPoint2[0]*tPow2*tSubed1+endPoint[0]*tPow3,beginPoint[1]*tSubed1Pow3+3*controlPoint1[1]*t*tSubed1Pow2+3*controlPoint2[1]*tPow2*tSubed1+endPoint[1]*tPow3]}}function getTwoPointDistance(_ref,_ref2){var _ref3=(0,_slicedToArray2["default"])(_ref,2),ax=_ref3[0],ay=_ref3[1];var _ref4=(0,_slicedToArray2["default"])(_ref2,2),bx=_ref4[0],by=_ref4[1];return sqrt(pow(ax-bx,2)+pow(ay-by,2))}function getNumsSum(nums){return nums.reduce(function(sum,num){return sum+num},0)}function getSegmentPointsDistance(segmentPoints){return segmentPoints.map(function(points,i){return new Array(points.length-1).fill(0).map(function(temp,j){return getTwoPointDistance(points[j],points[j+1])})})}function getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum){return getSegmentTPointFuns.map(function(getSegmentTPointFun,i){var tGap=1/segmentPointsNum[i];return new Array(segmentPointsNum[i]).fill("").map(function(foo,j){return getSegmentTPointFun(j*tGap)})})}function getAllDeviations(segmentPointsDistance,avgLength){return segmentPointsDistance.map(function(seg){return seg.map(function(s){return abs(s-avgLength)})}).map(function(seg){return getNumsSum(seg)}).reduce(function(total,v){return total+v},0)}function calcUniformPointsByIteration(segmentPoints,getSegmentTPointFuns,segments,precision){var rounds=4;var cycles=1;var _loop=function _loop(){var totalPointsNum=segmentPoints.reduce(function(total,seg){return total+seg.length},0);segmentPoints.forEach(function(seg,i){return seg.push(segments[i][2])});var segmentPointsDistance=getSegmentPointsDistance(segmentPoints);var lineSegmentNum=segmentPointsDistance.reduce(function(total,seg){return total+seg.length},0);var segmentlength=segmentPointsDistance.map(function(seg){return getNumsSum(seg)});var totalLength=getNumsSum(segmentlength);var avgLength=totalLength/lineSegmentNum;var allDeviations=getAllDeviations(segmentPointsDistance,avgLength);if(allDeviations<=precision)return"break";totalPointsNum=ceil(avgLength/precision*totalPointsNum*1.1);var segmentPointsNum=segmentlength.map(function(length){return ceil(length/totalLength*totalPointsNum)});segmentPoints=getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum);totalPointsNum=segmentPoints.reduce(function(total,seg){return total+seg.length},0);var segmentPointsForLength=JSON.parse(JSON.stringify(segmentPoints));segmentPointsForLength.forEach(function(seg,i){return seg.push(segments[i][2])});segmentPointsDistance=getSegmentPointsDistance(segmentPointsForLength);lineSegmentNum=segmentPointsDistance.reduce(function(total,seg){return total+seg.length},0);segmentlength=segmentPointsDistance.map(function(seg){return getNumsSum(seg)});totalLength=getNumsSum(segmentlength);avgLength=totalLength/lineSegmentNum;var stepSize=1/totalPointsNum/10;getSegmentTPointFuns.forEach(function(getSegmentTPointFun,i){var currentSegmentPointsNum=segmentPointsNum[i];var t=new Array(currentSegmentPointsNum).fill("").map(function(foo,j){return j/segmentPointsNum[i]});for(var r=0;r1)t[j]=1;if(t[j]<0)t[j]=0;segmentPoints[i][j]=getSegmentTPointFun(t[j])}}});rounds*=4;cycles++};do{var _ret=_loop();if(_ret==="break")break}while(rounds<=1025);segmentPoints=segmentPoints.reduce(function(all,seg){return all.concat(seg)},[]);return{segmentPoints:segmentPoints,cycles:cycles,rounds:rounds}}function bezierCurveToPolyline(bezierCurve){var precision=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(!bezierCurve){console.error("bezierCurveToPolyline: Missing parameters!");return false}if(!(bezierCurve instanceof Array)){console.error("bezierCurveToPolyline: Parameter bezierCurve must be an array!");return false}if(typeof precision!=="number"){console.error("bezierCurveToPolyline: Parameter precision must be a number!");return false}var _abstractBezierCurveT=abstractBezierCurveToPolyline(bezierCurve,precision),segmentPoints=_abstractBezierCurveT.segmentPoints;return segmentPoints}function getBezierCurveLength(bezierCurve){var precision=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(!bezierCurve){console.error("getBezierCurveLength: Missing parameters!");return false}if(!(bezierCurve instanceof Array)){console.error("getBezierCurveLength: Parameter bezierCurve must be an array!");return false}if(typeof precision!=="number"){console.error("getBezierCurveLength: Parameter precision must be a number!");return false}var _abstractBezierCurveT2=abstractBezierCurveToPolyline(bezierCurve,precision),segmentPoints=_abstractBezierCurveT2.segmentPoints;var pointsDistance=getSegmentPointsDistance([segmentPoints])[0];var length=getNumsSum(pointsDistance);return length}var _default=bezierCurveToPolyline;exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42}],46:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));function polylineToBezierCurve(polyline){var close=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var offsetA=arguments.length>2&&arguments[2]!==undefined?arguments[2]:.25;var offsetB=arguments.length>3&&arguments[3]!==undefined?arguments[3]:.25;if(!(polyline instanceof Array)){console.error("polylineToBezierCurve: Parameter polyline must be an array!");return false}if(polyline.length<=2){console.error("polylineToBezierCurve: Converting to a curve requires at least 3 points!");return false}var startPoint=polyline[0];var bezierCurveLineNum=polyline.length-1;var bezierCurvePoints=new Array(bezierCurveLineNum).fill(0).map(function(foo,i){return[].concat((0,_toConsumableArray2["default"])(getBezierCurveLineControlPoints(polyline,i,close,offsetA,offsetB)),[polyline[i+1]])});if(close)closeBezierCurve(bezierCurvePoints,startPoint);bezierCurvePoints.unshift(polyline[0]);return bezierCurvePoints}function getBezierCurveLineControlPoints(polyline,index){var close=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var offsetA=arguments.length>3&&arguments[3]!==undefined?arguments[3]:.25;var offsetB=arguments.length>4&&arguments[4]!==undefined?arguments[4]:.25;var pointNum=polyline.length;if(pointNum<3||index>=pointNum)return;var beforePointIndex=index-1;if(beforePointIndex<0)beforePointIndex=close?pointNum+beforePointIndex:0;var afterPointIndex=index+1;if(afterPointIndex>=pointNum)afterPointIndex=close?afterPointIndex-pointNum:pointNum-1;var afterNextPointIndex=index+2;if(afterNextPointIndex>=pointNum)afterNextPointIndex=close?afterNextPointIndex-pointNum:pointNum-1;var pointBefore=polyline[beforePointIndex];var pointMiddle=polyline[index];var pointAfter=polyline[afterPointIndex];var pointAfterNext=polyline[afterNextPointIndex];return[[pointMiddle[0]+offsetA*(pointAfter[0]-pointBefore[0]),pointMiddle[1]+offsetA*(pointAfter[1]-pointBefore[1])],[pointAfter[0]-offsetB*(pointAfterNext[0]-pointMiddle[0]),pointAfter[1]-offsetB*(pointAfterNext[1]-pointMiddle[1])]]}function closeBezierCurve(bezierCurve,startPoint){var firstSubCurve=bezierCurve[0];var lastSubCurve=bezierCurve.slice(-1)[0];bezierCurve.push([getSymmetryPoint(lastSubCurve[1],lastSubCurve[2]),getSymmetryPoint(firstSubCurve[0],startPoint),startPoint]);return bezierCurve}function getSymmetryPoint(point,centerPoint){var _point=(0,_slicedToArray2["default"])(point,2),px=_point[0],py=_point[1];var _centerPoint=(0,_slicedToArray2["default"])(centerPoint,2),cx=_centerPoint[0],cy=_centerPoint[1];var minusX=cx-px;var minusY=cy-py;return[cx+minusX,cy+minusY]}var _default=polylineToBezierCurve;exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42}],47:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"bezierCurveToPolyline",{enumerable:true,get:function get(){return _bezierCurveToPolyline.bezierCurveToPolyline}});Object.defineProperty(exports,"getBezierCurveLength",{enumerable:true,get:function get(){return _bezierCurveToPolyline.getBezierCurveLength}});Object.defineProperty(exports,"polylineToBezierCurve",{enumerable:true,get:function get(){return _polylineToBezierCurve["default"]}});exports["default"]=void 0;var _bezierCurveToPolyline=require("./core/bezierCurveToPolyline");var _polylineToBezierCurve=_interopRequireDefault(require("./core/polylineToBezierCurve"));var _default={bezierCurveToPolyline:_bezierCurveToPolyline.bezierCurveToPolyline,getBezierCurveLength:_bezierCurveToPolyline.getBezierCurveLength,polylineToBezierCurve:_polylineToBezierCurve["default"]};exports["default"]=_default},{"./core/bezierCurveToPolyline":45,"./core/polylineToBezierCurve":46,"@babel/runtime/helpers/interopRequireDefault":36}],48:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _color=_interopRequireDefault(require("@jiaminghi/color"));var _bezierCurve=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../plugin/util");var _graphs=_interopRequireDefault(require("../config/graphs"));var _graph=_interopRequireDefault(require("./graph.class"));function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i0&&arguments[0]!==undefined?arguments[0]:{};var name=config.name;if(!name){console.error("add Missing parameters!");return}var graphConfig=_graphs["default"].get(name);if(!graphConfig){console.warn("No corresponding graph configuration found!");return}var graph=new _graph["default"](graphConfig,config);if(!graph.validator(graph))return;graph.render=this;this.graphs.push(graph);this.sortGraphsByIndex();this.drawAllGraph();return graph};CRender.prototype.sortGraphsByIndex=function(){var graphs=this.graphs;graphs.sort(function(a,b){if(a.index>b.index)return 1;if(a.index===b.index)return 0;if(a.index1&&arguments[1]!==undefined?arguments[1]:undefined;if(!attrName||change===undefined)return false;var isObject=(0,_typeof2["default"])(this[attrName])==="object";if(isObject)change=(0,_util.deepClone)(change,true);var render=this.render;if(attrName==="style"){this.style.update(change)}else if(isObject){Object.assign(this[attrName],change)}else{this[attrName]=change}if(attrName==="index")render.sortGraphsByIndex();render.drawAllGraph()};Graph.prototype.animation=function(){var _ref2=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(attrName,change){var wait,changeRoot,changeKeys,beforeState,animationFrame,animationCurve,animationDelay,animationFrameState,render,_args2=arguments;return _regenerator["default"].wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:wait=_args2.length>2&&_args2[2]!==undefined?_args2[2]:false;if(!(attrName!=="shape"&&attrName!=="style")){_context2.next=4;break}console.error("Only supported shape and style animation!");return _context2.abrupt("return");case 4:change=(0,_util.deepClone)(change,true);if(attrName==="style")this.style.colorProcessor(change);changeRoot=this[attrName];changeKeys=Object.keys(change);beforeState={};changeKeys.forEach(function(key){return beforeState[key]=changeRoot[key]});animationFrame=this.animationFrame,animationCurve=this.animationCurve,animationDelay=this.animationDelay;animationFrameState=(0,_transition["default"])(animationCurve,beforeState,change,animationFrame,true);this.animationRoot.push(changeRoot);this.animationKeys.push(changeKeys);this.animationFrameState.push(animationFrameState);if(!wait){_context2.next=17;break}return _context2.abrupt("return");case 17:if(!(animationDelay>0)){_context2.next=20;break}_context2.next=20;return delay(animationDelay);case 20:render=this.render;return _context2.abrupt("return",new Promise(function(){var _ref3=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(resolve){return _regenerator["default"].wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return render.launchAnimation();case 2:resolve();case 3:case"end":return _context.stop()}}},_callee)}));return function(_x3){return _ref3.apply(this,arguments)}}()));case 22:case"end":return _context2.stop()}}},_callee2,this)}));return function(_x,_x2){return _ref2.apply(this,arguments)}}();Graph.prototype.turnNextAnimationFrame=function(timeStamp){var animationDelay=this.animationDelay,animationRoot=this.animationRoot,animationKeys=this.animationKeys,animationFrameState=this.animationFrameState,animationPause=this.animationPause;if(animationPause)return;if(Date.now()-timeStamp1&&arguments[1]!==undefined?arguments[1]:false;var processor=reverse?_color.getColorFromRgbValue:_color.getRgbaValue;var colorProcessorKeys=["fill","stroke","shadowColor"];var allKeys=Object.keys(style);var colorKeys=allKeys.filter(function(key){return colorProcessorKeys.find(function(k){return k===key})});colorKeys.forEach(function(key){return style[key]=processor(style[key])});var gradientColor=style.gradientColor,colors=style.colors;if(gradientColor)style.gradientColor=gradientColor.map(function(c){return processor(c)});if(colors){var colorsKeys=Object.keys(colors);colorsKeys.forEach(function(key){return colors[key]=processor(colors[key])})}};Style.prototype.initStyle=function(ctx){initTransform(ctx,this);initGraphStyle(ctx,this);initGradient(ctx,this)};function initTransform(ctx,style){ctx.save();var graphCenter=style.graphCenter,rotate=style.rotate,scale=style.scale,translate=style.translate;if(!(graphCenter instanceof Array))return;ctx.translate.apply(ctx,(0,_toConsumableArray2["default"])(graphCenter));if(rotate)ctx.rotate(rotate*Math.PI/180);if(scale instanceof Array)ctx.scale.apply(ctx,(0,_toConsumableArray2["default"])(scale));if(translate)ctx.translate.apply(ctx,(0,_toConsumableArray2["default"])(translate));ctx.translate(-graphCenter[0],-graphCenter[1])}var autoSetStyleKeys=["lineCap","lineJoin","lineDashOffset","shadowOffsetX","shadowOffsetY","lineWidth","textAlign","textBaseline"];function initGraphStyle(ctx,style){var fill=style.fill,stroke=style.stroke,shadowColor=style.shadowColor,opacity=style.opacity;autoSetStyleKeys.forEach(function(key){if(key||typeof key==="number")ctx[key]=style[key]});fill=(0,_toConsumableArray2["default"])(fill);stroke=(0,_toConsumableArray2["default"])(stroke);shadowColor=(0,_toConsumableArray2["default"])(shadowColor);fill[3]*=opacity;stroke[3]*=opacity;shadowColor[3]*=opacity;ctx.fillStyle=(0,_color.getColorFromRgbValue)(fill);ctx.strokeStyle=(0,_color.getColorFromRgbValue)(stroke);ctx.shadowColor=(0,_color.getColorFromRgbValue)(shadowColor);var lineDash=style.lineDash,shadowBlur=style.shadowBlur;if(lineDash){lineDash=lineDash.map(function(v){return v>=0?v:0});ctx.setLineDash(lineDash)}if(typeof shadowBlur==="number")ctx.shadowBlur=shadowBlur>0?shadowBlur:.001;var fontStyle=style.fontStyle,fontVarient=style.fontVarient,fontWeight=style.fontWeight,fontSize=style.fontSize,fontFamily=style.fontFamily;ctx.font=fontStyle+" "+fontVarient+" "+fontWeight+" "+fontSize+"px"+" "+fontFamily}function initGradient(ctx,style){if(!gradientValidator(style))return;var gradientColor=style.gradientColor,gradientParams=style.gradientParams,gradientType=style.gradientType,gradientWith=style.gradientWith,gradientStops=style.gradientStops,opacity=style.opacity;gradientColor=gradientColor.map(function(color){var colorOpacity=color[3]*opacity;var clonedColor=(0,_toConsumableArray2["default"])(color);clonedColor[3]=colorOpacity;return clonedColor});gradientColor=gradientColor.map(function(c){return(0,_color.getColorFromRgbValue)(c)});if(gradientStops==="auto")gradientStops=getAutoColorStops(gradientColor);var gradient=ctx["create".concat(gradientType.slice(0,1).toUpperCase()+gradientType.slice(1),"Gradient")].apply(ctx,(0,_toConsumableArray2["default"])(gradientParams));gradientStops.forEach(function(stop,i){return gradient.addColorStop(stop,gradientColor[i])});ctx["".concat(gradientWith,"Style")]=gradient}function gradientValidator(style){var gradientColor=style.gradientColor,gradientParams=style.gradientParams,gradientType=style.gradientType,gradientWith=style.gradientWith,gradientStops=style.gradientStops;if(!gradientColor||!gradientParams)return false;if(gradientColor.length===1){console.warn("The gradient needs to provide at least two colors");return false}if(gradientType!=="linear"&&gradientType!=="radial"){console.warn("GradientType only supports linear or radial, current value is "+gradientType);return false}var gradientParamsLength=gradientParams.length;if(gradientType==="linear"&&gradientParamsLength!==4||gradientType==="radial"&&gradientParamsLength!==6){console.warn("The expected length of gradientParams is "+(gradientType==="linear"?"4":"6"));return false}if(gradientWith!=="fill"&&gradientWith!=="stroke"){console.warn("GradientWith only supports fill or stroke, current value is "+gradientWith);return false}if(gradientStops!=="auto"&&!(gradientStops instanceof Array)){console.warn("gradientStops only supports 'auto' or Number Array ([0, .5, 1]), current value is "+gradientStops);return false}return true}function getAutoColorStops(color){var stopGap=1/(color.length-1);return color.map(function(foo,i){return stopGap*i})}Style.prototype.restoreTransform=function(ctx){ctx.restore()};Style.prototype.update=function(change){this.colorProcessor(change);Object.assign(this,change)};Style.prototype.getStyle=function(){var clonedStyle=(0,_util.deepClone)(this,true);this.colorProcessor(clonedStyle,true);return clonedStyle}},{"../plugin/util":54,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/color":56}],51:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.extendNewGraph=extendNewGraph;exports["default"]=exports.text=exports.bezierCurve=exports.smoothline=exports.polyline=exports.regPolygon=exports.sector=exports.arc=exports.ring=exports.rect=exports.ellipse=exports.circle=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _bezierCurve2=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../plugin/util");var _canvas=require("../plugin/canvas");var polylineToBezierCurve=_bezierCurve2["default"].polylineToBezierCurve,bezierCurveToPolyline=_bezierCurve2["default"].bezierCurveToPolyline;var circle={shape:{rx:0,ry:0,r:0},validator:function validator(_ref){var shape=_ref.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;if(typeof rx!=="number"||typeof ry!=="number"||typeof r!=="number"){console.error("Circle shape configuration is abnormal!");return false}return true},draw:function draw(_ref2,_ref3){var ctx=_ref2.ctx;var shape=_ref3.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r;ctx.arc(rx,ry,r>0?r:.01,0,Math.PI*2);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref4){var shape=_ref4.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;return(0,_util.checkPointIsInCircle)(position,rx,ry,r)},setGraphCenter:function setGraphCenter(e,_ref5){var shape=_ref5.shape,style=_ref5.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref6,_ref7){var movementX=_ref6.movementX,movementY=_ref6.movementY;var shape=_ref7.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.circle=circle;var ellipse={shape:{rx:0,ry:0,hr:0,vr:0},validator:function validator(_ref8){var shape=_ref8.shape;var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;if(typeof rx!=="number"||typeof ry!=="number"||typeof hr!=="number"||typeof vr!=="number"){console.error("Ellipse shape configuration is abnormal!");return false}return true},draw:function draw(_ref9,_ref10){var ctx=_ref9.ctx;var shape=_ref10.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;ctx.ellipse(rx,ry,hr>0?hr:.01,vr>0?vr:.01,0,0,Math.PI*2);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref11){var shape=_ref11.shape;var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;var a=Math.max(hr,vr);var b=Math.min(hr,vr);var c=Math.sqrt(a*a-b*b);var leftFocusPoint=[rx-c,ry];var rightFocusPoint=[rx+c,ry];var distance=(0,_util.getTwoPointDistance)(position,leftFocusPoint)+(0,_util.getTwoPointDistance)(position,rightFocusPoint);return distance<=2*a},setGraphCenter:function setGraphCenter(e,_ref12){var shape=_ref12.shape,style=_ref12.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref13,_ref14){var movementX=_ref13.movementX,movementY=_ref13.movementY;var shape=_ref14.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.ellipse=ellipse;var rect={shape:{x:0,y:0,w:0,h:0},validator:function validator(_ref15){var shape=_ref15.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"){console.error("Rect shape configuration is abnormal!");return false}return true},draw:function draw(_ref16,_ref17){var ctx=_ref16.ctx;var shape=_ref17.shape;ctx.beginPath();var x=shape.x,y=shape.y,w=shape.w,h=shape.h;ctx.rect(x,y,w,h);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref18){var shape=_ref18.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;return(0,_util.checkPointIsInRect)(position,x,y,w,h)},setGraphCenter:function setGraphCenter(e,_ref19){var shape=_ref19.shape,style=_ref19.style;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;style.graphCenter=[x+w/2,y+h/2]},move:function move(_ref20,_ref21){var movementX=_ref20.movementX,movementY=_ref20.movementY;var shape=_ref21.shape;this.attr("shape",{x:shape.x+movementX,y:shape.y+movementY})}};exports.rect=rect;var ring={shape:{rx:0,ry:0,r:0},validator:function validator(_ref22){var shape=_ref22.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;if(typeof rx!=="number"||typeof ry!=="number"||typeof r!=="number"){console.error("Ring shape configuration is abnormal!");return false}return true},draw:function draw(_ref23,_ref24){var ctx=_ref23.ctx;var shape=_ref24.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r;ctx.arc(rx,ry,r>0?r:.01,0,Math.PI*2);ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref25){var shape=_ref25.shape,style=_ref25.style;var rx=shape.rx,ry=shape.ry,r=shape.r;var lineWidth=style.lineWidth;var halfLineWidth=lineWidth/2;var minDistance=r-halfLineWidth;var maxDistance=r+halfLineWidth;var distance=(0,_util.getTwoPointDistance)(position,[rx,ry]);return distance>=minDistance&&distance<=maxDistance},setGraphCenter:function setGraphCenter(e,_ref26){var shape=_ref26.shape,style=_ref26.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref27,_ref28){var movementX=_ref27.movementX,movementY=_ref27.movementY;var shape=_ref28.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.ring=ring;var arc={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref29){var shape=_ref29.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Arc shape configuration is abnormal!");return false}return true},draw:function draw(_ref30,_ref31){var ctx=_ref30.ctx;var shape=_ref31.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;ctx.arc(rx,ry,r>0?r:.001,startAngle,endAngle,!clockWise);ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref32){var shape=_ref32.shape,style=_ref32.style;var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;var lineWidth=style.lineWidth;var halfLineWidth=lineWidth/2;var insideRadius=r-halfLineWidth;var outsideRadius=r+halfLineWidth;return!(0,_util.checkPointIsInSector)(position,rx,ry,insideRadius,startAngle,endAngle,clockWise)&&(0,_util.checkPointIsInSector)(position,rx,ry,outsideRadius,startAngle,endAngle,clockWise)},setGraphCenter:function setGraphCenter(e,_ref33){var shape=_ref33.shape,style=_ref33.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref34,_ref35){var movementX=_ref34.movementX,movementY=_ref34.movementY;var shape=_ref35.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.arc=arc;var sector={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref36){var shape=_ref36.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Sector shape configuration is abnormal!");return false}return true},draw:function draw(_ref37,_ref38){var ctx=_ref37.ctx;var shape=_ref38.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;ctx.arc(rx,ry,r>0?r:.01,startAngle,endAngle,!clockWise);ctx.lineTo(rx,ry);ctx.closePath();ctx.stroke();ctx.fill()},hoverCheck:function hoverCheck(position,_ref39){var shape=_ref39.shape;var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;return(0,_util.checkPointIsInSector)(position,rx,ry,r,startAngle,endAngle,clockWise)},setGraphCenter:function setGraphCenter(e,_ref40){var shape=_ref40.shape,style=_ref40.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref41,_ref42){var movementX=_ref41.movementX,movementY=_ref41.movementY;var shape=_ref42.shape;var rx=shape.rx,ry=shape.ry;this.attr("shape",{rx:rx+movementX,ry:ry+movementY})}};exports.sector=sector;var regPolygon={shape:{rx:0,ry:0,r:0,side:0},validator:function validator(_ref43){var shape=_ref43.shape;var side=shape.side;var keys=["rx","ry","r","side"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("RegPolygon shape configuration is abnormal!");return false}if(side<3){console.error("RegPolygon at least trigon!");return false}return true},draw:function draw(_ref44,_ref45){var ctx=_ref44.ctx;var shape=_ref45.shape,cache=_ref45.cache;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,side=shape.side;if(!cache.points||cache.rx!==rx||cache.ry!==ry||cache.r!==r||cache.side!==side){var _points=(0,_util.getRegularPolygonPoints)(rx,ry,r,side);Object.assign(cache,{points:_points,rx:rx,ry:ry,r:r,side:side})}var points=cache.points;(0,_canvas.drawPolylinePath)(ctx,points);ctx.closePath();ctx.stroke();ctx.fill()},hoverCheck:function hoverCheck(position,_ref46){var cache=_ref46.cache;var points=cache.points;return(0,_util.checkPointIsInPolygon)(position,points)},setGraphCenter:function setGraphCenter(e,_ref47){var shape=_ref47.shape,style=_ref47.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref48,_ref49){var movementX=_ref48.movementX,movementY=_ref48.movementY;var shape=_ref49.shape,cache=_ref49.cache;var rx=shape.rx,ry=shape.ry;cache.rx+=movementX;cache.ry+=movementY;this.attr("shape",{rx:rx+movementX,ry:ry+movementY});cache.points=cache.points.map(function(_ref50){var _ref51=(0,_slicedToArray2["default"])(_ref50,2),x=_ref51[0],y=_ref51[1];return[x+movementX,y+movementY]})}};exports.regPolygon=regPolygon;var polyline={shape:{points:[],close:false},validator:function validator(_ref52){var shape=_ref52.shape;var points=shape.points;if(!(points instanceof Array)){console.error("Polyline points should be an array!");return false}return true},draw:function draw(_ref53,_ref54){var ctx=_ref53.ctx;var shape=_ref54.shape,lineWidth=_ref54.style.lineWidth;ctx.beginPath();var points=shape.points,close=shape.close;if(lineWidth===1)points=(0,_util.eliminateBlur)(points);(0,_canvas.drawPolylinePath)(ctx,points);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref55){var shape=_ref55.shape,style=_ref55.style;var points=shape.points,close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,points)}else{return(0,_util.checkPointIsNearPolyline)(position,points,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref56){var shape=_ref56.shape,style=_ref56.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref57,_ref58){var movementX=_ref57.movementX,movementY=_ref57.movementY;var shape=_ref58.shape;var points=shape.points;var moveAfterPoints=points.map(function(_ref59){var _ref60=(0,_slicedToArray2["default"])(_ref59,2),x=_ref60[0],y=_ref60[1];return[x+movementX,y+movementY]});this.attr("shape",{points:moveAfterPoints})}};exports.polyline=polyline;var smoothline={shape:{points:[],close:false},validator:function validator(_ref61){var shape=_ref61.shape;var points=shape.points;if(!(points instanceof Array)){console.error("Smoothline points should be an array!");return false}return true},draw:function draw(_ref62,_ref63){var ctx=_ref62.ctx;var shape=_ref63.shape,cache=_ref63.cache;var points=shape.points,close=shape.close;if(!cache.points||cache.points.toString()!==points.toString()){var _bezierCurve=polylineToBezierCurve(points,close);var hoverPoints=bezierCurveToPolyline(_bezierCurve);Object.assign(cache,{points:(0,_util.deepClone)(points,true),bezierCurve:_bezierCurve,hoverPoints:hoverPoints})}var bezierCurve=cache.bezierCurve;ctx.beginPath();(0,_canvas.drawBezierCurvePath)(ctx,bezierCurve.slice(1),bezierCurve[0]);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref64){var cache=_ref64.cache,shape=_ref64.shape,style=_ref64.style;var hoverPoints=cache.hoverPoints;var close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,hoverPoints)}else{return(0,_util.checkPointIsNearPolyline)(position,hoverPoints,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref65){var shape=_ref65.shape,style=_ref65.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref66,_ref67){var movementX=_ref66.movementX,movementY=_ref66.movementY;var shape=_ref67.shape,cache=_ref67.cache;var points=shape.points;var moveAfterPoints=points.map(function(_ref68){var _ref69=(0,_slicedToArray2["default"])(_ref68,2),x=_ref69[0],y=_ref69[1];return[x+movementX,y+movementY]});cache.points=moveAfterPoints;var _cache$bezierCurve$=(0,_slicedToArray2["default"])(cache.bezierCurve[0],2),fx=_cache$bezierCurve$[0],fy=_cache$bezierCurve$[1];var curves=cache.bezierCurve.slice(1);cache.bezierCurve=[[fx+movementX,fy+movementY]].concat((0,_toConsumableArray2["default"])(curves.map(function(curve){return curve.map(function(_ref70){var _ref71=(0,_slicedToArray2["default"])(_ref70,2),x=_ref71[0],y=_ref71[1];return[x+movementX,y+movementY]})})));cache.hoverPoints=cache.hoverPoints.map(function(_ref72){var _ref73=(0,_slicedToArray2["default"])(_ref72,2),x=_ref73[0],y=_ref73[1];return[x+movementX,y+movementY]});this.attr("shape",{points:moveAfterPoints})}};exports.smoothline=smoothline;var bezierCurve={shape:{points:[],close:false},validator:function validator(_ref74){var shape=_ref74.shape;var points=shape.points;if(!(points instanceof Array)){console.error("BezierCurve points should be an array!");return false}return true},draw:function draw(_ref75,_ref76){var ctx=_ref75.ctx;var shape=_ref76.shape,cache=_ref76.cache;var points=shape.points,close=shape.close;if(!cache.points||cache.points.toString()!==points.toString()){var hoverPoints=bezierCurveToPolyline(points,20);Object.assign(cache,{points:(0,_util.deepClone)(points,true),hoverPoints:hoverPoints})}ctx.beginPath();(0,_canvas.drawBezierCurvePath)(ctx,points.slice(1),points[0]);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref77){var cache=_ref77.cache,shape=_ref77.shape,style=_ref77.style;var hoverPoints=cache.hoverPoints;var close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,hoverPoints)}else{return(0,_util.checkPointIsNearPolyline)(position,hoverPoints,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref78){var shape=_ref78.shape,style=_ref78.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref79,_ref80){var movementX=_ref79.movementX,movementY=_ref79.movementY;var shape=_ref80.shape,cache=_ref80.cache;var points=shape.points;var _points$=(0,_slicedToArray2["default"])(points[0],2),fx=_points$[0],fy=_points$[1];var curves=points.slice(1);var bezierCurve=[[fx+movementX,fy+movementY]].concat((0,_toConsumableArray2["default"])(curves.map(function(curve){return curve.map(function(_ref81){var _ref82=(0,_slicedToArray2["default"])(_ref81,2),x=_ref82[0],y=_ref82[1];return[x+movementX,y+movementY]})})));cache.points=bezierCurve;cache.hoverPoints=cache.hoverPoints.map(function(_ref83){var _ref84=(0,_slicedToArray2["default"])(_ref83,2),x=_ref84[0],y=_ref84[1];return[x+movementX,y+movementY]});this.attr("shape",{points:bezierCurve})}};exports.bezierCurve=bezierCurve;var text={shape:{content:"",position:[],maxWidth:undefined,rowGap:0},validator:function validator(_ref85){var shape=_ref85.shape;var content=shape.content,position=shape.position,rowGap=shape.rowGap;if(typeof content!=="string"){console.error("Text content should be a string!");return false}if(!(position instanceof Array)){console.error("Text position should be an array!");return false}if(typeof rowGap!=="number"){console.error("Text rowGap should be a number!");return false}return true},draw:function draw(_ref86,_ref87){var ctx=_ref86.ctx;var shape=_ref87.shape;var content=shape.content,position=shape.position,maxWidth=shape.maxWidth,rowGap=shape.rowGap;var textBaseline=ctx.textBaseline,font=ctx.font;var fontSize=parseInt(font.replace(/\D/g,""));var _position=position,_position2=(0,_slicedToArray2["default"])(_position,2),x=_position2[0],y=_position2[1];content=content.split("\n");var rowNum=content.length;var lineHeight=fontSize+rowGap;var allHeight=rowNum*lineHeight-rowGap;var offset=0;if(textBaseline==="middle"){offset=allHeight/2;y+=fontSize/2}if(textBaseline==="bottom"){offset=allHeight;y+=fontSize}position=new Array(rowNum).fill(0).map(function(foo,i){return[x,y+i*lineHeight-offset]});ctx.beginPath();content.forEach(function(text,i){ctx.fillText.apply(ctx,[text].concat((0,_toConsumableArray2["default"])(position[i]),[maxWidth]));ctx.strokeText.apply(ctx,[text].concat((0,_toConsumableArray2["default"])(position[i]),[maxWidth]))});ctx.closePath()},hoverCheck:function hoverCheck(position,_ref88){var shape=_ref88.shape,style=_ref88.style;return false},setGraphCenter:function setGraphCenter(e,_ref89){var shape=_ref89.shape,style=_ref89.style;var position=shape.position;style.graphCenter=(0,_toConsumableArray2["default"])(position)},move:function move(_ref90,_ref91){var movementX=_ref90.movementX,movementY=_ref90.movementY;var shape=_ref91.shape;var _shape$position=(0,_slicedToArray2["default"])(shape.position,2),x=_shape$position[0],y=_shape$position[1];this.attr("shape",{position:[x+movementX,y+movementY]})}};exports.text=text;var graphs=new Map([["circle",circle],["ellipse",ellipse],["rect",rect],["ring",ring],["arc",arc],["sector",sector],["regPolygon",regPolygon],["polyline",polyline],["smoothline",smoothline],["bezierCurve",bezierCurve],["text",text]]);var _default=graphs;exports["default"]=_default;function extendNewGraph(name,config){if(!name||!config){console.error("ExtendNewGraph Missing Parameters!");return}if(!config.shape){console.error("Required attribute of shape to extendNewGraph!");return}if(!config.validator){console.error("Required function of validator to extendNewGraph!");return}if(!config.draw){console.error("Required function of draw to extendNewGraph!");return}graphs.set(name,config)}},{"../plugin/canvas":53,"../plugin/util":54,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/bezier-curve":47}],52:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CRender",{enumerable:true,get:function get(){return _crender["default"]}});Object.defineProperty(exports,"extendNewGraph",{enumerable:true,get:function get(){return _graphs.extendNewGraph}});exports["default"]=void 0;var _crender=_interopRequireDefault(require("./class/crender.class"));var _graphs=require("./config/graphs");var _default=_crender["default"];exports["default"]=_default},{"./class/crender.class":48,"./config/graphs":51,"@babel/runtime/helpers/interopRequireDefault":36}],53:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.drawPolylinePath=drawPolylinePath;exports.drawBezierCurvePath=drawBezierCurvePath;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));function drawPolylinePath(ctx,points){var beginPath=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var closePath=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(!ctx||points.length<2)return false;if(beginPath)ctx.beginPath();points.forEach(function(point,i){return point&&(i===0?ctx.moveTo.apply(ctx,(0,_toConsumableArray2["default"])(point)):ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(point)))});if(closePath)ctx.closePath()}function drawBezierCurvePath(ctx,points){var moveTo=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var beginPath=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var closePath=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(!ctx||!points)return false;if(beginPath)ctx.beginPath();if(moveTo)ctx.moveTo.apply(ctx,(0,_toConsumableArray2["default"])(moveTo));points.forEach(function(item){return item&&ctx.bezierCurveTo.apply(ctx,(0,_toConsumableArray2["default"])(item[0]).concat((0,_toConsumableArray2["default"])(item[1]),(0,_toConsumableArray2["default"])(item[2])))});if(closePath)ctx.closePath()}var _default={drawPolylinePath:drawPolylinePath,drawBezierCurvePath:drawBezierCurvePath};exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42}],54:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.deepClone=deepClone;exports.eliminateBlur=eliminateBlur;exports.checkPointIsInCircle=checkPointIsInCircle;exports.getTwoPointDistance=getTwoPointDistance;exports.checkPointIsInPolygon=checkPointIsInPolygon;exports.checkPointIsInSector=checkPointIsInSector;exports.checkPointIsNearPolyline=checkPointIsNearPolyline;exports.checkPointIsInRect=checkPointIsInRect;exports.getRotatePointPos=getRotatePointPos;exports.getScalePointPos=getScalePointPos;exports.getTranslatePointPos=getTranslatePointPos;exports.getDistanceBetweenPointAndLine=getDistanceBetweenPointAndLine;exports.getCircleRadianPoint=getCircleRadianPoint;exports.getRegularPolygonPoints=getRegularPolygonPoints;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var abs=Math.abs,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,max=Math.max,min=Math.min,PI=Math.PI;function deepClone(object){var recursion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!object)return object;var parse=JSON.parse,stringify=JSON.stringify;if(!recursion)return parse(stringify(object));var clonedObj=object instanceof Array?[]:{};if(object&&(0,_typeof2["default"])(object)==="object"){for(var key in object){if(object.hasOwnProperty(key)){if(object[key]&&(0,_typeof2["default"])(object[key])==="object"){clonedObj[key]=deepClone(object[key],true)}else{clonedObj[key]=object[key]}}}}return clonedObj}function eliminateBlur(points){return points.map(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),x=_ref2[0],y=_ref2[1];return[parseInt(x)+.5,parseInt(y)+.5]})}function checkPointIsInCircle(point,rx,ry,r){return getTwoPointDistance(point,[rx,ry])<=r}function getTwoPointDistance(_ref3,_ref4){var _ref5=(0,_slicedToArray2["default"])(_ref3,2),xa=_ref5[0],ya=_ref5[1];var _ref6=(0,_slicedToArray2["default"])(_ref4,2),xb=_ref6[0],yb=_ref6[1];var minusX=abs(xa-xb);var minusY=abs(ya-yb);return sqrt(minusX*minusX+minusY*minusY)}function checkPointIsInPolygon(point,polygon){var counter=0;var _point=(0,_slicedToArray2["default"])(point,2),x=_point[0],y=_point[1];var pointNum=polygon.length;for(var i=1,p1=polygon[0];i<=pointNum;i++){var p2=polygon[i%pointNum];if(x>min(p1[0],p2[0])&&x<=max(p1[0],p2[0])){if(y<=max(p1[1],p2[1])){if(p1[0]!==p2[0]){var xinters=(x-p1[0])*(p2[1]-p1[1])/(p2[0]-p1[0])+p1[1];if(p1[1]===p2[1]||y<=xinters){counter++}}}}p1=p2}return counter%2===1}function checkPointIsInSector(point,rx,ry,r,startAngle,endAngle,clockWise){if(!point)return false;if(getTwoPointDistance(point,[rx,ry])>r)return false;if(!clockWise){var _deepClone=deepClone([endAngle,startAngle]);var _deepClone2=(0,_slicedToArray2["default"])(_deepClone,2);startAngle=_deepClone2[0];endAngle=_deepClone2[1]}var reverseBE=startAngle>endAngle;if(reverseBE){var _ref7=[endAngle,startAngle];startAngle=_ref7[0];endAngle=_ref7[1]}var minus=endAngle-startAngle;if(minus>=PI*2)return true;var _point2=(0,_slicedToArray2["default"])(point,2),x=_point2[0],y=_point2[1];var _getCircleRadianPoint=getCircleRadianPoint(rx,ry,r,startAngle),_getCircleRadianPoint2=(0,_slicedToArray2["default"])(_getCircleRadianPoint,2),bx=_getCircleRadianPoint2[0],by=_getCircleRadianPoint2[1];var _getCircleRadianPoint3=getCircleRadianPoint(rx,ry,r,endAngle),_getCircleRadianPoint4=(0,_slicedToArray2["default"])(_getCircleRadianPoint3,2),ex=_getCircleRadianPoint4[0],ey=_getCircleRadianPoint4[1];var vPoint=[x-rx,y-ry];var vBArm=[bx-rx,by-ry];var vEArm=[ex-rx,ey-ry];var reverse=minus>PI;if(reverse){var _deepClone3=deepClone([vEArm,vBArm]);var _deepClone4=(0,_slicedToArray2["default"])(_deepClone3,2);vBArm=_deepClone4[0];vEArm=_deepClone4[1]}var inSector=isClockWise(vBArm,vPoint)&&!isClockWise(vEArm,vPoint);if(reverse)inSector=!inSector;if(reverseBE)inSector=!inSector;return inSector}function isClockWise(vArm,vPoint){var _vArm=(0,_slicedToArray2["default"])(vArm,2),ax=_vArm[0],ay=_vArm[1];var _vPoint=(0,_slicedToArray2["default"])(vPoint,2),px=_vPoint[0],py=_vPoint[1];return-ay*px+ax*py>0}function checkPointIsNearPolyline(point,polyline,lineWidth){var halfLineWidth=lineWidth/2;var moveUpPolyline=polyline.map(function(_ref8){var _ref9=(0,_slicedToArray2["default"])(_ref8,2),x=_ref9[0],y=_ref9[1];return[x,y-halfLineWidth]});var moveDownPolyline=polyline.map(function(_ref10){var _ref11=(0,_slicedToArray2["default"])(_ref10,2),x=_ref11[0],y=_ref11[1];return[x,y+halfLineWidth]});var polygon=[].concat((0,_toConsumableArray2["default"])(moveUpPolyline),(0,_toConsumableArray2["default"])(moveDownPolyline.reverse()));return checkPointIsInPolygon(point,polygon)}function checkPointIsInRect(_ref12,x,y,width,height){var _ref13=(0,_slicedToArray2["default"])(_ref12,2),px=_ref13[0],py=_ref13[1];if(pxx+width)return false;if(py>y+height)return false;return true}function getRotatePointPos(){var rotate=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var point=arguments.length>1?arguments[1]:undefined;var origin=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[0,0];if(!point)return false;if(rotate%360===0)return point;var _point3=(0,_slicedToArray2["default"])(point,2),x=_point3[0],y=_point3[1];var _origin=(0,_slicedToArray2["default"])(origin,2),ox=_origin[0],oy=_origin[1];rotate*=PI/180;return[(x-ox)*cos(rotate)-(y-oy)*sin(rotate)+ox,(x-ox)*sin(rotate)+(y-oy)*cos(rotate)+oy]}function getScalePointPos(){var scale=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[1,1];var point=arguments.length>1?arguments[1]:undefined;var origin=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[0,0];if(!point)return false;if(scale===1)return point;var _point4=(0,_slicedToArray2["default"])(point,2),x=_point4[0],y=_point4[1];var _origin2=(0,_slicedToArray2["default"])(origin,2),ox=_origin2[0],oy=_origin2[1];var _scale=(0,_slicedToArray2["default"])(scale,2),xs=_scale[0],ys=_scale[1];var relativePosX=x-ox;var relativePosY=y-oy;return[relativePosX*xs+ox,relativePosY*ys+oy]}function getTranslatePointPos(translate,point){if(!translate||!point)return false;var _point5=(0,_slicedToArray2["default"])(point,2),x=_point5[0],y=_point5[1];var _translate=(0,_slicedToArray2["default"])(translate,2),tx=_translate[0],ty=_translate[1];return[x+tx,y+ty]}function getDistanceBetweenPointAndLine(point,lineBegin,lineEnd){if(!point||!lineBegin||!lineEnd)return false;var _point6=(0,_slicedToArray2["default"])(point,2),x=_point6[0],y=_point6[1];var _lineBegin=(0,_slicedToArray2["default"])(lineBegin,2),x1=_lineBegin[0],y1=_lineBegin[1];var _lineEnd=(0,_slicedToArray2["default"])(lineEnd,2),x2=_lineEnd[0],y2=_lineEnd[1];var a=y2-y1;var b=x1-x2;var c=y1*(x2-x1)-x1*(y2-y1);var molecule=abs(a*x+b*y+c);var denominator=sqrt(a*a+b*b);return molecule/denominator}function getCircleRadianPoint(x,y,radius,radian){return[x+cos(radian)*radius,y+sin(radian)*radius]}function getRegularPolygonPoints(rx,ry,r,side){var minus=arguments.length>4&&arguments[4]!==undefined?arguments[4]:PI*-.5;var radianGap=PI*2/side;var radians=new Array(side).fill("").map(function(t,i){return i*radianGap+minus});return radians.map(function(radian){return getCircleRadianPoint(rx,ry,r,radian)})}var _default={deepClone:deepClone,eliminateBlur:eliminateBlur,checkPointIsInCircle:checkPointIsInCircle,checkPointIsInPolygon:checkPointIsInPolygon,checkPointIsInSector:checkPointIsInSector,checkPointIsNearPolyline:checkPointIsNearPolyline,getTwoPointDistance:getTwoPointDistance,getRotatePointPos:getRotatePointPos,getScalePointPos:getScalePointPos,getTranslatePointPos:getTranslatePointPos,getCircleRadianPoint:getCircleRadianPoint,getRegularPolygonPoints:getRegularPolygonPoints,getDistanceBetweenPointAndLine:getDistanceBetweenPointAndLine};exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43}],55:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _default=new Map([["transparent","rgba(0,0,0,0)"],["black","#000000"],["silver","#C0C0C0"],["gray","#808080"],["white","#FFFFFF"],["maroon","#800000"],["red","#FF0000"],["purple","#800080"],["fuchsia","#FF00FF"],["green","#008000"],["lime","#00FF00"],["olive","#808000"],["yellow","#FFFF00"],["navy","#000080"],["blue","#0000FF"],["teal","#008080"],["aqua","#00FFFF"],["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["blanchedalmond","#ffebcd"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["oldlace","#fdf5e6"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["whitesmoke","#f5f5f5"],["yellowgreen","#9acd32"]]);exports["default"]=_default},{}],56:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getRgbValue=getRgbValue;exports.getRgbaValue=getRgbaValue;exports.getOpacity=getOpacity;exports.toRgb=toRgb;exports.toHex=toHex;exports.getColorFromRgbValue=getColorFromRgbValue;exports.darken=darken;exports.lighten=lighten;exports.fade=fade;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _keywords=_interopRequireDefault(require("./config/keywords"));var hexReg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;var rgbReg=/^(rgb|rgba|RGB|RGBA)/;var rgbaReg=/^(rgba|RGBA)/;function validator(color){var isHex=hexReg.test(color);var isRgb=rgbReg.test(color);if(isHex||isRgb)return color;color=getColorByKeyword(color);if(!color){console.error("Color: Invalid color!");return false}return color}function getColorByKeyword(keyword){if(!keyword){console.error("getColorByKeywords: Missing parameters!");return false}if(!_keywords["default"].has(keyword))return false;return _keywords["default"].get(keyword)}function getRgbValue(color){if(!color){console.error("getRgbValue: Missing parameters!");return false}color=validator(color);if(!color)return false;var isHex=hexReg.test(color);var isRgb=rgbReg.test(color);var lowerColor=color.toLowerCase();if(isHex)return getRgbValueFromHex(lowerColor);if(isRgb)return getRgbValueFromRgb(lowerColor)}function getRgbValueFromHex(color){color=color.replace("#","");if(color.length===3)color=Array.from(color).map(function(hexNum){return hexNum+hexNum}).join("");color=color.split("");return new Array(3).fill(0).map(function(t,i){return parseInt("0x".concat(color[i*2]).concat(color[i*2+1]))})}function getRgbValueFromRgb(color){return color.replace(/rgb\(|rgba\(|\)/g,"").split(",").slice(0,3).map(function(n){return parseInt(n)})}function getRgbaValue(color){if(!color){console.error("getRgbaValue: Missing parameters!");return false}var colorValue=getRgbValue(color);if(!colorValue)return false;colorValue.push(getOpacity(color));return colorValue}function getOpacity(color){if(!color){console.error("getOpacity: Missing parameters!");return false}color=validator(color);if(!color)return false;var isRgba=rgbaReg.test(color);if(!isRgba)return 1;color=color.toLowerCase();return Number(color.split(",").slice(-1)[0].replace(/[)|\s]/g,""))}function toRgb(color,opacity){if(!color){console.error("toRgb: Missing parameters!");return false}var rgbValue=getRgbValue(color);if(!rgbValue)return false;var addOpacity=typeof opacity==="number";if(addOpacity)return"rgba("+rgbValue.join(",")+",".concat(opacity,")");return"rgb("+rgbValue.join(",")+")"}function toHex(color){if(!color){console.error("toHex: Missing parameters!");return false}if(hexReg.test(color))return color;color=getRgbValue(color);if(!color)return false;return"#"+color.map(function(n){return Number(n).toString(16)}).map(function(n){return n==="0"?"00":n}).join("")}function getColorFromRgbValue(value){if(!value){console.error("getColorFromRgbValue: Missing parameters!");return false}var valueLength=value.length;if(valueLength!==3&&valueLength!==4){console.error("getColorFromRgbValue: Value is illegal!");return false}var color=valueLength===3?"rgb(":"rgba(";color+=value.join(",")+")";return color}function darken(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!color){console.error("darken: Missing parameters!");return false}var rgbaValue=getRgbaValue(color);if(!rgbaValue)return false;rgbaValue=rgbaValue.map(function(v,i){return i===3?v:v-Math.ceil(2.55*percent)}).map(function(v){return v<0?0:v});return getColorFromRgbValue(rgbaValue)}function lighten(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!color){console.error("lighten: Missing parameters!");return false}var rgbaValue=getRgbaValue(color);if(!rgbaValue)return false;rgbaValue=rgbaValue.map(function(v,i){return i===3?v:v+Math.ceil(2.55*percent)}).map(function(v){return v>255?255:v});return getColorFromRgbValue(rgbaValue)}function fade(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;if(!color){console.error("fade: Missing parameters!");return false}var rgbValue=getRgbValue(color);if(!rgbValue)return false;var rgbaValue=[].concat((0,_toConsumableArray2["default"])(rgbValue),[percent/100]);return getColorFromRgbValue(rgbaValue)}var _default={fade:fade,toHex:toHex,toRgb:toRgb,darken:darken,lighten:lighten,getOpacity:getOpacity,getRgbValue:getRgbValue,getRgbaValue:getRgbaValue,getColorFromRgbValue:getColorFromRgbValue};exports["default"]=_default},{"./config/keywords":55,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42}],57:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=exports.easeInOutBounce=exports.easeOutBounce=exports.easeInBounce=exports.easeInOutElastic=exports.easeOutElastic=exports.easeInElastic=exports.easeInOutBack=exports.easeOutBack=exports.easeInBack=exports.easeInOutQuint=exports.easeOutQuint=exports.easeInQuint=exports.easeInOutQuart=exports.easeOutQuart=exports.easeInQuart=exports.easeInOutCubic=exports.easeOutCubic=exports.easeInCubic=exports.easeInOutQuad=exports.easeOutQuad=exports.easeInQuad=exports.easeInOutSine=exports.easeOutSine=exports.easeInSine=exports.linear=void 0;var linear=[[[0,1],"",[.33,.67]],[[1,0],[.67,.33]]];exports.linear=linear;var easeInSine=[[[0,1]],[[.538,.564],[.169,.912],[.88,.196]],[[1,0]]];exports.easeInSine=easeInSine;var easeOutSine=[[[0,1]],[[.444,.448],[.169,.736],[.718,.16]],[[1,0]]];exports.easeOutSine=easeOutSine;var easeInOutSine=[[[0,1]],[[.5,.5],[.2,1],[.8,0]],[[1,0]]];exports.easeInOutSine=easeInOutSine;var easeInQuad=[[[0,1]],[[.55,.584],[.231,.904],[.868,.264]],[[1,0]]];exports.easeInQuad=easeInQuad;var easeOutQuad=[[[0,1]],[[.413,.428],[.065,.816],[.76,.04]],[[1,0]]];exports.easeOutQuad=easeOutQuad;var easeInOutQuad=[[[0,1]],[[.5,.5],[.3,.9],[.7,.1]],[[1,0]]];exports.easeInOutQuad=easeInOutQuad;var easeInCubic=[[[0,1]],[[.679,.688],[.366,.992],[.992,.384]],[[1,0]]];exports.easeInCubic=easeInCubic;var easeOutCubic=[[[0,1]],[[.321,.312],[.008,.616],[.634,.008]],[[1,0]]];exports.easeOutCubic=easeOutCubic;var easeInOutCubic=[[[0,1]],[[.5,.5],[.3,1],[.7,0]],[[1,0]]];exports.easeInOutCubic=easeInOutCubic;var easeInQuart=[[[0,1]],[[.812,.74],[.611,.988],[1.013,.492]],[[1,0]]];exports.easeInQuart=easeInQuart;var easeOutQuart=[[[0,1]],[[.152,.244],[.001,.448],[.285,-.02]],[[1,0]]];exports.easeOutQuart=easeOutQuart;var easeInOutQuart=[[[0,1]],[[.5,.5],[.4,1],[.6,0]],[[1,0]]];exports.easeInOutQuart=easeInOutQuart;var easeInQuint=[[[0,1]],[[.857,.856],[.714,1],[1,.712]],[[1,0]]];exports.easeInQuint=easeInQuint;var easeOutQuint=[[[0,1]],[[.108,.2],[.001,.4],[.214,-.012]],[[1,0]]];exports.easeOutQuint=easeOutQuint;var easeInOutQuint=[[[0,1]],[[.5,.5],[.5,1],[.5,0]],[[1,0]]];exports.easeInOutQuint=easeInOutQuint;var easeInBack=[[[0,1]],[[.667,.896],[.38,1.184],[.955,.616]],[[1,0]]];exports.easeInBack=easeInBack;var easeOutBack=[[[0,1]],[[.335,.028],[.061,.22],[.631,-.18]],[[1,0]]];exports.easeOutBack=easeOutBack;var easeInOutBack=[[[0,1]],[[.5,.5],[.4,1.4],[.6,-.4]],[[1,0]]];exports.easeInOutBack=easeInOutBack;var easeInElastic=[[[0,1]],[[.474,.964],[.382,.988],[.557,.952]],[[.619,1.076],[.565,1.088],[.669,1.08]],[[.77,.916],[.712,.924],[.847,.904]],[[.911,1.304],[.872,1.316],[.961,1.34]],[[1,0]]];exports.easeInElastic=easeInElastic;var easeOutElastic=[[[0,1]],[[.073,-.32],[.034,-.328],[.104,-.344]],[[.191,.092],[.11,.06],[.256,.08]],[[.31,-.076],[.26,-.068],[.357,-.076]],[[.432,.032],[.362,.028],[.683,-.004]],[[1,0]]];exports.easeOutElastic=easeOutElastic;var easeInOutElastic=[[[0,1]],[[.21,.94],[.167,.884],[.252,.98]],[[.299,1.104],[.256,1.092],[.347,1.108]],[[.5,.496],[.451,.672],[.548,.324]],[[.696,-.108],[.652,-.112],[.741,-.124]],[[.805,.064],[.756,.012],[.866,.096]],[[1,0]]];exports.easeInOutElastic=easeInOutElastic;var easeInBounce=[[[0,1]],[[.148,1],[.075,.868],[.193,.848]],[[.326,1],[.276,.836],[.405,.712]],[[.6,1],[.511,.708],[.671,.348]],[[1,0]]];exports.easeInBounce=easeInBounce;var easeOutBounce=[[[0,1]],[[.357,.004],[.27,.592],[.376,.252]],[[.604,-.004],[.548,.312],[.669,.184]],[[.82,0],[.749,.184],[.905,.132]],[[1,0]]];exports.easeOutBounce=easeOutBounce;var easeInOutBounce=[[[0,1]],[[.102,1],[.05,.864],[.117,.86]],[[.216,.996],[.208,.844],[.227,.808]],[[.347,.996],[.343,.8],[.48,.292]],[[.635,.004],[.511,.676],[.656,.208]],[[.787,0],[.76,.2],[.795,.144]],[[.905,-.004],[.899,.164],[.944,.144]],[[1,0]]];exports.easeInOutBounce=easeInOutBounce;var _default=new Map([["linear",linear],["easeInSine",easeInSine],["easeOutSine",easeOutSine],["easeInOutSine",easeInOutSine],["easeInQuad",easeInQuad],["easeOutQuad",easeOutQuad],["easeInOutQuad",easeInOutQuad],["easeInCubic",easeInCubic],["easeOutCubic",easeOutCubic],["easeInOutCubic",easeInOutCubic],["easeInQuart",easeInQuart],["easeOutQuart",easeOutQuart],["easeInOutQuart",easeInOutQuart],["easeInQuint",easeInQuint],["easeOutQuint",easeOutQuint],["easeInOutQuint",easeInOutQuint],["easeInBack",easeInBack],["easeOutBack",easeOutBack],["easeInOutBack",easeInOutBack],["easeInElastic",easeInElastic],["easeOutElastic",easeOutElastic],["easeInOutElastic",easeInOutElastic],["easeInBounce",easeInBounce],["easeOutBounce",easeOutBounce],["easeInOutBounce",easeInOutBounce]]);exports["default"]=_default},{}],58:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.transition=transition;exports.injectNewCurve=injectNewCurve;exports["default"]=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _curves=_interopRequireDefault(require("./config/curves"));var defaultTransitionBC="linear";function transition(tBC){var startState=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var endState=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var frameNum=arguments.length>3&&arguments[3]!==undefined?arguments[3]:30;var deep=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(!checkParams.apply(void 0,arguments))return false;try{var bezierCurve=getBezierCurve(tBC);var frameStateProgress=getFrameStateProgress(bezierCurve,frameNum);if(!deep||typeof endState==="number")return getTransitionState(startState,endState,frameStateProgress);return recursionTransitionState(startState,endState,frameStateProgress)}catch(_unused){console.warn("Transition parameter may be abnormal!");return[endState]}}function checkParams(tBC){var startState=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var endState=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var frameNum=arguments.length>3&&arguments[3]!==undefined?arguments[3]:30;if(!tBC||startState===false||endState===false||!frameNum){console.error("transition: Missing Parameters!");return false}if((0,_typeof2["default"])(startState)!==(0,_typeof2["default"])(endState)){console.error("transition: Inconsistent Status Types!");return false}var stateType=(0,_typeof2["default"])(endState);if(stateType==="string"||stateType==="boolean"||!tBC.length){console.error("transition: Unsupported Data Type of State!");return false}if(!_curves["default"].has(tBC)&&!(tBC instanceof Array)){console.warn("transition: Transition curve not found, default curve will be used!")}return true}function getBezierCurve(tBC){var bezierCurve="";if(_curves["default"].has(tBC)){bezierCurve=_curves["default"].get(tBC)}else if(tBC instanceof Array){bezierCurve=tBC}else{bezierCurve=_curves["default"].get(defaultTransitionBC)}return bezierCurve}function getFrameStateProgress(bezierCurve,frameNum){var tMinus=1/(frameNum-1);var tState=new Array(frameNum).fill(0).map(function(t,i){return i*tMinus});var frameState=tState.map(function(t){return getFrameStateFromT(bezierCurve,t)});return frameState}function getFrameStateFromT(bezierCurve,t){var tBezierCurvePoint=getBezierCurvePointFromT(bezierCurve,t);var bezierCurvePointT=getBezierCurvePointTFromReT(tBezierCurvePoint,t);return getBezierCurveTState(tBezierCurvePoint,bezierCurvePointT)}function getBezierCurvePointFromT(bezierCurve,t){var lastIndex=bezierCurve.length-1;var begin="",end="";bezierCurve.findIndex(function(item,i){if(i===lastIndex)return;begin=item;end=bezierCurve[i+1];var currentMainPointX=begin[0][0];var nextMainPointX=end[0][0];return t>=currentMainPointX&&t=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){this.complete(entry.completion,entry.afterLoc);resetTryEntry(entry);return ContinueSentinel}}},catch:function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};if(this.method==="next"){this.arg=undefined}return ContinueSentinel}};return exports}(typeof module==="object"?module.exports:{});try{regeneratorRuntime=runtime}catch(accidentalStrictMode){Function("r","regeneratorRuntime = r")(runtime)}},{}]},{},[1]); \ No newline at end of file diff --git a/lib/core/pie.js b/lib/core/pie.js index 90ff560..bbe1bf4 100644 --- a/lib/core/pie.js +++ b/lib/core/pie.js @@ -178,7 +178,7 @@ function calcPiesPercent(pies) { var percent = _ref5.percent; return percent; })); - data.slice(-1)[0].percent = 100 - percentSumNoLast; + data.slice(-1)[0].percent = parseFloat((100 - percentSumNoLast).toFixed(percentToFixed)); }); return pies; }