From dbcfadb5479758e75c80543f57aa567e003af702 Mon Sep 17 00:00:00 2001 From: jiaming743 <743192023@qq.com> Date: Thu, 2 Jul 2020 10:56:40 +0800 Subject: [PATCH] update dist and lib --- dist/charts.map.js | 5 +++-- dist/charts.min.js | 2 +- lib/extend/index.js | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/charts.map.js b/dist/charts.map.js index 0f8e178..10d1d70 100644 --- a/dist/charts.map.js +++ b/dist/charts.map.js @@ -7406,7 +7406,8 @@ var numberText = { var textSegments = content.split('{nt}'); var textString = ''; textSegments.forEach(function (t, i) { - var currentNumber = number[i] || ''; + var currentNumber = number[i]; + if (typeof currentNumber !== 'number') currentNumber = ''; if (typeof currentNumber === 'number') { currentNumber = currentNumber.toFixed(toFixed); @@ -12595,4 +12596,4 @@ try { } },{}]},{},[1]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJidWlsZC9lbnRyeS5qcyIsImxpYi9jbGFzcy9jaGFydHMuY2xhc3MuanMiLCJsaWIvY2xhc3MvdXBkYXRlci5jbGFzcy5qcyIsImxpYi9jb25maWcvYXhpcy5qcyIsImxpYi9jb25maWcvYmFyLmpzIiwibGliL2NvbmZpZy9jb2xvci5qcyIsImxpYi9jb25maWcvZ2F1Z2UuanMiLCJsaWIvY29uZmlnL2dyaWQuanMiLCJsaWIvY29uZmlnL2luZGV4LmpzIiwibGliL2NvbmZpZy9sZWdlbmQuanMiLCJsaWIvY29uZmlnL2xpbmUuanMiLCJsaWIvY29uZmlnL3BpZS5qcyIsImxpYi9jb25maWcvcmFkYXIuanMiLCJsaWIvY29uZmlnL3JhZGFyQXhpcy5qcyIsImxpYi9jb25maWcvdGl0bGUuanMiLCJsaWIvY29yZS9heGlzLmpzIiwibGliL2NvcmUvYmFyLmpzIiwibGliL2NvcmUvZ2F1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9IG51bWJlcltpXSB8fCAnJztcblxuICAgICAgaWYgKHR5cGVvZiBjdXJyZW50TnVtYmVyID09PSAnbnVtYmVyJykge1xuICAgICAgICBjdXJyZW50TnVtYmVyID0gY3VycmVudE51bWJlci50b0ZpeGVkKHRvRml4ZWQpO1xuICAgICAgICBpZiAodHlwZW9mIGZvcm1hdHRlciA9PT0gJ2Z1bmN0aW9uJykgY3VycmVudE51bWJlciA9IGZvcm1hdHRlcihjdXJyZW50TnVtYmVyKTtcbiAgICAgIH1cblxuICAgICAgdGV4dFN0cmluZyArPSB0ICsgKGN1cnJlbnROdW1iZXIgfHwgJycpO1xuICAgIH0pO1xuXG4gICAgX2dyYXBocy50ZXh0LmRyYXcoe1xuICAgICAgY3R4OiBjdHhcbiAgICB9LCB7XG4gICAgICBzaGFwZTogX29iamVjdFNwcmVhZCh7fSwgc2hhcGUsIHtcbiAgICAgICAgY29udGVudDogdGV4dFN0cmluZyxcbiAgICAgICAgcm93R2FwOiByb3dHYXBcbiAgICAgIH0pXG4gICAgfSk7XG4gIH1cbn07XG52YXIgbGluZUljb24gPSB7XG4gIHNoYXBlOiB7XG4gICAgeDogMCxcbiAgICB5OiAwLFxuICAgIHc6IDAsXG4gICAgaDogMFxuICB9LFxuICB2YWxpZGF0b3I6IGZ1bmN0aW9uIHZhbGlkYXRvcihfcmVmMTApIHtcbiAgICB2YXIgc2hhcGUgPSBfcmVmMTAuc2hhcGU7XG4gICAgdmFyIHggPSBzaGFwZS54LFxuICAgICAgICB5ID0gc2hhcGUueSxcbiAgICAgICAgdyA9IHNoYXBlLncsXG4gICAgICAgIGggPSBzaGFwZS5oO1xuXG4gICAgaWYgKHR5cGVvZiB4ICE9PSAnbnVtYmVyJyB8fCB0eXBlb2YgeSAhPT0gJ251bWJlcicgfHwgdHlwZW9mIHcgIT09ICdudW1iZXInIHx8IHR5cGVvZiBoICE9PSAnbnVtYmVyJykge1xuICAgICAgY29uc29sZS5lcnJvcignbGluZUljb24gc2hhcGUgY29u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ChcInJldHVyblwiKTtcblxuICAgICAgICAgIGNhc2UgMTc6XG4gICAgICAgICAgICBpZiAoIShhbmltYXRpb25EZWxheSA+IDApKSB7XG4gICAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjA7XG4gICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDIwO1xuICAgICAgICAgICAgcmV0dXJuIGRlbGF5KGFuaW1hdGlvbkRlbGF5KTtcblxuICAgICAgICAgIGNhc2UgMjA6XG4gICAgICAgICAgICByZW5kZXIgPSB0aGlzLnJlbmRlcjtcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIsIG5ldyBQcm9taXNlKFxuICAgICAgICAgICAgLyojX19QVVJFX18qL1xuICAgICAgICAgICAgZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICB2YXIgX3JlZjMgPSAoMCwgX2FzeW5jVG9HZW5lcmF0b3IyW1wiZGVmYXVsdFwiXSkoXG4gICAgICAgICAgICAgIC8qI19fUFVSRV9fKi9cbiAgICAgICAgICAgICAgX3JlZ2VuZXJhdG9yW1wiZGVmYXVsdFwiXS5tYXJrKGZ1bmN0aW9uIF9jYWxsZWUocmVzb2x2ZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBfcmVnZW5lcmF0b3JbXCJkZWZhdWx0XCJdLndyYXAoZnVuY3Rpb24gX2NhbGxlZSQoX2NvbnRleHQpIHtcbiAgICAgICAgICAgICAgICAgIHdoaWxlICgxKSB7XG4gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoX2NvbnRleHQucHJldiA9IF9jb250ZXh0Lm5leHQpIHtcbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgICAgICAgICAgICAgICBfY29udGV4dC5uZXh0ID0gMjtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZW5kZXIubGF1bmNoQW5pbWF0aW9uKCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIDI6XG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG5cbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIDM6XG4gICAgICAgICAgICAgICAgICAgICAgY2FzZSBcImVuZFwiOlxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0LnN0b3AoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIF9jYWxsZWUpO1xuICAgICAgICAgICAgICB9KSk7XG5cbiAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChfeDMpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gX3JlZjMuYXBwbHkodGhpcywgYXJndW1lbnRzKTtcbiAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH0oKSkpO1xuXG4gICAgICAgICAgY2FzZSAyMjpcbiAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLnN0b3AoKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sIF9jYWxsZWUyLCB0aGlzKTtcbiAgfSkpO1xuXG4gIHJldHVybiBmdW5jdGlvbiAoX3gsIF94Mikge1xuICAgIHJldHVybiBfcmVmMi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICB9O1xufSgpO1xuLyoqXHJcbiAqIEBkZXNjcmlwdGlvbiBFeHRyYWN0IHRoZSBuZXh0IGZyYW1lIG9mIGRhdGEgZnJvbSB0aGUgYW5pbWF0aW9uIHF1ZXVlXHJcbiAqICAgICAgICAgICAgICBhbmQgdXBkYXRlIHRoZSBncmFwaCBzdGF0ZVxyXG4gKiBAcmV0dXJuIHtVbmRlZmluZWR9IFZvaWRcclxuICovXG5cblxuR3JhcGgucHJvdG90eXBlLnR1cm5OZXh0QW5pbWF0aW9uRnJhbWU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fSBlbHNlIGlmIChjb250ZXh0Lm1ldGhvZCA9PT0gXCJ0aHJvd1wiKSB7XG4gICAgICAgICAgaWYgKHN0YXRlID09PSBHZW5TdGF0ZVN1c3BlbmRlZFN0YXJ0KSB7XG4gICAgICAgICAgICBzdGF0ZSA9IEdlblN0YXRlQ29tcGxldGVkO1xuICAgICAgICAgICAgdGhyb3cgY29udGV4dC5hcmc7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY29udGV4dC5kaXNwYXRjaEV4Y2VwdGlvbihjb250ZXh0LmFyZyk7XG5cbiAgICAgICAgfSBlbHNlIGlmIChjb250ZXh0Lm1ldGhvZCA9PT0gXCJyZXR1cm5cIikge1xuICAgICAgICAgIGNvbnRleHQuYWJydXB0KFwicmV0dXJuXCIsIGNvbnRleHQuYXJnKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHN0YXRlID0gR2VuU3RhdGVFeGVjdXRpbmc7XG5cbiAgICAgICAgdmFyIHJlY29yZCA9IHRyeUNhdGNoKGlubmVyRm4sIHNlbGYsIGNvbnRleHQpO1xuICAgICAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwibm9ybWFsXCIpIHtcbiAgICAgICAgICAvLyBJZiBhbiBleGNlcHRpb24gaXMgdGhyb3duIGZyb20gaW5uZXJGbiwgd2UgbGVhdmUgc3RhdGUgPT09XG4gICAgICAgICAgLy8gR2VuU3RhdGVFeGVjdXRpbmcgYW5kIGxvb3AgYmFjayBmb3IgYW5vdGhlciBpbnZvY2F0aW9uLlxuICAgICAgICAgIHN0YXRlID0gY29udGV4dC5kb25lXG4gICAgICAgICAgICA/IEdlblN0YXRlQ29tcGxldGVkXG4gICAgICAgICAgICA6IEdlblN0YXRlU3VzcGVuZGVkWWllbGQ7XG5cbiAgICAgICAgICBpZiAocmVjb3JkLmFyZyA9PT0gQ29udGludWVTZW50aW5lbCkge1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgcmV0dXJuIHtcb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cbiAgICAgICAgICAgIHRoaXNbbmFtZV0gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIHN0b3A6IGZ1bmN0aW9uKCkge1xuICAgICAgdGhpcy5kb25lID0gdHJ1ZTtcblxuICAgICAgdmFyIHJvb3RFbnRyeSA9IHRoaXMudHJ5RW50cmllc1swXTtcbiAgICAgIHZhciByb290UmVjb3JkID0gcm9vdEVudHJ5LmNvbXBsZXRpb247XG4gICAgICBpZiAocm9vdFJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcm9vdFJlY29yZC5hcmc7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzLnJ2YWw7XG4gICAgfSxcblxuICAgIGRpc3BhdGNoRXhjZXB0aW9uOiBmdW5jdGlvbihleGNlcHRpb24pIHtcbiAgICAgIGlmICh0aGlzLmRvbmUpIHtcbiAgICAgICAgdGhyb3cgZXhjZXB0aW9uO1xuICAgICAgfVxuXG4gICAgICB2YXIgY29udGV4dCA9IHRoaXM7XG4gICAgICBmdW5jdGlvbiBoYW5kbGUobG9jLCBjYXVnaHQpIHtcbiAgICAgICAgcmVjb3JkLnR5cGUgPSBcInRocm93XCI7XG4gICAgICAgIHJlY29yZC5hcmcgPSBleGNlcHRpb247XG4gICAgICAgIGNvbnRleHQubmV4dCA9IGxvYztcblxuICAgICAgICBpZiAoY2F1Z2h0KSB7XG4gICAgICAgICAgLy8gSWYgdGhlIGRpc3BhdGNoZWQgZXhjZXB0aW9uIHdhcyBjYXVnaHQgYnkgYSBjYXRjaCBibG9jayxcbiAgICAgICAgICAvLyB0aGVuIGxldCB0aGF0IGNhdGNoIGJsb2NrIGhhbmRsZSB0aGUgZXhjZXB0aW9uIG5vcm1hbGx5LlxuICAgICAgICAgIGNvbnRleHQubWV0aG9kID0gXCJuZXh0XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSB1bmRlZmluZ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gICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNDYXRjaCkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmNhdGNoTG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIGlmIChoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmZpbmFsbHlMb2MpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcInRyeSBzdGF0ZW1lbnQgd2l0aG91dCBjYXRjaCBvciBmaW5hbGx5XCIpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG5cbiAgICBhYnJ1cHQ6IGZ1bmN0aW9uKHR5cGUsIGFyZykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPD0gdGhpcy5wcmV2ICYmXG4gICAgICAgICAgICBoYXNPd24uY2FsbChlbnRyeSwgXCJmaW5hbGx5TG9jXCIpICYmXG4gICAgICAgICAgICB0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgdmFyIGZpbmFsbHlFbnRyeSA9IGVudHJ5O1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkgJiZcbiAgICAgICAgICAodHlwZSA9PT0gXCJicmVha1wiIHx8XG4gICAgICAgICAgIHR5cGUgPT09IFwiY29udGludWVcIikgJiZcbiAgICAgICAgICBmaW5hbGx5RW50cnkudHJ5TG9jIDw9IGFyZyAmJlxuICAgICAgICAgIGFyZyA8PSBmaW5hbGx5RW50cnkuZmluYWxseUxvYykge1xuICAgICAgICAvLyBJZ25vcmUgdGhlIGZpbmFsbHkgZW50cnkgaWYgY29udHJvbCBpcyBub3QganVtcGluZyB0byBhXG4gICAgICAgIC8vIGxvY2F0aW9uIG91dHNpZGUgdGhlIHRyeS9jYXRjaCBibG9jay5cbiAgICAgICAgZmluYWxseUVudHJ5ID0gbnVsbDtcbiAgICAgIH1cblxuICAgICAgdmFyIHJlY29yZCA9IGZpbmFsbHlFbnRyeSA/IGZpbmFsbHlFbnRyeS5jb21wbGV0aW9uIDoge307XG4gICAgICByZWNvcmQudHlwZSA9IHR5cGU7XG4gICAgICByZWNvcmQuYXJnID0gYXJnO1xuXG4gICAgICBpZiAoZmluYWxseUVudHJ5KSB7XG4gICAgICAgIHRoaXMubWV0aG9kID0gXCJuZXh0XCI7XG4gICAgICAgIHRoaXMubmV4dCA9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jO1xuICAgICAgICByZXR1cm4gQ29udGludWVTZW50aW5lbDtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIHRoaXMuY29tcGxldGUocmVjb3JkKTtcbiAgICB9LFxuXG4gICAgY29tcGxldGU6IGZ1bmN0aW9uKHJlY29yZCwgYWZ0ZXJMb2MpIHtcbiAgICAgIGlmIChyZWNvcmQudHlwZSA9PT0gXCJ0aHJvd1wiKSB7XG4gICAgICAgIHRocm93IHJlY29yZC5hcmc7XG4gICAgICB9XG5cbiAgICAgIGlmIChyZWNvcmQudHlwZSA9PT0gXCJicmVha1wiIHx8XG4gICAgICAgICAgcmVjb3JkLnR5cGUgPT09IFwiY29udGludWVcIik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ICAgICAgICB0aGlzLmFuaW1hdGlvbktleXMucHVzaChjaGFuZ2VLZXlzKTtcbiAgICAgICAgICAgIHRoaXMuYW5pbWF0aW9uRnJhbWVTdGF0ZS5wdXNoKGFuaW1hdGlvbkZyYW1lU3RhdGUpO1xuXG4gICAgICAgICAgICBpZiAoIXdhaXQpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAxNztcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuYWJydXB0KFwicmV0dXJuXCIpO1xuXG4gICAgICAgICAgY2FzZSAxNzpcbiAgICAgICAgICAgIGlmICghKGFuaW1hdGlvbkRlbGF5ID4gMCkpIHtcbiAgICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyMDtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIF9jb250ZXh0Mi5uZXh0ID0gMjA7XG4gICAgICAgICAgICByZXR1cm4gZGVsYXkoYW5pbWF0aW9uRGVsYXkpO1xuXG4gICAgICAgICAgY2FzZSAyMDpcbiAgICAgICAgICAgIHJlbmRlciA9IHRoaXMucmVuZGVyO1xuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cIiwgbmV3IFByb21pc2UoXG4gICAgICAgICAgICAvKiNfX1BVUkVfXyovXG4gICAgICAgICAgICBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICAgIHZhciBfcmVmMyA9ICgwLCBfYXN5bmNUb0dlbmVyYXRvcjJbXCJkZWZhdWx0XCJdKShcbiAgICAgICAgICAgICAgLyojX19QVVJFX18qL1xuICAgICAgICAgICAgICBfcmVnZW5lcmF0b3JbXCJkZWZhdWx0XCJdLm1hcmsoZnVuY3Rpb24gX2NhbGxlZShyZXNvbHZlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9yZWdlbmVyYXRvcltcImRlZmF1bHRcIl0ud3JhcChmdW5jdGlvbiBfY2FsbGVlJChfY29udGV4dCkge1xuICAgICAgICAgICAgICAgICAgd2hpbGUgKDEpIHtcbiAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChfY29udGV4dC5wcmV2ID0gX2NvbnRleHQubmV4dCkge1xuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDpcbiAgICAgICAgICAgICAgICAgICAgICAgIF9jb250ZXh0Lm5leHQgPSAyO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlbmRlci5sYXVuY2hBbmltYXRpb24oKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcblxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMzpcbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIFwiZW5kXCI6XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gX2NvbnRleHQuc3RvcCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgX2NhbGxlZSk7XG4gICAgICAgICAgICAgIH0pKTtcblxuICAgICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24gKF94Mykge1xuICAgICAgICAgICAgICAgIHJldHVybiBfcmVmMy5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xuICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfSgpKSk7XG5cbiAgICAgICAgICBjYXNlIDIyOlxuICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgIHJldHVybiBfY29udGV4dDIuc3RvcCgpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfSwgX2NhbGxlZTIsIHRoaXMpO1xuICB9KSk7XG5cbiAgcmV0dXJuIGZ1bmN0aW9uIChfeCwgX3gyKSB7XG4gICAgcmV0dXJuIF9yZWYyLmFwcGx5KH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0ZWRcbiAgICAgICAgICAgIDogR2VuU3RhdGVTdXNwZW5kZWRZaWVsZDtcblxuICAgICAgICAgIGlmIChyZWNvcmQuYXJnID09PSBDb250aW51ZVNlbnRpbmVsKSB7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgdmFsdWU6IHJlY29yZC5hcmcsXG4gICAgICAgICAgICBkb25lOiBjb250ZXh0LmRvbmVcbiAgICAgICAgICB9O1xuXG4gICAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIHN0YXRlID0gR2VuU3RhdGVDb21wbGV0ZWQ7XG4gICAgICAgICAgLy8gRGlzcGF0Y2ggdGhlIGV4Y2VwdGlvbiBieSBsb29waW5nIGJhY2sgYXJvdW5kIHRvIHRoZVxuICAgICAgICAgIC8vIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpIGNhbGwgYWJvdmUuXG4gICAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgICAgY29udGV4dC5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfTtcbiAgfVxuXG4gIC8vIENhbGwgZGVsZWdhdGUuaXRlcmF0b3JbY29udGV4dC5tZXRob2RdKGNvbnRleHQuYXJnKSBhbmQgaGFuZGxlIHRoZVxuICAvLyByZXN1bHQsIGVpdGhlciBieSByZXR1cm5pbmcgYSB7IHZhbHVlLCBkb25lIH0gcmVzdWx0IGZyb20gdGhlXG4gIC8vIGRlbGVnYXRlIGl0ZXJhdG9yLCBvciBieSBtb2RpZnlpbmcgY29udGV4dC5tZXRob2QgYW5kIGNvbnRleHQuYXJnLFxuICAvLyBzZXR0aW5nIGNvbnRleHQuZGVsZWdhdGUgdG8gbnVsbCwgYW5kIHJldHVybmluZyB0aGUgQ29udGludWVTZW50a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gICAgICAgIC8vIFwicmV0dXJuXCIgdG8gXCJ0aHJvd1wiLCBsZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3RcIik7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIGlmIChpbmZvLmRvbmUpIHtcbiAgICAgIC8vIEFzc2lnbiB0aGUgcm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ICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfSBlbHNlIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0NhdGNoKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidHJ5IHN0YXRlbWVudCB3aXRob3V0IGNhdGNoIG9yIGZpbmFsbHlcIik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIGFicnVwdDogZnVuY3Rpb24odHlwZSwgYXJnKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LnRyeUxvYyA8PSB0aGlzLnByZXYgJiZcbiAgICAgICAgICAgIGhhc093bi5jYWxsKGVudHJ5LCBcImZpbmFsbHlMb2NcIikgJiZcbiAgICAgICAgICAgIHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICB2YXIgZmluYWxseUVudHJ5ID0gZW50cnk7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSAmJlxuICAgICAgICAgICh0eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICAgdHlwZSA9PT0gXCJjb250aW51ZVwiKSAmJlxuICAgICAgICAgIGZpbmFsbHlFbnRyeS50cnlMb2MgPD0gYXJnICYmXG4gICAgICAgICAgYXJnIDw9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgIC8vIElnbm9yZSB0aGUgZmluYWxseSBlbnRyeSBpZiBjb250cm9sIGlzIG5vdCBqdW1waW5nIHRvIGFcbiAgICAgICAgLy8gbG9jYXRpb24gb3V0c2lkZSB0aGUgdHJ5L2NhdGNoIGJsb2NrLlxuICAgICAgICBmaW5hbGx5RW50cnkgPSBudWxsO1xuICAgICAgfVxuXG4gICAgICB2YXIgcmVjb3JkID0gZmluYWxseUVudHJ5ID8gZmluYWxseUVudHJ5LmNvbXBsZXRpb24gOiB7fTtcbiAgICAgIHJlY29yZC50eXBlID0gdHlwZTtcbiAgICAgIHJlY29yZC5hcmcgPSBhcmc7XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkpIHtcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcIm5leHRcIjtcbiAgICAgICAgdGhpcy5uZXh0ID0gZmluYWxseUVudHJ5LmZpbmFsbHlMb2M7XG4gICAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gdGhpcy5jb21wbGV0ZShyZWNvcmQpO1xuICAgIH0sXG5cbiAgICBjb21wbGV0ZTogZnVuY3Rpb24ocmVjb3JkLCBhZnRlckxvYykge1xuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICByZWNvcmQudHlwZSA9PT0gXCJjb250aW51ZVwiKSB7XG4gICAgICAgIHRoaXMubmV4dCA9IHJlY29yZC5hcmc7XG4gICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcInJldHVyblwiKSB7XG4gICAgICAgIHRoaXMucnZhbCA9IHRoaXMuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcInJldHVyblwiO1xuICAgICAgICB0aGlzLm5leHQgPSBcImVuZFwiO1xuICAgICAgfSBlbHNlIGlmIChyZWNvcmQudHlwZSA9PT0gXCJub3JtYWxcIiAmJiBhZnRlckxvYykge1xuICAgICAgICB0aGlzLm5leHQgPSBhZnRlckxvYztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfSxcblxuICAgIGZpbmlzaDogZnVuY3Rpb24oZmluYWxseUxvYykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS5maW5hbGx5TG9jID09PSBmaW5hbGx5TG9jKSB7XG4gICAgICAgICAgdGhpcy5jb21wbGV0ZShlbnRyeS5jb21wbGV0aW9uLCBlbnRyeS5hZnRlckxvYyk7XG4gICAgICAgICAgcmVzZXRUcnlFbnRyeShlbnRyeSk7XG4gICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgXCJjYXRjaFwiOiBmdW5jdGlvbih0cnlMb2MpIHtcbiAgICAgIGZvciAodmFyIGkgPSB0aG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W1lKTtcbn1cbiJdfQ== diff --git a/dist/charts.min.js b/dist/charts.min.js index ee5d921..6c0889f 100644 --- a/dist/charts.min.js +++ b/dist/charts.min.js @@ -1 +1 @@ -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i1&&arguments[1]!==undefined?arguments[1]:false;if(!option||(0,_typeof2["default"])(option)!=="object"){console.error("setOption Missing parameters!");return false}if(animationEnd)this.render.graphs.forEach(function(graph){return graph.animationEnd()});var optionCloned=(0,_util.deepClone)(option,true);(0,_core.mergeColor)(this,optionCloned);(0,_core.grid)(this,optionCloned);(0,_core.axis)(this,optionCloned);(0,_core.radarAxis)(this,optionCloned);(0,_core.title)(this,optionCloned);(0,_core.bar)(this,optionCloned);(0,_core.line)(this,optionCloned);(0,_core.pie)(this,optionCloned);(0,_core.radar)(this,optionCloned);(0,_core.gauge)(this,optionCloned);(0,_core.legend)(this,optionCloned);this.option=option;this.render.launchAnimation()};Charts.prototype.resize=function(){var container=this.container,canvas=this.canvas,render=this.render,option=this.option;var clientWidth=container.clientWidth,clientHeight=container.clientHeight;canvas.setAttribute("width",clientWidth);canvas.setAttribute("height",clientHeight);render.area=[clientWidth,clientHeight];this.setOption(option)}},{"../core":20,"../extend/index":28,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/plugin/util":54}],3:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.doUpdate=doUpdate;exports.Updater=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var Updater=function Updater(config,series){(0,_classCallCheck2["default"])(this,Updater);var chart=config.chart,key=config.key,getGraphConfig=config.getGraphConfig;if(typeof getGraphConfig!=="function"){console.warn("Updater need function getGraphConfig!");return}if(!chart[key])this.graphs=chart[key]=[];Object.assign(this,config);this.update(series)};exports.Updater=Updater;Updater.prototype.update=function(series){var _this=this;var graphs=this.graphs,beforeUpdate=this.beforeUpdate;delRedundanceGraph(this,series);if(!series.length)return;var beforeUpdateType=(0,_typeof2["default"])(beforeUpdate);series.forEach(function(seriesItem,i){if(beforeUpdateType==="function")beforeUpdate(graphs,seriesItem,i,_this);var cache=graphs[i];if(cache){changeGraphs(cache,seriesItem,i,_this)}else{addGraphs(graphs,seriesItem,i,_this)}})};function delRedundanceGraph(updater,series){var graphs=updater.graphs,render=updater.chart.render;var cacheGraphNum=graphs.length;var needGraphNum=series.length;if(cacheGraphNum>needGraphNum){var needDelGraphs=graphs.splice(needGraphNum);needDelGraphs.forEach(function(item){return item.forEach(function(g){return render.delGraph(g)})})}}function changeGraphs(cache,seriesItem,i,updater){var getGraphConfig=updater.getGraphConfig,render=updater.chart.render,beforeChange=updater.beforeChange;var configs=getGraphConfig(seriesItem,updater);balanceGraphsNum(cache,configs,render);cache.forEach(function(graph,j){var config=configs[j];if(typeof beforeChange==="function")beforeChange(graph,config);updateGraphConfigByKey(graph,config)})}function balanceGraphsNum(graphs,graphConfig,render){var cacheGraphNum=graphs.length;var needGraphNum=graphConfig.length;if(needGraphNum>cacheGraphNum){var lastCacheGraph=graphs.slice(-1)[0];var needAddGraphNum=needGraphNum-cacheGraphNum;var needAddGraphs=new Array(needAddGraphNum).fill(0).map(function(foo){return render.clone(lastCacheGraph)});graphs.push.apply(graphs,(0,_toConsumableArray2["default"])(needAddGraphs))}else if(needGraphNum0&&arguments[0]!==undefined?arguments[0]:{},chart=_ref.chart,series=_ref.series,key=_ref.key,getGraphConfig=_ref.getGraphConfig,getStartGraphConfig=_ref.getStartGraphConfig,beforeChange=_ref.beforeChange,beforeUpdate=_ref.beforeUpdate,afterAddGraph=_ref.afterAddGraph;if(chart[key]){chart[key].update(series)}else{chart[key]=new Updater({chart:chart,key:key,getGraphConfig:getGraphConfig,getStartGraphConfig:getStartGraphConfig,beforeChange:beforeChange,beforeUpdate:beforeUpdate,afterAddGraph:afterAddGraph},series)}}},{"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.yAxisConfig=exports.xAxisConfig=void 0;var xAxisConfig={name:"",show:true,position:"bottom",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:false,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.xAxisConfig=xAxisConfig;var yAxisConfig={name:"",show:true,position:"left",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:true,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.yAxisConfig=yAxisConfig},{}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.barConfig=void 0;var barConfig={show:true,name:"",stack:"",shapeType:"normal",echelonOffset:10,barWidth:"auto",barGap:"30%",barCategoryGap:"20%",xAxisIndex:0,yAxisIndex:0,data:[],backgroundBar:{show:false,width:"auto",style:{fill:"rgba(200, 200, 200, .4)"}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},gradient:{color:[],local:true},barStyle:{},independentColor:false,independentColors:[],rLevel:0,animationCurve:"easeOutCubic",animationFrame:50};exports.barConfig=barConfig},{}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.colorConfig=void 0;var colorConfig=["#37a2da","#32c5e9","#67e0e3","#9fe6b8","#ffdb5c","#ff9f7f","#fb7293","#e062ae","#e690d1","#e7bcf3","#9d96f5","#8378ea","#96bfff"];exports.colorConfig=colorConfig},{}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gaugeConfig=void 0;var gaugeConfig={show:true,name:"",radius:"60%",center:["50%","50%"],startAngle:-(Math.PI/4)*5,endAngle:Math.PI/4,min:0,max:100,splitNum:5,arcLineWidth:15,data:[],dataItemStyle:{},axisTick:{show:true,tickLength:6,style:{stroke:"#999",lineWidth:1}},axisLabel:{show:true,data:[],formatter:null,labelGap:5,style:{}},pointer:{show:true,valueIndex:0,style:{scale:[1,1],fill:"#fb7293"}},details:{show:false,formatter:null,offset:[0,0],valueToFixed:0,position:"center",style:{fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle"}},backgroundArc:{show:true,style:{stroke:"#e0e0e0"}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.gaugeConfig=gaugeConfig},{}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gridConfig=void 0;var gridConfig={left:"10%",right:"10%",top:60,bottom:60,style:{fill:"rgba(0, 0, 0, 0)"},rLevel:-30,animationCurve:"easeOutCubic",animationFrame:30};exports.gridConfig=gridConfig},{}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.changeDefaultConfig=changeDefaultConfig;Object.defineProperty(exports,"colorConfig",{enumerable:true,get:function get(){return _color.colorConfig}});Object.defineProperty(exports,"gridConfig",{enumerable:true,get:function get(){return _grid.gridConfig}});Object.defineProperty(exports,"xAxisConfig",{enumerable:true,get:function get(){return _axis.xAxisConfig}});Object.defineProperty(exports,"yAxisConfig",{enumerable:true,get:function get(){return _axis.yAxisConfig}});Object.defineProperty(exports,"titleConfig",{enumerable:true,get:function get(){return _title.titleConfig}});Object.defineProperty(exports,"lineConfig",{enumerable:true,get:function get(){return _line.lineConfig}});Object.defineProperty(exports,"barConfig",{enumerable:true,get:function get(){return _bar.barConfig}});Object.defineProperty(exports,"pieConfig",{enumerable:true,get:function get(){return _pie.pieConfig}});Object.defineProperty(exports,"radarAxisConfig",{enumerable:true,get:function get(){return _radarAxis.radarAxisConfig}});Object.defineProperty(exports,"radarConfig",{enumerable:true,get:function get(){return _radar.radarConfig}});Object.defineProperty(exports,"gaugeConfig",{enumerable:true,get:function get(){return _gauge.gaugeConfig}});Object.defineProperty(exports,"legendConfig",{enumerable:true,get:function get(){return _legend.legendConfig}});exports.keys=void 0;var _color=require("./color");var _grid=require("./grid");var _axis=require("./axis");var _title=require("./title");var _line=require("./line");var _bar=require("./bar");var _pie=require("./pie");var _radarAxis=require("./radarAxis");var _radar=require("./radar");var _gauge=require("./gauge");var _legend=require("./legend");var _util=require("../util");var allConfig={colorConfig:_color.colorConfig,gridConfig:_grid.gridConfig,xAxisConfig:_axis.xAxisConfig,yAxisConfig:_axis.yAxisConfig,titleConfig:_title.titleConfig,lineConfig:_line.lineConfig,barConfig:_bar.barConfig,pieConfig:_pie.pieConfig,radarAxisConfig:_radarAxis.radarAxisConfig,radarConfig:_radar.radarConfig,gaugeConfig:_gauge.gaugeConfig,legendConfig:_legend.legendConfig};function changeDefaultConfig(key,config){if(!allConfig["".concat(key,"Config")]){console.warn("Change default config Error - Invalid key!");return}(0,_util.deepMerge)(allConfig["".concat(key,"Config")],config)}var keys=["color","title","legend","xAxis","yAxis","grid","radarAxis","line","bar","pie","radar","gauge"];exports.keys=keys},{"../util":30,"./axis":4,"./bar":5,"./color":6,"./gauge":7,"./grid":8,"./legend":10,"./line":11,"./pie":12,"./radar":13,"./radarAxis":14,"./title":15}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.legendConfig=void 0;var legendConfig={show:true,orient:"horizontal",left:"auto",right:"auto",top:"auto",bottom:"auto",itemGap:10,iconWidth:25,iconHeight:10,selectAble:true,data:[],textStyle:{fontFamily:"Arial",fontSize:13,fill:"#000"},iconStyle:{},textUnselectedStyle:{fontFamily:"Arial",fontSize:13,fill:"#999"},iconUnselectedStyle:{fill:"#999"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.legendConfig=legendConfig},{}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.lineConfig=void 0;var lineConfig={show:true,name:"",stack:"",smooth:false,xAxisIndex:0,yAxisIndex:0,data:[],lineStyle:{lineWidth:1},linePoint:{show:true,radius:2,style:{fill:"#fff",lineWidth:1}},lineArea:{show:false,gradient:[],style:{opacity:.5}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.lineConfig=lineConfig},{}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.pieConfig=void 0;var pieConfig={show:true,name:"",radius:"50%",center:["50%","50%"],startAngle:-Math.PI/2,roseType:false,roseSort:true,roseIncrement:"auto",data:[],insideLabel:{show:false,formatter:"{percent}%",style:{fontSize:10,fill:"#fff",textAlign:"center",textBaseline:"middle"}},outsideLabel:{show:true,formatter:"{name}",style:{fontSize:11},labelLineBendGap:"20%",labelLineEndLength:50,labelLineStyle:{lineWidth:1}},pieStyle:{},percentToFixed:0,rLevel:10,animationDelayGap:60,animationCurve:"easeOutCubic",startAnimationCurve:"easeOutBack",animationFrame:50};exports.pieConfig=pieConfig},{}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarConfig=void 0;var radarConfig={show:true,name:"",data:[],radarStyle:{lineWidth:1},point:{show:true,radius:2,style:{fill:"#fff"}},label:{show:true,offset:[0,0],labelGap:5,formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarConfig=radarConfig},{}],14:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarAxisConfig=void 0;var radarAxisConfig={show:true,center:["50%","50%"],radius:"65%",startAngle:-Math.PI/2,splitNum:5,polygon:false,axisLabel:{show:true,labelGap:15,color:[],style:{fill:"#333"}},axisLine:{show:true,color:[],style:{stroke:"#999",lineWidth:1}},splitLine:{show:true,color:[],style:{stroke:"#d4d4d4",lineWidth:1}},splitArea:{show:false,color:["#f5f5f5","#e6e6e6"],style:{}},rLevel:-10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarAxisConfig=radarAxisConfig},{}],15:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.titleConfig=void 0;var titleConfig={show:true,text:"",offset:[0,-20],style:{fill:"#333",fontSize:17,fontWeight:"bold",textAlign:"center",textBaseline:"bottom"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.titleConfig=titleConfig},{}],16:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.axis=axis;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _config=require("../config");var _util=require("../util");var _util2=require("@jiaminghi/c-render/lib/plugin/util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var allAxis=[];if(xAxis&&yAxis&&series){allAxis=getAllAxis(xAxis,yAxis);allAxis=mergeDefaultAxisConfig(allAxis);allAxis=allAxis.filter(function(_ref){var show=_ref.show;return show});allAxis=mergeDefaultBoundaryGap(allAxis);allAxis=calcAxisLabelData(allAxis,series);allAxis=setAxisPosition(allAxis);allAxis=calcAxisLinePosition(allAxis,chart);allAxis=calcAxisTickPosition(allAxis,chart);allAxis=calcAxisNamePosition(allAxis,chart);allAxis=calcSplitLinePosition(allAxis,chart)}(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLine",getGraphConfig:getLineConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisTick",getGraphConfig:getTickConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLabel",getGraphConfig:getLabelConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisName",getGraphConfig:getNameConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"splitLine",getGraphConfig:getSplitLineConfig});chart.axisData=allAxis}function getAllAxis(xAxis,yAxis){var allXAxis=[],allYAxis=[];if(xAxis instanceof Array){var _allXAxis;(_allXAxis=allXAxis).push.apply(_allXAxis,(0,_toConsumableArray2["default"])(xAxis))}else{allXAxis.push(xAxis)}if(yAxis instanceof Array){var _allYAxis;(_allYAxis=allYAxis).push.apply(_allYAxis,(0,_toConsumableArray2["default"])(yAxis))}else{allYAxis.push(yAxis)}allXAxis.splice(2);allYAxis.splice(2);allXAxis=allXAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"x"})});allYAxis=allYAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"y"})});return[].concat((0,_toConsumableArray2["default"])(allXAxis),(0,_toConsumableArray2["default"])(allYAxis))}function mergeDefaultAxisConfig(allAxis){var xAxis=allAxis.filter(function(_ref2){var axis=_ref2.axis;return axis==="x"});var yAxis=allAxis.filter(function(_ref3){var axis=_ref3.axis;return axis==="y"});xAxis=xAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.xAxisConfig),axis)});yAxis=yAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.yAxisConfig),axis)});return[].concat((0,_toConsumableArray2["default"])(xAxis),(0,_toConsumableArray2["default"])(yAxis))}function mergeDefaultBoundaryGap(allAxis){var valueAxis=allAxis.filter(function(_ref4){var data=_ref4.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref5){var data=_ref5.data;return data!=="value"});valueAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=false});labelAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=true});return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcAxisLabelData(allAxis,series){var valueAxis=allAxis.filter(function(_ref6){var data=_ref6.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref7){var data=_ref7.data;return data instanceof Array});valueAxis=calcValueAxisLabelData(valueAxis,series);labelAxis=calcLabelAxisLabelData(labelAxis);return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcValueAxisLabelData(valueAxis,series){return valueAxis.map(function(axis){var minMaxValue=getValueAxisMaxMinValue(axis,series);var _getTrueMinMax=getTrueMinMax(axis,minMaxValue),_getTrueMinMax2=(0,_slicedToArray2["default"])(_getTrueMinMax,2),min=_getTrueMinMax2[0],max=_getTrueMinMax2[1];var interval=getValueInterval(min,max,axis);var formatter=axis.axisLabel.formatter;var label=[];if(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]:0;var stringNumber=number.toString();var splitedNumber=stringNumber.split(".");var decimal=splitedNumber[1]||"0";var fixedDecimal=decimal.slice(0,toFixed);splitedNumber[1]=fixedDecimal;return parseFloat(splitedNumber.join("."))}function getDataSum(data){return(0,_util2.mulAdd)(data.map(function(_ref6){var value=_ref6.value;return value}))}function calcPiesAngle(pies){pies.forEach(function(pie){var start=pie.startAngle,data=pie.data;data.forEach(function(item,i){var _getDataAngle=getDataAngle(data,i),_getDataAngle2=(0,_slicedToArray2["default"])(_getDataAngle,2),startAngle=_getDataAngle2[0],endAngle=_getDataAngle2[1];item.startAngle=start+startAngle;item.endAngle=start+endAngle})});return pies}function getDataAngle(data,i){var fullAngle=Math.PI*2;var needAddData=data.slice(0,i+1);var percentSum=(0,_util2.mulAdd)(needAddData.map(function(_ref7){var percent=_ref7.percent;return percent}));var percent=data[i].percent;var startPercent=percentSum-percent;return[fullAngle*startPercent/100,fullAngle*percentSum/100]}function calcPiesInsideLabelPos(pies){pies.forEach(function(pieItem){var data=pieItem.data;data.forEach(function(item){item.insideLabelPos=getPieInsideLabelPos(pieItem,item)})});return pies}function getPieInsideLabelPos(pieItem,dataItem){var center=pieItem.center;var startAngle=dataItem.startAngle,endAngle=dataItem.endAngle,_dataItem$radius=(0,_slicedToArray2["default"])(dataItem.radius,2),ir=_dataItem$radius[0],or=_dataItem$radius[1];var radius=(ir+or)/2;var angle=(startAngle+endAngle)/2;return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,angle]))}function calcPiesEdgeCenterPos(pies){pies.forEach(function(pie){var data=pie.data,center=pie.center;data.forEach(function(item){var startAngle=item.startAngle,endAngle=item.endAngle,radius=item.radius;var centerAngle=(startAngle+endAngle)/2;var pos=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius[1],centerAngle]));item.edgeCenterPos=pos})});return pies}function calcPiesOutSideLabelPos(pies){pies.forEach(function(pieItem){var leftPieDataItems=getLeftOrRightPieDataItems(pieItem);var rightPieDataItems=getLeftOrRightPieDataItems(pieItem,false);leftPieDataItems=sortPiesFromTopToBottom(leftPieDataItems);rightPieDataItems=sortPiesFromTopToBottom(rightPieDataItems);addLabelLineAndAlign(leftPieDataItems,pieItem);addLabelLineAndAlign(rightPieDataItems,pieItem,false)});return pies}function getLabelLineBendRadius(pieItem){var labelLineBendGap=pieItem.outsideLabel.labelLineBendGap;var maxRadius=getPieMaxRadius(pieItem);if(typeof labelLineBendGap!=="number"){labelLineBendGap=parseInt(labelLineBendGap)/100*maxRadius}return labelLineBendGap+maxRadius}function getPieMaxRadius(pieItem){var data=pieItem.data;var radius=data.map(function(_ref8){var _ref8$radius=(0,_slicedToArray2["default"])(_ref8.radius,2),foo=_ref8$radius[0],r=_ref8$radius[1];return r});return Math.max.apply(Math,(0,_toConsumableArray2["default"])(radius))}function getLeftOrRightPieDataItems(pieItem){var left=arguments.length>1&&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.percentForLabel);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,percentForLabel=_data$i.percentForLabel,value=_data$i.value;var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",name);label=label.replace("{percent}",percentForLabel);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 _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _cRender=require("@jiaminghi/c-render");var _graphs=require("@jiaminghi/c-render/lib/config/graphs");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _index=require("../util/index");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?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,rowGap:0,formatter:null},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;var number=shape.number,content=shape.content,toFixed=shape.toFixed,rowGap=shape.rowGap,formatter=shape.formatter;var textSegments=content.split("{nt}");var textString="";textSegments.forEach(function(t,i){var currentNumber=number[i]||"";if(typeof currentNumber==="number"){currentNumber=currentNumber.toFixed(toFixed);if(typeof formatter==="function")currentNumber=formatter(currentNumber)}textString+=t+(currentNumber||"")});_graphs.text.draw({ctx:ctx},{shape:_objectSpread({},shape,{content:textString,rowGap:rowGap})})}};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/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/config/graphs":51,"@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){if(target[key]&&(0,_typeof2["default"])(target[key])==="object"){deepMerge(target[key],merged[key]);continue}if((0,_typeof2["default"])(merged[key])==="object"){target[key]=(0,_util.deepClone)(merged[key],true);continue}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(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]:0;var stringNumber=number.toString();var splitedNumber=stringNumber.split(".");var decimal=splitedNumber[1]||"0";var fixedDecimal=decimal.slice(0,toFixed);splitedNumber[1]=fixedDecimal;return parseFloat(splitedNumber.join("."))}function getDataSum(data){return(0,_util2.mulAdd)(data.map(function(_ref6){var value=_ref6.value;return value}))}function calcPiesAngle(pies){pies.forEach(function(pie){var start=pie.startAngle,data=pie.data;data.forEach(function(item,i){var _getDataAngle=getDataAngle(data,i),_getDataAngle2=(0,_slicedToArray2["default"])(_getDataAngle,2),startAngle=_getDataAngle2[0],endAngle=_getDataAngle2[1];item.startAngle=start+startAngle;item.endAngle=start+endAngle})});return pies}function getDataAngle(data,i){var fullAngle=Math.PI*2;var needAddData=data.slice(0,i+1);var percentSum=(0,_util2.mulAdd)(needAddData.map(function(_ref7){var percent=_ref7.percent;return percent}));var percent=data[i].percent;var startPercent=percentSum-percent;return[fullAngle*startPercent/100,fullAngle*percentSum/100]}function calcPiesInsideLabelPos(pies){pies.forEach(function(pieItem){var data=pieItem.data;data.forEach(function(item){item.insideLabelPos=getPieInsideLabelPos(pieItem,item)})});return pies}function getPieInsideLabelPos(pieItem,dataItem){var center=pieItem.center;var startAngle=dataItem.startAngle,endAngle=dataItem.endAngle,_dataItem$radius=(0,_slicedToArray2["default"])(dataItem.radius,2),ir=_dataItem$radius[0],or=_dataItem$radius[1];var radius=(ir+or)/2;var angle=(startAngle+endAngle)/2;return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,angle]))}function calcPiesEdgeCenterPos(pies){pies.forEach(function(pie){var data=pie.data,center=pie.center;data.forEach(function(item){var startAngle=item.startAngle,endAngle=item.endAngle,radius=item.radius;var centerAngle=(startAngle+endAngle)/2;var pos=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius[1],centerAngle]));item.edgeCenterPos=pos})});return pies}function calcPiesOutSideLabelPos(pies){pies.forEach(function(pieItem){var leftPieDataItems=getLeftOrRightPieDataItems(pieItem);var rightPieDataItems=getLeftOrRightPieDataItems(pieItem,false);leftPieDataItems=sortPiesFromTopToBottom(leftPieDataItems);rightPieDataItems=sortPiesFromTopToBottom(rightPieDataItems);addLabelLineAndAlign(leftPieDataItems,pieItem);addLabelLineAndAlign(rightPieDataItems,pieItem,false)});return pies}function getLabelLineBendRadius(pieItem){var labelLineBendGap=pieItem.outsideLabel.labelLineBendGap;var maxRadius=getPieMaxRadius(pieItem);if(typeof labelLineBendGap!=="number"){labelLineBendGap=parseInt(labelLineBendGap)/100*maxRadius}return labelLineBendGap+maxRadius}function getPieMaxRadius(pieItem){var data=pieItem.data;var radius=data.map(function(_ref8){var _ref8$radius=(0,_slicedToArray2["default"])(_ref8.radius,2),foo=_ref8$radius[0],r=_ref8$radius[1];return r});return Math.max.apply(Math,(0,_toConsumableArray2["default"])(radius))}function getLeftOrRightPieDataItems(pieItem){var left=arguments.length>1&&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.percentForLabel);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,percentForLabel=_data$i.percentForLabel,value=_data$i.value;var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",name);label=label.replace("{percent}",percentForLabel);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 _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _cRender=require("@jiaminghi/c-render");var _graphs=require("@jiaminghi/c-render/lib/config/graphs");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _index=require("../util/index");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?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,rowGap:0,formatter:null},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;var number=shape.number,content=shape.content,toFixed=shape.toFixed,rowGap=shape.rowGap,formatter=shape.formatter;var textSegments=content.split("{nt}");var textString="";textSegments.forEach(function(t,i){var currentNumber=number[i];if(typeof currentNumber!=="number")currentNumber="";if(typeof currentNumber==="number"){currentNumber=currentNumber.toFixed(toFixed);if(typeof formatter==="function")currentNumber=formatter(currentNumber)}textString+=t+(currentNumber||"")});_graphs.text.draw({ctx:ctx},{shape:_objectSpread({},shape,{content:textString,rowGap:rowGap})})}};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/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/config/graphs":51,"@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){if(target[key]&&(0,_typeof2["default"])(target[key])==="object"){deepMerge(target[key],merged[key]);continue}if((0,_typeof2["default"])(merged[key])==="object"){target[key]=(0,_util.deepClone)(merged[key],true);continue}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/extend/index.js b/lib/extend/index.js index 3834250..1565519 100644 --- a/lib/extend/index.js +++ b/lib/extend/index.js @@ -174,7 +174,8 @@ var numberText = { var textSegments = content.split('{nt}'); var textString = ''; textSegments.forEach(function (t, i) { - var currentNumber = number[i] || ''; + var currentNumber = number[i]; + if (typeof currentNumber !== 'number') currentNumber = ''; if (typeof currentNumber === 'number') { currentNumber = currentNumber.toFixed(toFixed);