From 1edab036e1a6fd43ce77684a1e225d36a76b1cbe Mon Sep 17 00:00:00 2001 From: JM <743192023@qq.com> Date: Tue, 26 Nov 2019 16:01:46 +0800 Subject: [PATCH] update dist and lib --- dist/charts.map.js | 40 ++++++++++++++++++++++++++++++++++++++-- dist/charts.min.js | 2 +- lib/config/bar.js | 19 +++++++++++++++++++ lib/core/bar.js | 10 +++++++++- lib/core/mergeColor.js | 9 +++++++++ 5 files changed, 76 insertions(+), 4 deletions(-) diff --git a/dist/charts.map.js b/dist/charts.map.js index 91585b6..82e0ffc 100644 --- a/dist/charts.map.js +++ b/dist/charts.map.js @@ -936,6 +936,25 @@ var barConfig = { */ barStyle: {}, + /** + * @description Independent color mode + * When set to true, independent color mode is enabled + * @type {Boolean} + * @default independentColor = false + */ + independentColor: false, + + /** + * @description Independent colors + * Only effective when independent color mode is enabled + * Default value is the same as the color in the root configuration + * Two-dimensional color array can produce gradient colors + * @type {Array} + * @example independentColor = ['#fff', '#000'] + * @example independentColor = [['#fff', '#000'], '#000'] + */ + independentColors: [], + /** * @description Bar chart render level * Priority rendering high level @@ -3801,9 +3820,17 @@ function getNormalBarShape(barItem, i) { function getBarStyle(barItem, i) { var barStyle = barItem.barStyle, gradient = barItem.gradient, - color = barItem.color; + color = barItem.color, + independentColor = barItem.independentColor, + independentColors = barItem.independentColors; var fillColor = [barStyle.fill || color]; var gradientColor = (0, _util2.deepMerge)(fillColor, gradient.color); + + if (independentColor) { + var idtColor = independentColors[i % independentColors.length]; + gradientColor = idtColor instanceof Array ? idtColor : [idtColor]; + } + if (gradientColor.length === 1) gradientColor.push(gradientColor[0]); var gradientParams = getGradientParams(barItem, i); return (0, _util2.deepMerge)({ @@ -5843,6 +5870,15 @@ function mergeColor(chart) { 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"; @@ -12520,4 +12556,4 @@ try { } },{}]},{},[1]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJidWlsZC9lbnRyeS5qcyIsImxpYi9jbGFzcy9jaGFydHMuY2xhc3MuanMiLCJsaWIvY2xhc3MvdXBkYXRlci5jbGFzcy5qcyIsImxpYi9jb25maWcvYXhpcy5qcyIsImxpYi9jb25maWcvYmFyLmpzIiwibGliL2NvbmZpZy9jb2xvci5qcyIsImxpYi9jb25maWcvZ2F1Z2UuanMiLCJsaWIvY29uZmlnL2dyaWQuanMiLCJsaWIvY29uZmlnL2luZGV4LmpzIiwibGliL2NvbmZpZy9sZWdlbmQuanMiLCJsaWIvY29uZmlnL2xpbmUuanMiLCJsaWIvY29uZmlnL3BpZS5qcyIsImxpYi9jb25maWcvcmFkYXIuanMiLCJsaWIvY29uZmlnL3JhZGFyQXhpcy5qcyIsImxpYi9jb25maWcvdGl0bGUuanMiLCJsaWIvY29yZS9heGlzLmpzIiwibGliL2NvcmUvYmFyLmpzIiwibGliL2NvcmUvZ2F1Z2UuanMiLCJsaWIvY29yZS9ncmlkLmpzIiwibGliL2NvcmUvaW5kZXguanMiLCJsaWIvY29yZS9sZWdlbmQuanMiLCJsaWIvY29yZS9saW5lLmpzIiwibGliL2NvcmUvbWVyZ2VDb2xvci5qcyIsImxpYi9jb3JlL3BpZS5qcyIsImxpYi9jb3JlL3JhZGFyLmpzIiwibGliL2NvcmUvcmFkYXJBeGlzLmpzIiwibGliL2NvcmUvdGl0bGUuanMiLCJsaWIvZXh0ZW5kL2luZGV4LmpzIiwibGliL2luZGV4LmpzIiwibGliL3V0aWwvaW5kZXguanMiLCJub2RlX21vZHVsZXMvQGJhYmVsL3J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ICAgICB0aGlzLmFuaW1hdGlvbktleXMucHVzaChjaGFuZ2VLZXlzKTtcbiAgICAgICAgICAgIHRoaXMuYW5pbWF0aW9uRnJhbWVTdGF0ZS5wdXNoKGFuaW1hdGlvbkZyYW1lU3RhdGUpO1xuXG4gICAgICAgICAgICBpZiAoIXdhaXQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIGlmICghKGFuaW1hdGlvbkRlbGF5ID4gMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gZGVsYXkoYW5pbWF0aW9uRGVsYXkpO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIHJlbmRlciA9IHRoaXMucmVuZGVyO1xuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cIiwgbmV3IFByb21pc2UoXG4gICAgICAgICAgICAvKiNfX1BVUkVfXyovXG4gICAgICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgIHZhciBfcmVmMyA9ICgwLCBfYXN5bmNUb0dlbmVyYXRvcjJbXCJkZWZhdWx0XCJdKShcbiAgICAgICAgICAgICAgLyojX19QVVJFX18qL1xuICAgICAgICAgICAgICBfcmVnZW5lcmF0b3JbXCJkZWZhdWx0XCJdLm1hcmsoZnVuY3Rpb24gX2NhbGxlZShyZXNvbHZlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvcltcImRlZmF1bHRcIl0ud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlbmRlci5sYXVuY2hBbmltYXRpb24oKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgX2NhbGxlZSk7XG4gICAgICAgICAgICAgIH0pKTtcblxuICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKF94Mykge1xuICAgICAgICAgICAgICAgIHJldHVybiBfcmVmMy5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfSgpKSk7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICB9KSk7XG5cbiAgcmV0dXJuIGZ1bmN0aW9uIChfeCwgX3gyKSB7XG4gICAgcmV0dXJuIF9yZWYyLmFwcGx5KHRoa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WRcbiAgICAgICAgICAgIDogR2VuU3RhdGVTdXNwZW5kZWRZaWVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIHN0YXRlID0gR2VuU3RhdGVDb21wbGV0ZWQ7XG4gICAgICAgICAgLy8gRGlzcGF0Y2ggdGhlIGV4Y2VwdGlvbiBieSBsb29waW5nIGJhY2sgYXJvdW5kIHRvIHRoZVxuICAgICAgICAgIC8vIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpIGNhbGwgYWJvdmUuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8vIENhbGwgZGVsZWdhdGUuaXRlcmF0b3JbY29udGV4dC5tZXRob2RdKGNvbnRleHQuYXJnKSBhbmQgaGFuZGxlIHRoZVxuICAvLyByZXN1bHQsIGVpdGhlciBieSByZXR1cm5pbmcgYSB7IHZhbHVlLCBkb25lIH0gcmVzdWx0IGZyb20gdGhlXG4gIC8vIGRlbGVnYXRlIGl0ZXJhdG9yLCBvciBieSBtb2RpZnlpbmcgY29udGV4dC5tZXRob2QgYW5kIGNvbnRleHQuYXJnLFxuICAvLyBzZXR0aW5nIGNvbnRleHQuZGVsZWdhdGUgdG8gbnVsbCwgYW5kIHJldHVybmluZyB0aGUgQ29udGludWVTZW50aW5l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gICAgIC8vIFwicmV0dXJuXCIgdG8gXCJ0aHJvd1wiLCBsZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3RcIik7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIGlmIChpbmZvLmRvbmUpIHtcbiAgICAgIC8vIEFzc2lnbiB0aGUgcmVzd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ICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfSBlbHNlIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0NhdGNoKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidHJ5IHN0YXRlbWVudCB3aXRob3V0IGNhdGNoIG9yIGZpbmFsbHlcIik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIGFicnVwdDogZnVuY3Rpb24odHlwZSwgYXJnKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LnRyeUxvYyA8PSB0aGlzLnByZXYgJiZcbiAgICAgICAgICAgIGhhc093bi5jYWxsKGVudHJ5LCBcImZpbmFsbHlMb2NcIikgJiZcbiAgICAgICAgICAgIHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICB2YXIgZmluYWxseUVudHJ5ID0gZW50cnk7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSAmJlxuICAgICAgICAgICh0eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICAgdHlwZSA9PT0gXCJjb250aW51ZVwiKSAmJlxuICAgICAgICAgIGZpbmFsbHlFbnRyeS50cnlMb2MgPD0gYXJnICYmXG4gICAgICAgICAgYXJnIDw9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgIC8vIElnbm9yZSB0aGUgZmluYWxseSBlbnRyeSBpZiBjb250cm9sIGlzIG5vdCBqdW1waW5nIHRvIGFcbiAgICAgICAgLy8gbG9jYXRpb24gb3V0c2lkZSB0aGUgdHJ5L2NhdGNoIGJsb2NrLlxuICAgICAgICBmaW5hbGx5RW50cnkgPSBudWxsO1xuICAgICAgfVxuXG4gICAgICB2YXIgcmVjb3JkID0gZmluYWxseUVudHJ5ID8gZmluYWxseUVudHJ5LmNvbXBsZXRpb24gOiB7fTtcbiAgICAgIHJlY29yZC50eXBlID0gdHlwZTtcbiAgICAgIHJlY29yZC5hcmcgPSBhcmc7XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkpIHtcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcIm5leHRcIjtcbiAgICAgICAgdGhpcy5uZXh0ID0gZmluYWxseUVudHJ5LmZpbmFsbHlMb2M7XG4gICAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gdGhpcy5jb21wbGV0ZShyZWNvcmQpO1xuICAgIH0sXG5cbiAgICBjb21wbGV0ZTogZnVuY3Rpb24ocmVjb3JkLCBhZnRlckxvYykge1xuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICByZWNvcmQudHlwZSA9PT0gXCJjb250aW51ZVwiKSB7XG4gICAgICAgIHRoaXMubmV4dCA9IHJlY29yZC5hcmc7XG4gICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcInJldHVyblwiKSB7XG4gICAgICAgIHRoaXMucnZhbCA9IHRoaXMuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcInJldHVyblwiO1xuICAgICAgICB0aGlzLm5leHQgPSBcImVuZFwiO1xuICAgICAgfSBlbHNlIGlmIChyZWNvcmQudHlwZSA9PT0gXCJub3JtYWxcIiAmJiBhZnRlckxvYykge1xuICAgICAgICB0aGlzLm5leHQgPSBhZnRlckxvYztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfSxcblxuICAgIGZpbmlzaDogZnVuY3Rpb24oZmluYWxseUxvYykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS5maW5hbGx5TG9jID09PSBmaW5hbGx5TG9jKSB7XG4gICAgICAgICAgdGhpcy5jb21wbGV0ZShlbnRyeS5jb21wbGV0aW9uLCBlbnRyeS5hZnRlckxvYyk7XG4gICAgICAgICAgcmVzZXRUcnlFbnRyeShlbnRyeSk7XG4gICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgXCJjYXRjaFwiOiBmdW5jdGlvbih0cnlMb2MpIHtcbiAgICAgIGZvciAodmFyIGkgPSB0aGlzL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KTtcbn1cbiJdfQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJidWlsZC9lbnRyeS5qcyIsImxpYi9jbGFzcy9jaGFydHMuY2xhc3MuanMiLCJsaWIvY2xhc3MvdXBkYXRlci5jbGFzcy5qcyIsImxpYi9jb25maWcvYXhpcy5qcyIsImxpYi9jb25maWcvYmFyLmpzIiwibGliL2NvbmZpZy9jb2xvci5qcyIsImxpYi9jb25maWcvZ2F1Z2UuanMiLCJsaWIvY29uZmlnL2dyaWQuanMiLCJsaWIvY29uZmlnL2luZGV4LmpzIiwibGliL2NvbmZpZy9sZWdlbmQuanMiLCJsaWIvY29uZmlnL2xpbmUuanMiLCJsaWIvY29uZmlnL3BpZS5qcyIsImxpYi9jb25maWcvcmFkYXIuanMiLCJsaWIvY29uZmlnL3JhZGFyQXhpcy5qcyIsImxpYi9jb25maWcvdGl0bGUuanMiLCJsaWIvY29yZS9heGlzLmpzIiwibGliL2NvcmUvYmFyLmpzIiwibGliL2NvcmUvZ2F1Z2UuanMiLCJsaWIvY29yZS9ncmlkLmpzIiwibGliL2NvcmUvaW5kZXguanMiLCJsaWIvY29yZS9sZWdlbmQuanMiLCJsaWIvY29yZS9saW5lLmpzIiwibGliL2NvcmUvbWVyZ2VDb2xvci5qcyIsImxpYi9jb3JlL3BpZS5qcyIsImxpYi9jb3JlL3JhZGFyLmpzIiwibGliL2NvcmUvcmFkYXJBeGlzLmpzIiwibGliL2NvcmUvdGl0bGUuanMiLCJsaWIvZXh0ZW5kL2luZGV4LmpzIiwibGliL2luZGV4LmpzIiwibGliL3V0aWwvaW5kZXguanMiLCJub2RlX21vZHVsZXMvQGJhYmVsL3J1bnRpbWUvaGVscGVycy9hcnJheVdpdGhIb2xlcy5qcyIsIm5vZGVfbW9kdWxlcy9AYmFiZWwvcnVudGltZS9oZWxwZ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Y2FzZSAxNzpcbiAgICAgICAgICAgIGlmICghKGFuaW1hdGlvbkRlbGF5ID4gMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gZGVsYXkoYW5pbWF0aW9uRGVsYXkpO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIHJlbmRlciA9IHRoaXMucmVuZGVyO1xuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cIiwgbmV3IFByb21pc2UoXG4gICAgICAgICAgICAvKiNfX1BVUkVfXyovXG4gICAgICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgIHZhciBfcmVmMyA9ICgwLCBfYXN5bmNUb0dlbmVyYXRvcjJbXCJkZWZhdWx0XCJdKShcbiAgICAgICAgICAgICAgLyojX19QVVJFX18qL1xuICAgICAgICAgICAgICBfcmVnZW5lcmF0b3JbXCJkZWZhdWx0XCJdLm1hcmsoZnVuY3Rpb24gX2NhbGxlZShyZXNvbHZlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvcltcImRlZmF1bHRcIl0ud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlbmRlci5sYXVuY2hBbmltYXRpb24oKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgX2NhbGxlZSk7XG4gICAgICAgICAgICAgIH0pKTtcblxuICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKF94Mykge1xuICAgICAgICAgICAgICAgIHJldHVybiBfcmVmMy5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfSgpKSk7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICB9KSk7XG5cbiAgcmV0dXJuIGZ1bmN0aW9uIChfeCwgX3gyKSB7XG4gICAgcmV0dXJuIF9yZWYyLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gIH07XG59KCk7XG4vKipcclxuICogQGRlc2NyaXB0aW9uIEV4dHJhY3QgdGhlIG5leHQgZnJhbWUgb2YgZGF0YSBmcm9tIHRoZSBhbmltYXRpb24gcXVldWVcclxuICogICAgICAgICAgICAgIGFuZCB1cGRhdGUgdGhlIGdyYXBoIHN0YXRlXHJcbiAqIEByZXR1cm4ge1VuZGVmaW5lZH0gVm9pZFxyXG4gKi9cblxuXG5HcmFwaC5wcm90b3R5cGUudHVybk5leHRBbmltYXRpb25GcmFtZSA9IGZ1bmN0aW9uICh0aW1lU3RhbXApIHtcbiAgd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Db21wbGV0ZWQ7XG4gICAgICAgICAgICB0aHJvdyBjb250ZXh0LmFyZztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBjb250ZXh0LmRpc3BhdGNoRXhjZXB0aW9uKGNvbnRleHQuYXJnKTtcblxuICAgICAgICB9IGVsc2UgaWYgKGNvbnRleHQubWV0aG9kID09PSBcInJldHVyblwiKSB7XG4gICAgICAgICAgY29udGV4dC5hYnJ1cHQoXCJyZXR1cm5cIiwgY29udGV4dC5hcmcpO1xuICAgICAgICB9XG5cbiAgICAgICAgc3RhdGUgPSBHZW5TdGF0ZUV4ZWN1dGluZztcblxuICAgICAgICB2YXIgcmVjb3JkID0gdHJ5Q2F0Y2goaW5uZXJGbiwgc2VsZiwgY29udGV4dCk7XG4gICAgICAgIGlmIChyZWNvcmQudHlwZSA9PT0gXCJub3JtYWxcIikge1xuICAgICAgICAgIC8vIElmIGFuIGV4Y2VwdGlvbiBpcyB0aHJvd24gZnJvbSBpbm5lckZuLCB3ZSBsZWF2ZSBzdGF0ZSA9PT1cbiAgICAgICAgICAvLyBHZW5TdGF0ZUV4ZWN1dGluZyBhbmQgbG9vcCBiYWNrIGZvciBhbm90aGVyIGludm9jYXRpb24uXG4gICAgICAgICAgc3RhdGUgPSBjb250ZXh0LmRvbmVcbiAgICAgICAgICAgID8gR2VuU3RhdGVDb21wbGV0ZWRcbiAgICAgICAgICAgIDogR2VuU3RhdGVTdXNwZW5kZWRZaWVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1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iAgICAgICAgcmV0dXJuIGl0ZXJhdG9yTWV0aG9kLmNhbGwoaXRlcmFibGUpO1xuICAgICAgfVxuXG4gICAgICBpZiAodHlwZW9mIGl0ZXJhYmxlLm5leHQgPT09IFwiZnVuY3Rpb25cIikge1xuICAgICAgICByZXR1cm4gaXRlcmFibGU7XG4gICAgICB9XG5cbiAgICAgIGlmICghaXNOYU4oaXRlcmFibGUubGVuZ3RoKSkge1xuICAgICAgICB2YXIgaSA9IC0xLCBuZXh0ID0gZnVuY3Rpb24gbmV4dCgpIHtcbiAgICAgICAgICB3aGlsZSAoKytpIDwgaXRlcmFibGUubGVuZ3RoKSB7XG4gICAgICAgICAgICBpZiAoaGFzT3duLmNhbGwoaXRlcmFibGUsIGkpKSB7XG4gICAgICAgICAgICAgIG5leHQudmFsdWUgPSBpdGVyYWJsZVtpXTtcbiAgICAgICAgICAgICAgbmV4dC5kb25lID0gZmFsc2U7XG4gICAgICAgICAgICAgIHJldHVybiBuZXh0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIG5leHQudmFsdWUgPSB1bmRlZmluZWQ7XG4gICAgICAgICAgbmV4dC5kb25lID0gdHJ1ZTtcblxuICAgICAgICAgIHJldHVybiBuZXh0O1xuICAgICAgICB9O1xuXG4gICAgICAgIHJldHVybiBuZXh0Lm5leHQgPSBuZXh0O1xuICAgICAgfVxuICAgIH1cblxuICAgIC8vIFJldHVybiBhbiBpdGVyYXRvciB3aXRoIG5vIHZhbHVlcy5cbiAgICByZXR1cm4geyBuZXh0OiBkb25lUmVzdWx0IH07XG4gIH1cbiAgZXhwb3J0cy52YWx1ZXMgPSB2YWx1ZXM7XG5cbiAgZnVuY3Rpb24gZG9uZVJlc3VsdCgpIHtcbiAgICByZXR1cm4geyB2YWx1ZTogdW5kZWZpbmVkLCBkb25lOiB0cnVlIH07XG4gIH1cblxuICBDb250ZXh0LnByb3RvdHlwZSA9IHtcbiAgICBjb25zdHJ1Y3RvcjogQ29udGV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lbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidHJ5IHN0YXRlbWVudCB3aXRob3V0IGNhdGNoIG9yIGZpbmFsbHlcIik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIGFicnVwdDogZnVuY3Rpb24odHlwZSwgYXJnKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LnRyeUxvYyA8PSB0aGlzLnByZXYgJiZcbiAgICAgICAgICAgIGhhc093bi5jYWxsKGVudHJ5LCBcImZpbmFsbHlMb2NcIikgJiZcbiAgICAgICAgICAgIHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICB2YXIgZmluYWxseUVudHJ5ID0gZW50cnk7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSAmJlxuICAgICAgICAgICh0eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICAgdHlwZSA9PT0gXCJjb250aW51ZVwiKSAmJlxuICAgICAgICAgIGZpbmFsbHlFbnRyeS50cnlMb2MgPD0gYXJnICYmXG4gICAgICAgICAgYXJnIDw9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgIC8vIElnbm9yZSB0aGUgZmluYWxseSBlbnRyeSBpZiBjb250cm9sIGlzIG5vdCBqdW1waW5nIHRvIGFcbiAgICAgICAgLy8gbG9jYXRpb24gb3V0c2lkZSB0aGUgdHJ5L2NhdGNoIGJsb2NrLlxuICAgICAgICBmaW5hbGx5RW50cnkgPSBudWxsO1xuICAgICAgfVxuXG4gICAgICB2YXIgcmVjb3JkID0gZmluYWxseUVudHJ5ID8gZmluYWxseUVudHJ5LmNvbXBsZXRpb24gOiB7fTtcbiAgICAgIHJlY29yZC50eXBlID0gdHlwZTtcbiAgICAgIHJlY29yZC5hcmcgPSBhcmc7XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkpIHtcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcIm5leHRcIjtcbiAgICAgICAgdGhpcy5uZXh0ID0gZmluYWxseUVudHJ5LmZpbmFsbHlMb2M7XG4gICAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gdGhpcy5jb21wbGV0ZShyZWNvcmQpO1xuICAgIH0sXG5cbiAgICBjb21wbGV0ZTogZnVuY3Rpb24ocmVjb3JkLCBhZnRlckxvYykge1xuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICByZWNvcmQudHlwZSA9PT0gXCJjb250aW51ZVwiKSB7XG4gICAgICAgIHRoaXMubmV4dCA9IHJlY29yZC5hcmc7XG4gICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcInJldHVyblwiKSB7XG4gICAgICAgIHRoaXMucnZhbCA9IHRoaXMuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcInJldHVyblwiO1xuICAgICAgICB0aGlzLm5leHQgPSBcImVuZFwiO1xuICAgICAgfSBlbHNlIGlmIChyZWNvcmQudHlwZSA9PT0gXCJub3JtYWxcIiAmJiBhZnRlckxvYykge1xuICAgICAgICB0aGlzLm5leHQgPSBhZnRlckxvYztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfSxcblxuICAgIGZpbmlzaDogZnVuY3Rpb24oZmluYWxseUxvYykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS5maW5hbGx5TG9jID09PSBmaW5hbGx5TG9jKSB7XG4gICAgICAgICAgdGhpcy5jb21wbGV0ZShlbnRyeS5jb21wbGV0aW9uLCBlbnRyeS5hZnRlckxvYyk7XG4gICAgICAgICAgcmVzZXRUcnlFbnRyeShlbnRyeSk7XG4gICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgXCJjYXRjaFwiOiBmdW5jdGlvbih0cnlMb2MpIHtcbiAgICAgIGZvciAodmFyIGkgPSB0aGlzLnRyeUVudHJpZXMubGVuZ3RoIC0gMTsgaSA+PSAwOyAtLWkpIHtcbiAgICAgICAgdmFyIGVudHJ5ID0gdGhpcy50cnlFbnRyaWVzW2ldO1xuICAgICAgICBpZiAoZW50cnkudHJ5TG9jID09PSB0cnlMb2MpIHtcbiAgICAgICAgICB2YXIgcmVjb3JkID0gZW50cnkuY29tcGxldGlvbjtcbiAgICAgICAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgICAgdmFyIHRocm93biA9IHJlY29yZC5hcmc7XG4gICAgICAgICAgICByZXNldFRyeUVudHJ5KGVudHJ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GVudGFsbHkgcnVucyBpbiBzdHJpY3QgbW9kZSwgd2UgY2FuIGVzY2FwZVxuICAvLyBzdHJpY3QgbW9kZSB1c2luZyBhIGdsb2JhbCBGdW5jdGlvbiBjYWxsLiBUaGlzIGNvdWxkIGNvbmNlaXZhYmx5IGZhaWxcbiAgLy8gaWYgYSBDb250ZW50IFNlY3VyaXR5IFBvbGljeSBmb3JiaWRzIHVzaW5nIEZ1bmN0aW9uLCBidXQgaW4gdGhhdCBjYXNlXG4gIC8vIHRoZSBwcm9wZXIgc29sdXRpb24gaXMgdG8gZml4IHRoZSBhY2NpZGVudGFsIHN0cmljdCBtb2RlIHByb2JsZW0uIElmXG4gIC8vIHlvdSd2ZSBtaXNjb25maWd1cmVkIHlvdXIgYnVuZGxlciB0byBmb3JjZSBzdHJpY3QgbW9kZSBhbmQgYXBwbGllZCBhXG4gIC8vIENTUCB0byBmb3JiaWQgRnVuY3Rpb24sIGFuZCB5b3UncmUgbm90IHdpbGxpbmcgdG8gZml4IGVpdGhlciBvZiB0aG9zZVxuICAvLyBwcm9ibGVtcywgcGxlYXNlIGRldGFpbCB5b3VyIHVuaXF1ZSBwcmVkaWNhbWVudCBpbiBhIEdpdEh1YiBpc3N1ZS5cbiAgRnVuY3Rpb24oXCJyXCIsIFwicmVnZW5lcmF0b3JSdW50aW1lID0gclwiKShydW50aW1lKTtcbn1cbiJdfQ== diff --git a/dist/charts.min.js b/dist/charts.min.js index 81e986f..f27bc9a 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:{},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]})})}},{"../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/config/bar.js b/lib/config/bar.js index 05e76e3..84e529b 100644 --- a/lib/config/bar.js +++ b/lib/config/bar.js @@ -203,6 +203,25 @@ var barConfig = { */ barStyle: {}, + /** + * @description Independent color mode + * When set to true, independent color mode is enabled + * @type {Boolean} + * @default independentColor = false + */ + independentColor: false, + + /** + * @description Independent colors + * Only effective when independent color mode is enabled + * Default value is the same as the color in the root configuration + * Two-dimensional color array can produce gradient colors + * @type {Array} + * @example independentColor = ['#fff', '#000'] + * @example independentColor = [['#fff', '#000'], '#000'] + */ + independentColors: [], + /** * @description Bar chart render level * Priority rendering high level diff --git a/lib/core/bar.js b/lib/core/bar.js index 8680ec5..c1eb67a 100644 --- a/lib/core/bar.js +++ b/lib/core/bar.js @@ -577,9 +577,17 @@ function getNormalBarShape(barItem, i) { function getBarStyle(barItem, i) { var barStyle = barItem.barStyle, gradient = barItem.gradient, - color = barItem.color; + color = barItem.color, + independentColor = barItem.independentColor, + independentColors = barItem.independentColors; var fillColor = [barStyle.fill || color]; var gradientColor = (0, _util2.deepMerge)(fillColor, gradient.color); + + if (independentColor) { + var idtColor = independentColors[i % independentColors.length]; + gradientColor = idtColor instanceof Array ? idtColor : [idtColor]; + } + if (gradientColor.length === 1) gradientColor.push(gradientColor[0]); var gradientParams = getGradientParams(barItem, i); return (0, _util2.deepMerge)({ diff --git a/lib/core/mergeColor.js b/lib/core/mergeColor.js index fd27403..8fe6633 100644 --- a/lib/core/mergeColor.js +++ b/lib/core/mergeColor.js @@ -43,4 +43,13 @@ function mergeColor(chart) { 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; + }); } \ No newline at end of file