diff --git a/dist/charts.map.js b/dist/charts.map.js new file mode 100644 index 0000000..3e407fd --- /dev/null +++ b/dist/charts.map.js @@ -0,0 +1,12517 @@ +(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;i 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 (needGraphNum < cacheGraphNum) { + var needDelCache = graphs.splice(needGraphNum); + needDelCache.forEach(function (g) { + return render.delGraph(g); + }); + } +} + +function addGraphs(graphs, seriesItem, i, updater) { + var getGraphConfig = updater.getGraphConfig, + getStartGraphConfig = updater.getStartGraphConfig, + chart = updater.chart; + var render = chart.render; + var startConfigs = null; + if (typeof getStartGraphConfig === 'function') startConfigs = getStartGraphConfig(seriesItem, updater); + var configs = getGraphConfig(seriesItem, updater); + if (!configs.length) return; + + if (startConfigs) { + graphs[i] = startConfigs.map(function (config) { + return render.add(config); + }); + graphs[i].forEach(function (graph, i) { + var config = configs[i]; + updateGraphConfigByKey(graph, config); + }); + } else { + graphs[i] = configs.map(function (config) { + return render.add(config); + }); + } + + var afterAddGraph = updater.afterAddGraph; + if (typeof afterAddGraph === 'function') afterAddGraph(graphs[i]); +} + +function updateGraphConfigByKey(graph, config) { + var keys = Object.keys(config); + keys.forEach(function (key) { + if (key === 'shape' || key === 'style') { + graph.animation(key, config[key], true); + } else { + graph[key] = config[key]; + } + }); +} + +function doUpdate() { + var _ref = arguments.length > 0 && 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 = { + /** + * @description Axis name + * @type {String} + * @default name = '' + */ + name: '', + + /** + * @description Whether to display this axis + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis position + * @type {String} + * @default position = 'bottom' + * @example position = 'bottom' | 'top' + */ + position: 'bottom', + + /** + * @description Name gap + * @type {Number} + * @default nameGap = 15 + */ + nameGap: 15, + + /** + * @description Name location + * @type {String} + * @default nameLocation = 'end' + * @example nameLocation = 'end' | 'center' | 'start' + */ + nameLocation: 'end', + + /** + * @description Name default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + nameTextStyle: { + fill: '#333', + fontSize: 10 + }, + + /** + * @description Axis min value + * @type {String|Number} + * @default min = '20%' + * @example min = '20%' | 0 + */ + min: '20%', + + /** + * @description Axis max value + * @type {String|Number} + * @default max = '20%' + * @example max = '20%' | 0 + */ + max: '20%', + + /** + * @description Axis value interval + * @type {Number} + * @default interval = null + * @example interval = 100 + */ + interval: null, + + /** + * @description Min interval + * @type {Number} + * @default minInterval = null + * @example minInterval = 1 + */ + minInterval: null, + + /** + * @description Max interval + * @type {Number} + * @default maxInterval = null + * @example maxInterval = 100 + */ + maxInterval: null, + + /** + * @description Boundary gap + * @type {Boolean} + * @default boundaryGap = null + * @example boundaryGap = true + */ + boundaryGap: null, + + /** + * @description Axis split number + * @type {Number} + * @default splitNumber = 5 + */ + splitNumber: 5, + + /** + * @description Axis line configuration + * @type {Object} + */ + axisLine: { + /** + * @description Whether to display axis line + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis line default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#333', + lineWidth: 1 + } + }, + + /** + * @description Axis tick configuration + * @type {Object} + */ + axisTick: { + /** + * @description Whether to display axis tick + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis tick default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#333', + lineWidth: 1 + } + }, + + /** + * @description Axis label configuration + * @type {Object} + */ + axisLabel: { + /** + * @description Whether to display axis label + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis label formatter + * @type {String|Function} + * @default formatter = null + * @example formatter = '{value}件' + * @example formatter = (dataItem) => (dataItem.value) + */ + formatter: null, + + /** + * @description Axis label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: '#333', + fontSize: 10, + rotate: 0 + } + }, + + /** + * @description Axis split line configuration + * @type {Object} + */ + splitLine: { + /** + * @description Whether to display axis split line + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Axis split line default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#d4d4d4', + lineWidth: 1 + } + }, + + /** + * @description X axis render level + * Priority rendering high level + * @type {Number} + * @default rLevel = -20 + */ + rLevel: -20, + + /** + * @description X axis animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description X axis animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrame: 50 +}; +exports.xAxisConfig = xAxisConfig; +var yAxisConfig = { + /** + * @description Axis name + * @type {String} + * @default name = '' + */ + name: '', + + /** + * @description Whether to display this axis + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis position + * @type {String} + * @default position = 'left' + * @example position = 'left' | 'right' + */ + position: 'left', + + /** + * @description Name gap + * @type {Number} + * @default nameGap = 15 + */ + nameGap: 15, + + /** + * @description Name location + * @type {String} + * @default nameLocation = 'end' + * @example nameLocation = 'end' | 'center' | 'start' + */ + nameLocation: 'end', + + /** + * @description name default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + nameTextStyle: { + fill: '#333', + fontSize: 10 + }, + + /** + * @description Axis min value + * @type {String|Number} + * @default min = '20%' + * @example min = '20%' | 0 + */ + min: '20%', + + /** + * @description Axis max value + * @type {String|Number} + * @default max = '20%' + * @example max = '20%' | 0 + */ + max: '20%', + + /** + * @description Axis value interval + * @type {Number} + * @default interval = null + * @example interval = 100 + */ + interval: null, + + /** + * @description Min interval + * @type {Number} + * @default minInterval = null + * @example minInterval = 1 + */ + minInterval: null, + + /** + * @description Max interval + * @type {Number} + * @default maxInterval = null + * @example maxInterval = 100 + */ + maxInterval: null, + + /** + * @description Boundary gap + * @type {Boolean} + * @default boundaryGap = null + * @example boundaryGap = true + */ + boundaryGap: null, + + /** + * @description Axis split number + * @type {Number} + * @default splitNumber = 5 + */ + splitNumber: 5, + + /** + * @description Axis line configuration + * @type {Object} + */ + axisLine: { + /** + * @description Whether to display axis line + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis line default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#333', + lineWidth: 1 + } + }, + + /** + * @description Axis tick configuration + * @type {Object} + */ + axisTick: { + /** + * @description Whether to display axis tick + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis tick default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#333', + lineWidth: 1 + } + }, + + /** + * @description Axis label configuration + * @type {Object} + */ + axisLabel: { + /** + * @description Whether to display axis label + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis label formatter + * @type {String|Function} + * @default formatter = null + * @example formatter = '{value}件' + * @example formatter = (dataItem) => (dataItem.value) + */ + formatter: null, + + /** + * @description Axis label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: '#333', + fontSize: 10, + rotate: 0 + } + }, + + /** + * @description Axis split line configuration + * @type {Object} + */ + splitLine: { + /** + * @description Whether to display axis split line + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis split line default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#d4d4d4', + lineWidth: 1 + } + }, + + /** + * @description Y axis render level + * Priority rendering high level + * @type {Number} + * @default rLevel = -20 + */ + rLevel: -20, + + /** + * @description Y axis animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Y axis animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrame: 50 +}; +exports.yAxisConfig = yAxisConfig; +},{}],5:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.barConfig = void 0; +var barConfig = { + /** + * @description Whether to display this bar chart + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Legend name + * @type {String} + * @default name = '' + */ + name: '', + + /** + * @description Data stacking + * The data value of the series element of the same stack + * will be superimposed (the latter value will be superimposed on the previous value) + * @type {String} + * @default stack = '' + */ + stack: '', + + /** + * @description Bar shape type + * @type {String} + * @default shapeType = 'normal' + * @example shapeType = 'normal' | 'leftEchelon' | 'rightEchelon' + */ + shapeType: 'normal', + + /** + * @description Echelon bar sharpness offset + * @type {Number} + * @default echelonOffset = 10 + */ + echelonOffset: 10, + + /** + * @description Bar width + * This property should be set on the last 'bar' series + * in this coordinate system to take effect and will be in effect + * for all 'bar' series in this coordinate system + * @type {String|Number} + * @default barWidth = 'auto' + * @example barWidth = 'auto' | '10%' | 20 + */ + barWidth: 'auto', + + /** + * @description Bar gap + * This property should be set on the last 'bar' series + * in this coordinate system to take effect and will be in effect + * for all 'bar' series in this coordinate system + * @type {String|Number} + * @default barGap = '30%' + * @example barGap = '30%' | 30 + */ + barGap: '30%', + + /** + * @description Bar category gap + * This property should be set on the last 'bar' series + * in this coordinate system to take effect and will be in effect + * for all 'bar' series in this coordinate system + * @type {String|Number} + * @default barCategoryGap = '20%' + * @example barCategoryGap = '20%' | 20 + */ + barCategoryGap: '20%', + + /** + * @description Bar x axis index + * @type {Number} + * @default xAxisIndex = 0 + * @example xAxisIndex = 0 | 1 + */ + xAxisIndex: 0, + + /** + * @description Bar y axis index + * @type {Number} + * @default yAxisIndex = 0 + * @example yAxisIndex = 0 | 1 + */ + yAxisIndex: 0, + + /** + * @description Bar chart data + * @type {Array} + * @default data = [] + * @example data = [100, 200, 300] + */ + data: [], + + /** + * @description Background bar configuration + * @type {Object} + */ + backgroundBar: { + /** + * @description Whether to display background bar + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Background bar width + * @type {String|Number} + * @default width = 'auto' + * @example width = 'auto' | '30%' | 30 + */ + width: 'auto', + + /** + * @description Background bar default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: 'rgba(200, 200, 200, .4)' + } + }, + + /** + * @description Bar label configuration + * @type {Object} + */ + label: { + /** + * @description Whether to display bar label + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Bar label position + * @type {String} + * @default position = 'top' + * @example position = 'top' | 'center' | 'bottom' + */ + position: 'top', + + /** + * @description Bar label offset + * @type {Array} + * @default offset = [0, -10] + */ + offset: [0, -10], + + /** + * @description Bar label formatter + * @type {String|Function} + * @default formatter = null + * @example formatter = '{value}件' + * @example formatter = (dataItem) => (dataItem.value) + */ + formatter: null, + + /** + * @description Bar label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fontSize: 10 + } + }, + + /** + * @description Bar gradient configuration + * @type {Object} + */ + gradient: { + /** + * @description Gradient color (Hex|rgb|rgba) + * @type {Array} + * @default color = [] + */ + color: [], + + /** + * @description Local gradient + * @type {Boolean} + * @default local = true + */ + local: true + }, + + /** + * @description Bar style default configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + barStyle: {}, + + /** + * @description Bar chart render level + * Priority rendering high level + * @type {Number} + * @default rLevel = 0 + */ + rLevel: 0, + + /** + * @description Bar animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Bar animation frame + * @type {Number} + * @default animationFrame = 50 + */ + 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 = { + /** + * @description Whether to display this gauge + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Legend name + * @type {String} + * @default name = '' + */ + name: '', + + /** + * @description Radius of gauge + * @type {String|Number} + * @default radius = '60%' + * @example radius = '60%' | 100 + */ + radius: '60%', + + /** + * @description Center point of gauge + * @type {Array} + * @default center = ['50%','50%'] + * @example center = ['50%','50%'] | [100, 100] + */ + center: ['50%', '50%'], + + /** + * @description Gauge start angle + * @type {Number} + * @default startAngle = -(Math.PI / 4) * 5 + * @example startAngle = -Math.PI + */ + startAngle: -(Math.PI / 4) * 5, + + /** + * @description Gauge end angle + * @type {Number} + * @default endAngle = Math.PI / 4 + * @example endAngle = 0 + */ + endAngle: Math.PI / 4, + + /** + * @description Gauge min value + * @type {Number} + * @default min = 0 + */ + min: 0, + + /** + * @description Gauge max value + * @type {Number} + * @default max = 100 + */ + max: 100, + + /** + * @description Gauge split number + * @type {Number} + * @default splitNum = 5 + */ + splitNum: 5, + + /** + * @description Gauge arc line width + * @type {Number} + * @default arcLineWidth = 15 + */ + arcLineWidth: 15, + + /** + * @description Gauge chart data + * @type {Array} + * @default data = [] + */ + data: [], + + /** + * @description Data item arc default style configuration + * @type {Object} + * @default dataItemStyle = {Configuration Of Class Style} + */ + dataItemStyle: {}, + + /** + * @description Axis tick configuration + * @type {Object} + */ + axisTick: { + /** + * @description Whether to display axis tick + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis tick length + * @type {Number} + * @default tickLength = 6 + */ + tickLength: 6, + + /** + * @description Axis tick default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#999', + lineWidth: 1 + } + }, + + /** + * @description Axis label configuration + * @type {Object} + */ + axisLabel: { + /** + * @description Whether to display axis label + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Axis label data (Can be calculated automatically) + * @type {Array} + * @default data = [Number...] + */ + data: [], + + /** + * @description Axis label formatter + * @type {String|Function} + * @default formatter = null + * @example formatter = '{value}%' + * @example formatter = (labelItem) => (labelItem.value) + */ + formatter: null, + + /** + * @description Axis label gap between label and axis tick + * @type {String|Function} + * @default labelGap = 5 + */ + labelGap: 5, + + /** + * @description Axis label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: {} + }, + + /** + * @description Gauge pointer configuration + * @type {Object} + */ + pointer: { + /** + * @description Whether to display pointer + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Pointer value index of data + * @type {Number} + * @default valueIndex = 0 (pointer.value = data[0].value) + */ + valueIndex: 0, + + /** + * @description Pointer default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + scale: [1, 1], + fill: '#fb7293' + } + }, + + /** + * @description Data item arc detail configuration + * @type {Object} + */ + details: { + /** + * @description Whether to display details + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Details formatter + * @type {String|Function} + * @default formatter = null + * @example formatter = '{value}%' + * @example formatter = '{name}%' + * @example formatter = (dataItem) => (dataItem.value) + */ + formatter: null, + + /** + * @description Details position offset + * @type {Array} + * @default offset = [0, 0] + * @example offset = [10, 10] + */ + offset: [0, 0], + + /** + * @description Value fractional precision + * @type {Number} + * @default valueToFixed = 0 + */ + valueToFixed: 0, + + /** + * @description Details position + * @type {String} + * @default position = 'center' + * @example position = 'start' | 'center' | 'end' + */ + position: 'center', + + /** + * @description Details default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fontSize: 20, + fontWeight: 'bold', + textAlign: 'center', + textBaseline: 'middle' + } + }, + + /** + * @description Gauge background arc configuration + * @type {Object} + */ + backgroundArc: { + /** + * @description Whether to display background arc + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Background arc default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#e0e0e0' + } + }, + + /** + * @description Gauge chart render level + * Priority rendering high level + * @type {Number} + * @default rLevel = 10 + */ + rLevel: 10, + + /** + * @description Gauge animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Gauge animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrame: 50 +}; +exports.gaugeConfig = gaugeConfig; +},{}],8:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.gridConfig = void 0; +var gridConfig = { + /** + * @description Grid left margin + * @type {String|Number} + * @default left = '10%' + * @example left = '10%' | 10 + */ + left: '10%', + + /** + * @description Grid right margin + * @type {String|Number} + * @default right = '10%' + * @example right = '10%' | 10 + */ + right: '10%', + + /** + * @description Grid top margin + * @type {String|Number} + * @default top = 60 + * @example top = '10%' | 60 + */ + top: 60, + + /** + * @description Grid bottom margin + * @type {String|Number} + * @default bottom = 60 + * @example bottom = '10%' | 60 + */ + bottom: 60, + + /** + * @description Grid default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: 'rgba(0, 0, 0, 0)' + }, + + /** + * @description Grid render level + * Priority rendering high level + * @type {Number} + * @default rLevel = -30 + */ + rLevel: -30, + + /** + * @description Grid animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Grid animation frame + * @type {Number} + * @default animationFrame = 50 + */ + 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 + /** + * @description Change default configuration + * @param {String} key Configuration key + * @param {Object|Array} config Your config + * @return {Undefined} No return + */ + +}; + +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 = { + /** + * @description Whether to display legend + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Legend orient + * @type {String} + * @default orient = 'horizontal' + * @example orient = 'horizontal' | 'vertical' + */ + orient: 'horizontal', + + /** + * @description Legend left + * @type {String|Number} + * @default left = 'auto' + * @example left = 'auto' | '10%' | 10 + */ + left: 'auto', + + /** + * @description Legend right + * @type {String|Number} + * @default right = 'auto' + * @example right = 'auto' | '10%' | 10 + */ + right: 'auto', + + /** + * @description Legend top + * @type {String|Number} + * @default top = 'auto' + * @example top = 'auto' | '10%' | 10 + */ + top: 'auto', + + /** + * @description Legend bottom + * @type {String|Number} + * @default bottom = 'auto' + * @example bottom = 'auto' | '10%' | 10 + */ + bottom: 'auto', + + /** + * @description Legend item gap + * @type {Number} + * @default itemGap = 10 + */ + itemGap: 10, + + /** + * @description Icon width + * @type {Number} + * @default iconWidth = 25 + */ + iconWidth: 25, + + /** + * @description Icon height + * @type {Number} + * @default iconHeight = 10 + */ + iconHeight: 10, + + /** + * @description Whether legend is optional + * @type {Boolean} + * @default selectAble = true + */ + selectAble: true, + + /** + * @description Legend data + * @type {Array} + * @default data = [] + */ + data: [], + + /** + * @description Legend text default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + textStyle: { + fontFamily: 'Arial', + fontSize: 13, + fill: '#000' + }, + + /** + * @description Legend icon default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + iconStyle: {}, + + /** + * @description Legend text unselected default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + textUnselectedStyle: { + fontFamily: 'Arial', + fontSize: 13, + fill: '#999' + }, + + /** + * @description Legend icon unselected default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + iconUnselectedStyle: { + fill: '#999' + }, + + /** + * @description Legend render level + * Priority rendering high level + * @type {Number} + * @default rLevel = 20 + */ + rLevel: 20, + + /** + * @description Legend animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Legend animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrame: 50 +}; +exports.legendConfig = legendConfig; +},{}],11:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.lineConfig = void 0; +var lineConfig = { + /** + * @description Whether to display this line chart + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Legend name + * @type {String} + * @default name = '' + */ + name: '', + + /** + * @description Data stacking + * The data value of the series element of the same stack + * will be superimposed (the latter value will be superimposed on the previous value) + * @type {String} + * @default stack = '' + */ + stack: '', + + /** + * @description Smooth line + * @type {Boolean} + * @default smooth = false + */ + smooth: false, + + /** + * @description Line x axis index + * @type {Number} + * @default xAxisIndex = 0 + * @example xAxisIndex = 0 | 1 + */ + xAxisIndex: 0, + + /** + * @description Line y axis index + * @type {Number} + * @default yAxisIndex = 0 + * @example yAxisIndex = 0 | 1 + */ + yAxisIndex: 0, + + /** + * @description Line chart data + * @type {Array} + * @default data = [] + * @example data = [100, 200, 300] + */ + data: [], + + /** + * @description Line default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + lineStyle: { + lineWidth: 1 + }, + + /** + * @description Line point configuration + * @type {Object} + */ + linePoint: { + /** + * @description Whether to display line point + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Line point radius + * @type {Number} + * @default radius = 2 + */ + radius: 2, + + /** + * @description Line point default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: '#fff', + lineWidth: 1 + } + }, + + /** + * @description Line area configuration + * @type {Object} + */ + lineArea: { + /** + * @description Whether to display line area + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Line area gradient color (Hex|rgb|rgba) + * @type {Array} + * @default gradient = [] + */ + gradient: [], + + /** + * @description Line area style default configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + opacity: 0.5 + } + }, + + /** + * @description Line label configuration + * @type {Object} + */ + label: { + /** + * @description Whether to display line label + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Line label position + * @type {String} + * @default position = 'top' + * @example position = 'top' | 'center' | 'bottom' + */ + position: 'top', + + /** + * @description Line label offset + * @type {Array} + * @default offset = [0, -10] + */ + offset: [0, -10], + + /** + * @description Line label formatter + * @type {String|Function} + * @default formatter = null + * @example formatter = '{value}件' + * @example formatter = (dataItem) => (dataItem.value) + */ + formatter: null, + + /** + * @description Line label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fontSize: 10 + } + }, + + /** + * @description Line chart render level + * Priority rendering high level + * @type {Number} + * @default rLevel = 10 + */ + rLevel: 10, + + /** + * @description Line animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Line animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrame: 50 +}; +exports.lineConfig = lineConfig; +},{}],12:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.pieConfig = void 0; +var pieConfig = { + /** + * @description Whether to display this pie chart + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Legend name + * @type {String} + * @default name = '' + */ + name: '', + + /** + * @description Radius of pie + * @type {String|Number} + * @default radius = '50%' + * @example radius = '50%' | 100 + */ + radius: '50%', + + /** + * @description Center point of pie + * @type {Array} + * @default center = ['50%','50%'] + * @example center = ['50%','50%'] | [100, 100] + */ + center: ['50%', '50%'], + + /** + * @description Pie chart start angle + * @type {Number} + * @default startAngle = -Math.PI / 2 + * @example startAngle = -Math.PI + */ + startAngle: -Math.PI / 2, + + /** + * @description Whether to enable rose type + * @type {Boolean} + * @default roseType = false + */ + roseType: false, + + /** + * @description Automatic sorting in rose type + * @type {Boolean} + * @default roseSort = true + */ + roseSort: true, + + /** + * @description Rose radius increasing + * @type {String|Number} + * @default roseIncrement = 'auto' + * @example roseIncrement = 'auto' | '10%' | 10 + */ + roseIncrement: 'auto', + + /** + * @description Pie chart data + * @type {Array} + * @default data = [] + */ + data: [], + + /** + * @description Pie inside label configuration + * @type {Object} + */ + insideLabel: { + /** + * @description Whether to display inside label + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Label formatter + * @type {String|Function} + * @default formatter = '{percent}%' + * @example formatter = '${name}-{value}-{percent}%' + * @example formatter = (dataItem) => (dataItem.name) + */ + formatter: '{percent}%', + + /** + * @description Label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fontSize: 10, + fill: '#fff', + textAlign: 'center', + textBaseline: 'middle' + } + }, + + /** + * @description Pie Outside label configuration + * @type {Object} + */ + outsideLabel: { + /** + * @description Whether to display outside label + * @type {Boolean} + * @default show = false + */ + show: true, + + /** + * @description Label formatter + * @type {String|Function} + * @default formatter = '{name}' + * @example formatter = '${name}-{value}-{percent}%' + * @example formatter = (dataItem) => (dataItem.name) + */ + formatter: '{name}', + + /** + * @description Label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fontSize: 11 + }, + + /** + * @description Gap beteen label line bended place and pie + * @type {String|Number} + * @default labelLineBendGap = '20%' + * @example labelLineBendGap = '20%' | 20 + */ + labelLineBendGap: '20%', + + /** + * @description Label line end length + * @type {Number} + * @default labelLineEndLength = 50 + */ + labelLineEndLength: 50, + + /** + * @description Label line default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + labelLineStyle: { + lineWidth: 1 + } + }, + + /** + * @description Pie default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + pieStyle: {}, + + /** + * @description Percentage fractional precision + * @type {Number} + * @default percentToFixed = 0 + */ + percentToFixed: 0, + + /** + * @description Pie chart render level + * Priority rendering high level + * @type {Number} + * @default rLevel = 10 + */ + rLevel: 10, + + /** + * @description Animation delay gap + * @type {Number} + * @default animationDelayGap = 60 + */ + animationDelayGap: 60, + + /** + * @description Pie animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Pie start animation curve + * @type {String} + * @default startAnimationCurve = 'easeOutBack' + */ + startAnimationCurve: 'easeOutBack', + + /** + * @description Pie animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrame: 50 +}; +exports.pieConfig = pieConfig; +},{}],13:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.radarConfig = void 0; +var radarConfig = { + /** + * @description Whether to display this radar + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Legend name + * @type {String} + * @default name = '' + */ + name: '', + + /** + * @description Radar chart data + * @type {Array} + * @default data = [] + * @example data = [100, 200, 300] + */ + data: [], + + /** + * @description Radar default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + radarStyle: { + lineWidth: 1 + }, + + /** + * @description Radar point configuration + * @type {Object} + */ + point: { + /** + * @description Whether to display radar point + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Point radius + * @type {Number} + * @default radius = 2 + */ + radius: 2, + + /** + * @description Radar point default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: '#fff' + } + }, + + /** + * @description Radar label configuration + * @type {Object} + */ + label: { + /** + * @description Whether to display radar label + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Label position offset + * @type {Array} + * @default offset = [0, 0] + */ + offset: [0, 0], + + /** + * @description Label gap between label and radar + * @type {Number} + * @default labelGap = 5 + */ + labelGap: 5, + + /** + * @description Label formatter + * @type {String|Function} + * @default formatter = null + * @example formatter = 'Score-{value}' + * @example formatter = (label) => (label) + */ + formatter: null, + + /** + * @description Radar label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fontSize: 10 + } + }, + + /** + * @description Radar chart render level + * Priority rendering high level + * @type {Number} + * @default rLevel = 10 + */ + rLevel: 10, + + /** + * @description Radar animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Radar animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrane: 50 +}; +exports.radarConfig = radarConfig; +},{}],14:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.radarAxisConfig = void 0; +var radarAxisConfig = { + /** + * @description Whether to display this radar axis + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Center point of radar axis + * @type {Array} + * @default center = ['50%','50%'] + * @example center = ['50%','50%'] | [100, 100] + */ + center: ['50%', '50%'], + + /** + * @description Radius of radar axis + * @type {String|Number} + * @default radius = '65%' + * @example radius = '65%' | 100 + */ + radius: '65%', + + /** + * @description Radar axis start angle + * @type {Number} + * @default startAngle = -Math.PI / 2 + * @example startAngle = -Math.PI + */ + startAngle: -Math.PI / 2, + + /** + * @description Radar axis split number + * @type {Number} + * @default splitNum = 5 + */ + splitNum: 5, + + /** + * @description Whether to enable polygon radar axis + * @type {Boolean} + * @default polygon = false + */ + polygon: false, + + /** + * @description Axis label configuration + * @type {Object} + */ + axisLabel: { + /** + * @description Whether to display axis label + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Label gap between label and radar axis + * @type {Number} + * @default labelGap = 15 + */ + labelGap: 15, + + /** + * @description Label color (Hex|rgb|rgba), will cover style.fill + * @type {Array} + * @default color = [] + */ + color: [], + + /** + * @description Axis label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: '#333' + } + }, + + /** + * @description Axis line configuration + * @type {Object} + */ + axisLine: { + /** + * @description Whether to display axis line + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Line color (Hex|rgb|rgba), will cover style.stroke + * @type {Array} + * @default color = [] + */ + color: [], + + /** + * @description Axis label default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#999', + lineWidth: 1 + } + }, + + /** + * @description Split line configuration + * @type {Object} + */ + splitLine: { + /** + * @description Whether to display split line + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Line color (Hex|rgb|rgba), will cover style.stroke + * @type {Array} + * @default color = [] + */ + color: [], + + /** + * @description Split line default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + stroke: '#d4d4d4', + lineWidth: 1 + } + }, + + /** + * @description Split area configuration + * @type {Object} + */ + splitArea: { + /** + * @description Whether to display split area + * @type {Boolean} + * @default show = false + */ + show: false, + + /** + * @description Area color (Hex|rgb|rgba), will cover style.stroke + * @type {Array} + * @default color = [] + */ + color: ['#f5f5f5', '#e6e6e6'], + + /** + * @description Split area default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: {} + }, + + /** + * @description Bar chart render level + * Priority rendering high level + * @type {Number} + * @default rLevel = -10 + */ + rLevel: -10, + + /** + * @description Radar axis animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Radar axis animation frame + * @type {Number} + * @default animationFrame = 50 + */ + animationFrane: 50 +}; +exports.radarAxisConfig = radarAxisConfig; +},{}],15:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.titleConfig = void 0; +var titleConfig = { + /** + * @description Whether to display title + * @type {Boolean} + * @default show = true + */ + show: true, + + /** + * @description Title text + * @type {String} + * @default text = '' + */ + text: '', + + /** + * @description Title offset + * @type {Array} + * @default offset = [0, -20] + */ + offset: [0, -20], + + /** + * @description Title default style configuration + * @type {Object} + * @default style = {Configuration Of Class Style} + */ + style: { + fill: '#333', + fontSize: 17, + fontWeight: 'bold', + textAlign: 'center', + textBaseline: 'bottom' + }, + + /** + * @description Title render level + * Priority rendering high level + * @type {Number} + * @default rLevel = 20 + */ + rLevel: 20, + + /** + * @description Title animation curve + * @type {String} + * @default animationCurve = 'easeOutCubic' + */ + animationCurve: 'easeOutCubic', + + /** + * @description Title animation frame + * @type {Number} + * @default animationFrame = 50 + */ + 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +var axisConfig = { + xAxisConfig: _config.xAxisConfig, + yAxisConfig: _config.yAxisConfig +}; +var min = Math.min, + max = Math.max, + abs = Math.abs, + pow = Math.pow; + +function axis(chart) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var xAxis = option.xAxis, + yAxis = option.yAxis, + series = option.series; + var allAxis = []; + + if (xAxis && yAxis && series) { + allAxis = getAllAxis(xAxis, yAxis); + allAxis = mergeDefaultAxisConfig(allAxis); + allAxis = allAxis.filter(function (_ref) { + var show = _ref.show; + return show; + }); + allAxis = mergeDefaultBoundaryGap(allAxis); + allAxis = calcAxisLabelData(allAxis, series); + allAxis = setAxisPosition(allAxis); + allAxis = calcAxisLinePosition(allAxis, chart); + allAxis = calcAxisTickPosition(allAxis, chart); + allAxis = calcAxisNamePosition(allAxis, chart); + allAxis = calcSplitLinePosition(allAxis, chart); + } + + (0, _updater.doUpdate)({ + chart: chart, + series: allAxis, + key: 'axisLine', + getGraphConfig: getLineConfig + }); + (0, _updater.doUpdate)({ + chart: chart, + series: allAxis, + key: 'axisTick', + getGraphConfig: getTickConfig + }); + (0, _updater.doUpdate)({ + chart: chart, + series: allAxis, + key: 'axisLabel', + getGraphConfig: getLabelConfig + }); + (0, _updater.doUpdate)({ + chart: chart, + series: allAxis, + key: 'axisName', + getGraphConfig: getNameConfig + }); + (0, _updater.doUpdate)({ + chart: chart, + series: allAxis, + key: 'splitLine', + getGraphConfig: getSplitLineConfig + }); + chart.axisData = allAxis; +} + +function getAllAxis(xAxis, yAxis) { + var allXAxis = [], + allYAxis = []; + + if (xAxis instanceof Array) { + var _allXAxis; + + (_allXAxis = allXAxis).push.apply(_allXAxis, (0, _toConsumableArray2["default"])(xAxis)); + } else { + allXAxis.push(xAxis); + } + + if (yAxis instanceof Array) { + var _allYAxis; + + (_allYAxis = allYAxis).push.apply(_allYAxis, (0, _toConsumableArray2["default"])(yAxis)); + } else { + allYAxis.push(yAxis); + } + + allXAxis.splice(2); + allYAxis.splice(2); + allXAxis = allXAxis.map(function (axis, i) { + return _objectSpread({}, axis, { + index: i, + axis: 'x' + }); + }); + allYAxis = allYAxis.map(function (axis, i) { + return _objectSpread({}, axis, { + index: i, + axis: 'y' + }); + }); + return [].concat((0, _toConsumableArray2["default"])(allXAxis), (0, _toConsumableArray2["default"])(allYAxis)); +} + +function mergeDefaultAxisConfig(allAxis) { + var xAxis = allAxis.filter(function (_ref2) { + var axis = _ref2.axis; + return axis === 'x'; + }); + var yAxis = allAxis.filter(function (_ref3) { + var axis = _ref3.axis; + return axis === 'y'; + }); + xAxis = xAxis.map(function (axis) { + return (0, _util.deepMerge)((0, _util2.deepClone)(_config.xAxisConfig), axis); + }); + yAxis = yAxis.map(function (axis) { + return (0, _util.deepMerge)((0, _util2.deepClone)(_config.yAxisConfig), axis); + }); + return [].concat((0, _toConsumableArray2["default"])(xAxis), (0, _toConsumableArray2["default"])(yAxis)); +} + +function mergeDefaultBoundaryGap(allAxis) { + var valueAxis = allAxis.filter(function (_ref4) { + var data = _ref4.data; + return data === 'value'; + }); + var labelAxis = allAxis.filter(function (_ref5) { + var data = _ref5.data; + return data !== 'value'; + }); + valueAxis.forEach(function (axis) { + if (typeof axis.boundaryGap === 'boolean') return; + axis.boundaryGap = false; + }); + labelAxis.forEach(function (axis) { + if (typeof axis.boundaryGap === 'boolean') return; + axis.boundaryGap = true; + }); + return [].concat((0, _toConsumableArray2["default"])(valueAxis), (0, _toConsumableArray2["default"])(labelAxis)); +} + +function calcAxisLabelData(allAxis, series) { + var valueAxis = allAxis.filter(function (_ref6) { + var data = _ref6.data; + return data === 'value'; + }); + var labelAxis = allAxis.filter(function (_ref7) { + var data = _ref7.data; + return data instanceof Array; + }); + valueAxis = calcValueAxisLabelData(valueAxis, series); + labelAxis = calcLabelAxisLabelData(labelAxis); + return [].concat((0, _toConsumableArray2["default"])(valueAxis), (0, _toConsumableArray2["default"])(labelAxis)); +} + +function calcValueAxisLabelData(valueAxis, series) { + return valueAxis.map(function (axis) { + var minMaxValue = getValueAxisMaxMinValue(axis, series); + + var _getTrueMinMax = getTrueMinMax(axis, minMaxValue), + _getTrueMinMax2 = (0, _slicedToArray2["default"])(_getTrueMinMax, 2), + min = _getTrueMinMax2[0], + max = _getTrueMinMax2[1]; + + var interval = getValueInterval(min, max, axis); + var formatter = axis.axisLabel.formatter; + var label = []; + + if (minMaxValue[0] === minMaxValue[1]) { + label = minMaxValue; + } else if (min < 0 && max > 0) { + label = getValueAxisLabelFromZero(min, max, interval); + } else { + label = getValueAxisLabelFromMin(min, max, interval); + } + + label = label.map(function (l) { + return parseFloat(l.toFixed(2)); + }); + return _objectSpread({}, axis, { + maxValue: label.slice(-1)[0], + minValue: label[0], + label: getAfterFormatterLabel(label, formatter) + }); + }); +} + +function getValueAxisMaxMinValue(axis, series) { + series = series.filter(function (_ref8) { + var show = _ref8.show, + type = _ref8.type; + if (show === false) return false; + if (type === 'pie') return false; + return true; + }); + if (series.length === 0) return [0, 0]; + var index = axis.index, + axisType = axis.axis; + series = mergeStackData(series); + var axisName = axisType + 'Axis'; + var valueSeries = series.filter(function (s) { + return s[axisName] === index; + }); + if (!valueSeries.length) valueSeries = series; + return getSeriesMinMaxValue(valueSeries); +} + +function getSeriesMinMaxValue(series) { + if (!series) return; + var minValue = min.apply(void 0, (0, _toConsumableArray2["default"])(series.map(function (_ref9) { + var data = _ref9.data; + return min.apply(void 0, (0, _toConsumableArray2["default"])((0, _util.filterNonNumber)(data))); + }))); + var maxValue = max.apply(void 0, (0, _toConsumableArray2["default"])(series.map(function (_ref10) { + var data = _ref10.data; + return max.apply(void 0, (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 - 0.1).toFixed(1)) * lever; + } + + if (maxType === 'string') { + max = parseInt(maxValue + abs(maxValue * parseFloat(max) / 100)); + + var _lever = getValueLever(max); + + max = parseFloat((max / _lever + 0.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 (currentPositive < max); + + return [].concat((0, _toConsumableArray2["default"])(negative.reverse()), [0], (0, _toConsumableArray2["default"])(positive)); +} + +function getValueAxisLabelFromMin(min, max, interval) { + var label = [min], + currentValue = min; + + do { + label.push(currentValue += interval); + } while (currentValue < max); + + return label; +} + +function getAfterFormatterLabel(label, formatter) { + if (!formatter) return label; + if (typeof formatter === 'string') label = label.map(function (l) { + return formatter.replace('{value}', l); + }); + if (typeof formatter === 'function') label = label.map(function (value, index) { + return formatter({ + value: value, + index: index + }); + }); + return label; +} + +function calcLabelAxisLabelData(labelAxis) { + return labelAxis.map(function (axis) { + var data = axis.data, + formatter = axis.axisLabel.formatter; + return _objectSpread({}, axis, { + label: getAfterFormatterLabel(data, formatter) + }); + }); +} + +function getValueInterval(min, max, axis) { + var interval = axis.interval, + minInterval = axis.minInterval, + maxInterval = axis.maxInterval, + splitNumber = axis.splitNumber, + axisType = axis.axis; + var config = axisConfig[axisType + 'AxisConfig']; + if (typeof interval !== 'number') interval = config.interval; + if (typeof minInterval !== 'number') minInterval = config.minInterval; + if (typeof maxInterval !== 'number') maxInterval = config.maxInterval; + if (typeof splitNumber !== 'number') splitNumber = config.splitNumber; + if (typeof interval === 'number') return interval; + var valueInterval = parseInt((max - min) / (splitNumber - 1)); + if (valueInterval.toString().length > 1) valueInterval = parseInt(valueInterval.toString().replace(/\d$/, '0')); + if (valueInterval === 0) valueInterval = 1; + if (typeof minInterval === 'number' && valueInterval < minInterval) return minInterval; + if (typeof maxInterval === 'number' && valueInterval > maxInterval) 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 + 0.5 : i), startY]; + } + + return [startX, startY + gap * (boundaryGap ? i + 0.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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function bar(chart) { + var option = arguments.length > 1 && 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 + 0.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 - start < echelonOffset) points.splice(3, 1); + } else { + points[0] = [labelAxisPos - halfWidth, end]; + points[1] = [labelAxisPos + halfWidth, end]; + points[2] = [labelAxisPos + halfWidth, start]; + points[3] = [labelAxisPos - halfWidth, start - echelonOffset]; + if (start - end < echelonOffset) points.splice(3, 1); + } + + return { + points: points, + close: true + }; +} + +function getRightEchelonShape(barItem, i) { + var barValueAxisPos = barItem.barValueAxisPos, + barLabelAxisPos = barItem.barLabelAxisPos, + barWidth = barItem.barWidth, + echelonOffset = barItem.echelonOffset; + + var _barValueAxisPos$i2 = (0, _slicedToArray2["default"])(barValueAxisPos[i], 2), + start = _barValueAxisPos$i2[0], + end = _barValueAxisPos$i2[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 - start < echelonOffset) points.splice(2, 1); + } else { + points[0] = [labelAxisPos + halfWidth, end]; + points[1] = [labelAxisPos - halfWidth, end]; + points[2] = [labelAxisPos - halfWidth, start]; + points[3] = [labelAxisPos + halfWidth, start - echelonOffset]; + if (start - end < echelonOffset) points.splice(2, 1); + } + + return { + points: points, + close: true + }; +} + +function getNormalBarShape(barItem, i) { + var barValueAxisPos = barItem.barValueAxisPos, + barLabelAxisPos = barItem.barLabelAxisPos, + barWidth = barItem.barWidth; + + var _barValueAxisPos$i3 = (0, _slicedToArray2["default"])(barValueAxisPos[i], 2), + start = _barValueAxisPos$i3[0], + end = _barValueAxisPos$i3[1]; + + var labelAxisPos = barLabelAxisPos[i]; + var valueAxis = barItem.valueAxis.axis; + var shape = {}; + + if (valueAxis === 'x') { + shape.x = start; + shape.y = labelAxisPos - barWidth / 2; + shape.w = end - start; + shape.h = barWidth; + } else { + shape.x = labelAxisPos - barWidth / 2; + shape.y = end; + shape.w = barWidth; + shape.h = start - end; + } + + return shape; +} + +function getBarStyle(barItem, i) { + var barStyle = barItem.barStyle, + gradient = barItem.gradient, + color = barItem.color; + var fillColor = [barStyle.fill || color]; + var gradientColor = (0, _util2.deepMerge)(fillColor, gradient.color); + if (gradientColor.length === 1) gradientColor.push(gradientColor[0]); + var gradientParams = getGradientParams(barItem, i); + return (0, _util2.deepMerge)({ + gradientColor: gradientColor, + gradientParams: gradientParams, + gradientType: 'linear', + gradientWith: 'fill' + }, barStyle); +} + +function getGradientParams(barItem, i) { + var barValueAxisPos = barItem.barValueAxisPos, + barLabelAxisPos = barItem.barLabelAxisPos, + data = barItem.data; + var _barItem$valueAxis = barItem.valueAxis, + linePosition = _barItem$valueAxis.linePosition, + axis = _barItem$valueAxis.axis; + + var _barValueAxisPos$i4 = (0, _slicedToArray2["default"])(barValueAxisPos[i], 2), + start = _barValueAxisPos$i4[0], + end = _barValueAxisPos$i4[1]; + + var labelAxisPos = barLabelAxisPos[i]; + var value = data[i]; + + var _linePosition = (0, _slicedToArray2["default"])(linePosition, 2), + lineStart = _linePosition[0], + lineEnd = _linePosition[1]; + + var valueAxisIndex = axis === 'x' ? 0 : 1; + var endPos = end; + + if (!barItem.gradient.local) { + endPos = value < 0 ? lineStart[valueAxisIndex] : lineEnd[valueAxisIndex]; + } + + if (axis === 'y') { + return [labelAxisPos, endPos, labelAxisPos, start]; + } else { + return [endPos, labelAxisPos, start, labelAxisPos]; + } +} + +function getStartBarConfig(barItem) { + var configs = getBarConfig(barItem); + var shapeType = barItem.shapeType; + configs.forEach(function (config) { + var shape = config.shape; + + if (shapeType === 'leftEchelon') { + shape = getStartLeftEchelonShape(shape, barItem); + } else if (shapeType === 'rightEchelon') { + shape = getStartRightEchelonShape(shape, barItem); + } else { + shape = getStartNormalBarShape(shape, barItem); + } + + config.shape = shape; + }); + return configs; +} + +function getStartLeftEchelonShape(shape, barItem) { + var axis = barItem.valueAxis.axis; + shape = (0, _util.deepClone)(shape); + var _shape = shape, + points = _shape.points; + var index = axis === 'x' ? 0 : 1; + var start = points[2][index]; + points.forEach(function (point) { + return point[index] = start; + }); + return shape; +} + +function getStartRightEchelonShape(shape, barItem) { + var axis = barItem.valueAxis.axis; + shape = (0, _util.deepClone)(shape); + var _shape2 = shape, + points = _shape2.points; + var index = axis === 'x' ? 0 : 1; + var start = points[2][index]; + points.forEach(function (point) { + return point[index] = start; + }); + return shape; +} + +function getStartNormalBarShape(shape, barItem) { + var axis = barItem.valueAxis.axis; + var x = shape.x, + y = shape.y, + w = shape.w, + h = shape.h; + + if (axis === 'x') { + w = 0; + } else { + y = y + h; + h = 0; + } + + return { + x: x, + y: y, + w: w, + h: h + }; +} + +function beforeUpdateBar(graphs, barItem, i, updater) { + var render = updater.chart.render; + var name = getBarName(barItem); + + if (graphs[i] && graphs[i][0].name !== name) { + graphs[i].forEach(function (g) { + return render.delGraph(g); + }); + graphs[i] = null; + } +} + +function getLabelConfig(barItem) { + var animationCurve = barItem.animationCurve, + animationFrame = barItem.animationFrame, + rLevel = barItem.rLevel; + var shapes = getLabelShapes(barItem); + var style = getLabelStyle(barItem); + return shapes.map(function (shape) { + return { + name: 'text', + index: rLevel, + visible: barItem.label.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: shape, + style: style + }; + }); +} + +function getLabelShapes(barItem) { + var contents = getFormatterLabels(barItem); + var position = getLabelsPosition(barItem); + return position.map(function (pos, i) { + return { + position: pos, + content: contents[i] + }; + }); +} + +function getFormatterLabels(barItem) { + var data = barItem.data, + label = barItem.label; + var formatter = 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 (d, i) { + return formatter({ + value: d, + index: i + }); + }); + return data; +} + +function getLabelsPosition(barItem) { + var label = barItem.label, + barValueAxisPos = barItem.barValueAxisPos, + barLabelAxisPos = barItem.barLabelAxisPos; + var position = label.position, + offset = label.offset; + var axis = barItem.valueAxis.axis; + return barValueAxisPos.map(function (_ref10, i) { + var _ref11 = (0, _slicedToArray2["default"])(_ref10, 2), + start = _ref11[0], + end = _ref11[1]; + + var labelAxisPos = barLabelAxisPos[i]; + var pos = [end, labelAxisPos]; + + if (position === 'bottom') { + pos = [start, labelAxisPos]; + } + + if (position === 'center') { + pos = [(start + end) / 2, labelAxisPos]; + } + + if (axis === 'y') pos.reverse(); + return getOffsetedPoint(pos, offset); + }); +} + +function getOffsetedPoint(_ref12, _ref13) { + var _ref14 = (0, _slicedToArray2["default"])(_ref12, 2), + x = _ref14[0], + y = _ref14[1]; + + var _ref15 = (0, _slicedToArray2["default"])(_ref13, 2), + ox = _ref15[0], + oy = _ref15[1]; + + return [x + ox, y + oy]; +} + +function getLabelStyle(barItem) { + var color = barItem.color, + style = barItem.label.style, + gc = barItem.gradient.color; + if (gc.length) color = gc[0]; + style = (0, _util2.deepMerge)({ + fill: color + }, 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,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],18:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.gauge = gauge; + +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 _gauge = require("../config/gauge"); + +var _util = require("@jiaminghi/c-render/lib/plugin/util"); + +var _util2 = require("../util"); + +var _color = require("@jiaminghi/color"); + +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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function gauge(chart) { + var option = arguments.length > 1 && 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function grid(chart) { + var option = arguments.length > 1 && 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +var polylineToBezierCurve = _bezierCurve["default"].polylineToBezierCurve, + getBezierCurveLength = _bezierCurve["default"].getBezierCurveLength; + +function line(chart) { + var option = arguments.length > 1 && 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 (pointsNum < graphPointsNum) { + graphPoints.splice(pointsNum); + } +} + +function getLineConfig(lineItem) { + var animationCurve = lineItem.animationCurve, + animationFrame = lineItem.animationFrame, + rLevel = lineItem.rLevel; + return [{ + name: getLineGraphName(lineItem), + index: rLevel + 1, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getLineAndAreaShape(lineItem), + style: getLineStyle(lineItem) + }]; +} + +function getLineGraphName(lineItem) { + var smooth = lineItem.smooth; + return smooth ? 'smoothline' : 'polyline'; +} + +function getLineStyle(lineItem) { + var lineStyle = lineItem.lineStyle, + color = lineItem.color, + smooth = lineItem.smooth, + linePosition = lineItem.linePosition; + var lineLength = getLineLength(linePosition, smooth); + return (0, _util.deepMerge)({ + stroke: color, + lineDash: [lineLength, 0] + }, lineStyle); +} + +function getLineLength(points) { + var smooth = arguments.length > 1 && 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 = 0.1; + }); + return configs; +} + +function getLabelConfig(lineItem) { + var animationCurve = lineItem.animationCurve, + animationFrame = lineItem.animationFrame, + rLevel = lineItem.rLevel; + var shapes = getLabelShapes(lineItem); + var style = getLabelStyle(lineItem); + return shapes.map(function (shape, i) { + return { + name: 'text', + index: rLevel + 3, + visible: lineItem.label.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: shape, + style: style + }; + }); +} + +function getLabelShapes(lineItem) { + var contents = formatterLabel(lineItem); + var position = getLabelPosition(lineItem); + return contents.map(function (content, i) { + return { + content: content, + position: position[i] + }; + }); +} + +function getLabelPosition(lineItem) { + var linePosition = lineItem.linePosition, + lineFillBottomPos = lineItem.lineFillBottomPos, + label = lineItem.label; + var position = label.position, + offset = label.offset; + var changeIndex = lineFillBottomPos.changeIndex, + changeValue = lineFillBottomPos.changeValue; + return linePosition.map(function (pos) { + if (position === 'bottom') { + pos = (0, _toConsumableArray2["default"])(pos); + pos[changeIndex] = changeValue; + } + + if (position === 'center') { + var bottom = (0, _toConsumableArray2["default"])(pos); + bottom[changeIndex] = changeValue; + pos = getCenterLabelPoint(pos, bottom); + } + + return getOffsetedPoint(pos, offset); + }); +} + +function getOffsetedPoint(_ref9, _ref10) { + var _ref11 = (0, _slicedToArray2["default"])(_ref9, 2), + x = _ref11[0], + y = _ref11[1]; + + var _ref12 = (0, _slicedToArray2["default"])(_ref10, 2), + ox = _ref12[0], + oy = _ref12[1]; + + return [x + ox, y + oy]; +} + +function getCenterLabelPoint(_ref13, _ref14) { + var _ref15 = (0, _slicedToArray2["default"])(_ref13, 2), + ax = _ref15[0], + ay = _ref15[1]; + + var _ref16 = (0, _slicedToArray2["default"])(_ref14, 2), + bx = _ref16[0], + by = _ref16[1]; + + return [(ax + bx) / 2, (ay + by) / 2]; +} + +function formatterLabel(lineItem) { + var data = lineItem.data, + formatter = lineItem.label.formatter; + data = data.filter(function (d) { + return typeof d === 'number'; + }).map(function (d) { + return d.toString(); + }); + if (!formatter) return data; + var type = (0, _typeof2["default"])(formatter); + if (type === 'string') return data.map(function (d) { + return formatter.replace('{value}', d); + }); + if (type === 'function') return data.map(function (value, index) { + return formatter({ + value: value, + index: index + }); + }); + return data; +} + +function getLabelStyle(lineItem) { + var color = lineItem.color, + style = lineItem.label.style; + return (0, _util.deepMerge)({ + fill: color + }, style); +} +},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/bezier-curve":47}],23:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.mergeColor = mergeColor; + +var _config = require("../config"); + +var _util = require("@jiaminghi/c-render/lib/plugin/util"); + +var _util2 = require("../util"); + +function mergeColor(chart) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var defaultColor = (0, _util.deepClone)(_config.colorConfig, true); + var color = option.color, + series = option.series; + if (!series) series = []; + if (!color) color = []; + option.color = color = (0, _util2.deepMerge)(defaultColor, color); + if (!series.length) return; + var colorNum = color.length; + series.forEach(function (item, i) { + if (item.color) return; + item.color = color[i % colorNum]; + }); + var pies = series.filter(function (_ref) { + var type = _ref.type; + return type === 'pie'; + }); + pies.forEach(function (pie) { + return pie.data.forEach(function (di, i) { + return di.color = color[i % colorNum]; + }); + }); + var gauges = series.filter(function (_ref2) { + var type = _ref2.type; + return type === 'gauge'; + }); + gauges.forEach(function (gauge) { + return gauge.data.forEach(function (di, i) { + return di.color = color[i % colorNum]; + }); + }); +} +},{"../config":9,"../util":30,"@jiaminghi/c-render/lib/plugin/util":54}],24:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.pie = pie; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _updater = require("../class/updater.class"); + +var _pie = require("../config/pie"); + +var _util = require("@jiaminghi/c-render/lib/plugin/util"); + +var _util2 = require("../util"); + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function pie(chart) { + var option = arguments.length > 1 && 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 (a < b) return 1; + }); +} + +function getRoseIncrement(pie) { + var radius = pie.radius, + roseIncrement = pie.roseIncrement; + if (typeof roseIncrement === 'number') return roseIncrement; + + if (roseIncrement === 'auto') { + var data = pie.data; + var allRadius = data.reduce(function (all, _ref4) { + var radius = _ref4.radius; + return [].concat((0, _toConsumableArray2["default"])(all), (0, _toConsumableArray2["default"])(radius)); + }, []); + var minRadius = Math.min.apply(Math, (0, _toConsumableArray2["default"])(allRadius)); + var maxRadius = Math.max.apply(Math, (0, _toConsumableArray2["default"])(allRadius)); + return (maxRadius - minRadius) * 0.6 / (data.length - 1 || 1); + } + + return parseInt(roseIncrement) / 100 * radius[1]; +} + +function calcPiesPercent(pies) { + pies.forEach(function (pie) { + var data = pie.data, + percentToFixed = pie.percentToFixed; + var sum = getDataSum(data); + data.forEach(function (item) { + var value = item.value; + item.percent = parseFloat((value / sum * 100).toFixed(percentToFixed)); + }); + var percentSumNoLast = (0, _util2.mulAdd)(data.slice(0, -1).map(function (_ref5) { + var percent = _ref5.percent; + return percent; + })); + data.slice(-1)[0].percent = 100 - percentSumNoLast; + }); + return pies; +} + +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 (ay < by) return -1; + if (ay === by) return 0; + }); + return dataItem; +} + +function addLabelLineAndAlign(dataItem, pieItem) { + var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + var center = pieItem.center, + outsideLabel = pieItem.outsideLabel; + var radius = getLabelLineBendRadius(pieItem); + dataItem.forEach(function (item) { + var edgeCenterPos = item.edgeCenterPos, + startAngle = item.startAngle, + endAngle = item.endAngle; + var labelLineEndLength = outsideLabel.labelLineEndLength; + var angle = (startAngle + endAngle) / 2; + + var bendPoint = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(center).concat([radius, angle])); + + var endPoint = (0, _toConsumableArray2["default"])(bendPoint); + endPoint[0] += labelLineEndLength * (left ? -1 : 1); + item.labelLine = [edgeCenterPos, bendPoint, endPoint]; + item.labelLineLength = (0, _util2.getPolylineLength)(item.labelLine); + item.align = { + textAlign: 'left', + textBaseline: 'middle' + }; + if (left) item.align.textAlign = 'right'; + }); +} + +function getPieConfig(pieItem) { + var data = pieItem.data, + animationCurve = pieItem.animationCurve, + animationFrame = pieItem.animationFrame, + rLevel = pieItem.rLevel; + return data.map(function (foo, i) { + return { + name: 'pie', + index: rLevel, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getPieShape(pieItem, i), + style: getPieStyle(pieItem, i) + }; + }); +} + +function getStartPieConfig(pieItem) { + var animationDelayGap = pieItem.animationDelayGap, + startAnimationCurve = pieItem.startAnimationCurve; + var configs = getPieConfig(pieItem); + configs.forEach(function (config, i) { + config.animationCurve = startAnimationCurve; + config.animationDelay = i * animationDelayGap; + config.shape.or = config.shape.ir; + }); + return configs; +} + +function beforeChangePie(graph) { + graph.animationDelay = 0; +} + +function getPieShape(pieItem, i) { + var center = pieItem.center, + data = pieItem.data; + var dataItem = data[i]; + var radius = dataItem.radius, + startAngle = dataItem.startAngle, + endAngle = dataItem.endAngle; + return { + startAngle: startAngle, + endAngle: endAngle, + ir: radius[0], + or: radius[1], + rx: center[0], + ry: center[1] + }; +} + +function getPieStyle(pieItem, i) { + var pieStyle = pieItem.pieStyle, + data = pieItem.data; + var dataItem = data[i]; + var color = dataItem.color; + return (0, _util2.deepMerge)({ + fill: color + }, pieStyle); +} + +function getInsideLabelConfig(pieItem) { + var animationCurve = pieItem.animationCurve, + animationFrame = pieItem.animationFrame, + data = pieItem.data, + rLevel = pieItem.rLevel; + return data.map(function (foo, i) { + return { + name: 'text', + index: rLevel, + visible: pieItem.insideLabel.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getInsideLabelShape(pieItem, i), + style: getInsideLabelStyle(pieItem, i) + }; + }); +} + +function getInsideLabelShape(pieItem, i) { + var insideLabel = pieItem.insideLabel, + data = pieItem.data; + var formatter = insideLabel.formatter; + var dataItem = data[i]; + var formatterType = (0, _typeof2["default"])(formatter); + var label = ''; + + if (formatterType === 'string') { + label = formatter.replace('{name}', dataItem.name); + label = label.replace('{percent}', dataItem.percent); + label = label.replace('{value}', dataItem.value); + } + + if (formatterType === 'function') { + label = formatter(dataItem); + } + + return { + content: label, + position: dataItem.insideLabelPos + }; +} + +function getInsideLabelStyle(pieItem, i) { + var style = pieItem.insideLabel.style; + return style; +} + +function getOutsideLabelLineConfig(pieItem) { + var animationCurve = pieItem.animationCurve, + animationFrame = pieItem.animationFrame, + data = pieItem.data, + rLevel = pieItem.rLevel; + return data.map(function (foo, i) { + return { + name: 'polyline', + index: rLevel, + visible: pieItem.outsideLabel.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getOutsideLabelLineShape(pieItem, i), + style: getOutsideLabelLineStyle(pieItem, i) + }; + }); +} + +function getStartOutsideLabelLineConfig(pieItem) { + var data = pieItem.data; + var configs = getOutsideLabelLineConfig(pieItem); + configs.forEach(function (config, i) { + config.style.lineDash = [0, data[i].labelLineLength]; + }); + return configs; +} + +function getOutsideLabelLineShape(pieItem, i) { + var data = pieItem.data; + var dataItem = data[i]; + return { + points: dataItem.labelLine + }; +} + +function getOutsideLabelLineStyle(pieItem, i) { + var outsideLabel = pieItem.outsideLabel, + data = pieItem.data; + var labelLineStyle = outsideLabel.labelLineStyle; + var color = data[i].color; + return (0, _util2.deepMerge)({ + stroke: color, + lineDash: [data[i].labelLineLength, 0] + }, labelLineStyle); +} + +function getOutsideLabelConfig(pieItem) { + var animationCurve = pieItem.animationCurve, + animationFrame = pieItem.animationFrame, + data = pieItem.data, + rLevel = pieItem.rLevel; + return data.map(function (foo, i) { + return { + name: 'text', + index: rLevel, + visible: pieItem.outsideLabel.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getOutsideLabelShape(pieItem, i), + style: getOutsideLabelStyle(pieItem, i) + }; + }); +} + +function getStartOutsideLabelConfig(pieItem) { + var data = pieItem.data; + var configs = getOutsideLabelConfig(pieItem); + configs.forEach(function (config, i) { + config.shape.position = data[i].labelLine[1]; + }); + return configs; +} + +function getOutsideLabelShape(pieItem, i) { + var outsideLabel = pieItem.outsideLabel, + data = pieItem.data; + var formatter = outsideLabel.formatter; + var _data$i = data[i], + labelLine = _data$i.labelLine, + name = _data$i.name, + percent = _data$i.percent, + value = _data$i.value; + var formatterType = (0, _typeof2["default"])(formatter); + var label = ''; + + if (formatterType === 'string') { + label = formatter.replace('{name}', name); + label = label.replace('{percent}', percent); + label = label.replace('{value}', value); + } + + if (formatterType === 'function') { + label = formatter(data[i]); + } + + return { + content: label, + position: labelLine[2] + }; +} + +function getOutsideLabelStyle(pieItem, i) { + var outsideLabel = pieItem.outsideLabel, + data = pieItem.data; + var _data$i2 = data[i], + color = _data$i2.color, + align = _data$i2.align; + var style = outsideLabel.style; + return (0, _util2.deepMerge)(_objectSpread({ + fill: color + }, align), style); +} +},{"../class/updater.class":3,"../config/pie":12,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],25:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.radar = radar; + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _updater = require("../class/updater.class"); + +var _index = require("../config/index"); + +var _util = require("@jiaminghi/c-render/lib/plugin/util"); + +var _color = require("@jiaminghi/color"); + +var _util2 = require("../util"); + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function radar(chart) { + var option = arguments.length > 1 && 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] = 0.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 (pointsNum < graphPointsNum) { + graphPoints.splice(pointsNum); + } +} + +function getPointConfig(radarItem) { + var radarPosition = radarItem.radarPosition, + animationCurve = radarItem.animationCurve, + animationFrame = radarItem.animationFrame, + rLevel = radarItem.rLevel; + return radarPosition.map(function (foo, i) { + return { + name: 'circle', + index: rLevel, + animationCurve: animationCurve, + animationFrame: animationFrame, + visible: radarItem.point.show, + shape: getPointShape(radarItem, i), + style: getPointStyle(radarItem, i) + }; + }); +} + +function getStartPointConfig(radarItem) { + var configs = getPointConfig(radarItem); + configs.forEach(function (config) { + return config.shape.r = 0.01; + }); + return configs; +} + +function getPointShape(radarItem, i) { + var radarPosition = radarItem.radarPosition, + point = radarItem.point; + var radius = point.radius; + var position = radarPosition[i]; + return { + rx: position[0], + ry: position[1], + r: radius + }; +} + +function getPointStyle(radarItem, i) { + var point = radarItem.point, + color = radarItem.color; + var style = point.style; + return (0, _util2.deepMerge)({ + stroke: color + }, style); +} + +function getLabelConfig(radarItem) { + var labelPosition = radarItem.labelPosition, + animationCurve = radarItem.animationCurve, + animationFrame = radarItem.animationFrame, + rLevel = radarItem.rLevel; + return labelPosition.map(function (foo, i) { + return { + name: 'text', + index: rLevel, + visible: radarItem.label.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getLabelShape(radarItem, i), + style: getLabelStyle(radarItem, i) + }; + }); +} + +function getLabelShape(radarItem, i) { + var labelPosition = radarItem.labelPosition, + label = radarItem.label, + data = radarItem.data; + var offset = label.offset, + formatter = label.formatter; + var position = mergePointOffset(labelPosition[i], offset); + var labelText = data[i] ? data[i].toString() : '0'; + var formatterType = (0, _typeof2["default"])(formatter); + if (formatterType === 'string') labelText = formatter.replace('{value}', labelText); + if (formatterType === 'function') labelText = formatter(labelText); + return { + content: labelText, + position: position + }; +} + +function mergePointOffset(_ref5, _ref6) { + var _ref7 = (0, _slicedToArray2["default"])(_ref5, 2), + x = _ref7[0], + y = _ref7[1]; + + var _ref8 = (0, _slicedToArray2["default"])(_ref6, 2), + ox = _ref8[0], + oy = _ref8[1]; + + return [x + ox, y + oy]; +} + +function getLabelStyle(radarItem, i) { + var label = radarItem.label, + color = radarItem.color, + labelAlign = radarItem.labelAlign; + var style = label.style; + + var defaultColorAndAlign = _objectSpread({ + fill: color + }, labelAlign[i]); + + return (0, _util2.deepMerge)(defaultColorAndAlign, style); +} +},{"../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,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],26:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.radarAxis = radarAxis; + +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 _index = require("../config/index"); + +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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function radarAxis(chart) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var radar = option.radar; + var radarAxis = []; + + if (radar) { + radarAxis = mergeRadarAxisDefaultConfig(radar); + radarAxis = calcRadarAxisCenter(radarAxis, chart); + radarAxis = calcRadarAxisRingRadius(radarAxis, chart); + radarAxis = calcRadarAxisLinePosition(radarAxis); + radarAxis = calcRadarAxisAreaRadius(radarAxis); + radarAxis = calcRadarAxisLabelPosition(radarAxis); + radarAxis = [radarAxis]; + } + + var radarAxisForUpdate = radarAxis; + if (radarAxis.length && !radarAxis[0].show) radarAxisForUpdate = []; + (0, _updater.doUpdate)({ + chart: chart, + series: radarAxisForUpdate, + key: 'radarAxisSplitArea', + getGraphConfig: getSplitAreaConfig, + beforeUpdate: beforeUpdateSplitArea, + beforeChange: beforeChangeSplitArea + }); + (0, _updater.doUpdate)({ + chart: chart, + series: radarAxisForUpdate, + key: 'radarAxisSplitLine', + getGraphConfig: getSplitLineConfig, + beforeUpdate: beforeUpdateSplitLine, + beforeChange: beforeChangeSplitLine + }); + (0, _updater.doUpdate)({ + chart: chart, + series: radarAxisForUpdate, + key: 'radarAxisLine', + getGraphConfig: getAxisLineConfig + }); + (0, _updater.doUpdate)({ + chart: chart, + series: radarAxisForUpdate, + key: 'radarAxisLable', + getGraphConfig: getAxisLabelConfig + }); + chart.radarAxis = radarAxis[0]; +} + +function mergeRadarAxisDefaultConfig(radar) { + return (0, _util2.deepMerge)((0, _util.deepClone)(_index.radarAxisConfig), radar); +} + +function calcRadarAxisCenter(radarAxis, chart) { + var area = chart.render.area; + var center = radarAxis.center; + radarAxis.centerPos = center.map(function (v, i) { + if (typeof v === 'number') return v; + return parseInt(v) / 100 * area[i]; + }); + return radarAxis; +} + +function calcRadarAxisRingRadius(radarAxis, chart) { + var area = chart.render.area; + var splitNum = radarAxis.splitNum, + radius = radarAxis.radius; + var maxRadius = Math.min.apply(Math, (0, _toConsumableArray2["default"])(area)) / 2; + if (typeof radius !== 'number') radius = parseInt(radius) / 100 * maxRadius; + var splitGap = radius / splitNum; + radarAxis.ringRadius = new Array(splitNum).fill(0).map(function (foo, i) { + return splitGap * (i + 1); + }); + radarAxis.radius = radius; + return radarAxis; +} + +function calcRadarAxisLinePosition(radarAxis) { + var indicator = radarAxis.indicator, + centerPos = radarAxis.centerPos, + radius = radarAxis.radius, + startAngle = radarAxis.startAngle; + var fullAngle = Math.PI * 2; + var indicatorNum = indicator.length; + var indicatorGap = fullAngle / indicatorNum; + var angles = new Array(indicatorNum).fill(0).map(function (foo, i) { + return indicatorGap * i + startAngle; + }); + radarAxis.axisLineAngles = angles; + radarAxis.axisLinePosition = angles.map(function (g) { + return _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([radius, g])); + }); + return radarAxis; +} + +function calcRadarAxisAreaRadius(radarAxis) { + var ringRadius = radarAxis.ringRadius; + var subRadius = ringRadius[0] / 2; + radarAxis.areaRadius = ringRadius.map(function (r) { + return r - subRadius; + }); + return radarAxis; +} + +function calcRadarAxisLabelPosition(radarAxis) { + var axisLineAngles = radarAxis.axisLineAngles, + centerPos = radarAxis.centerPos, + radius = radarAxis.radius, + axisLabel = radarAxis.axisLabel; + radius += axisLabel.labelGap; + radarAxis.axisLabelPosition = axisLineAngles.map(function (angle) { + return _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([radius, angle])); + }); + return radarAxis; +} + +function getSplitAreaConfig(radarAxis) { + var areaRadius = radarAxis.areaRadius, + polygon = radarAxis.polygon, + animationCurve = radarAxis.animationCurve, + animationFrame = radarAxis.animationFrame, + rLevel = radarAxis.rLevel; + var name = polygon ? 'regPolygon' : 'ring'; + return areaRadius.map(function (foo, i) { + return { + name: name, + index: rLevel, + visible: radarAxis.splitArea.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getSplitAreaShape(radarAxis, i), + style: getSplitAreaStyle(radarAxis, i) + }; + }); +} + +function getSplitAreaShape(radarAxis, i) { + var polygon = radarAxis.polygon, + areaRadius = radarAxis.areaRadius, + indicator = radarAxis.indicator, + centerPos = radarAxis.centerPos; + var indicatorNum = indicator.length; + var shape = { + rx: centerPos[0], + ry: centerPos[1], + r: areaRadius[i] + }; + if (polygon) shape.side = indicatorNum; + return shape; +} + +function getSplitAreaStyle(radarAxis, i) { + var splitArea = radarAxis.splitArea, + ringRadius = radarAxis.ringRadius, + axisLineAngles = radarAxis.axisLineAngles, + polygon = radarAxis.polygon, + centerPos = radarAxis.centerPos; + var color = splitArea.color, + style = splitArea.style; + style = _objectSpread({ + fill: 'rgba(0, 0, 0, 0)' + }, style); + var lineWidth = ringRadius[0] - 0; + + if (polygon) { + var point1 = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([ringRadius[0], axisLineAngles[0]])); + + var point2 = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([ringRadius[0], axisLineAngles[1]])); + + lineWidth = (0, _util2.getPointToLineDistance)(centerPos, point1, point2); + } + + style = (0, _util2.deepMerge)((0, _util.deepClone)(style, true), { + lineWidth: lineWidth + }); + if (!color.length) return style; + var colorNum = color.length; + return (0, _util2.deepMerge)(style, { + stroke: color[i % colorNum] + }); +} + +function beforeUpdateSplitArea(graphs, radarAxis, i, updater) { + var cache = graphs[i]; + if (!cache) return; + var render = updater.chart.render; + var polygon = radarAxis.polygon; + var name = cache[0].name; + var currentName = polygon ? 'regPolygon' : 'ring'; + var delAll = currentName !== name; + if (!delAll) return; + cache.forEach(function (g) { + return render.delGraph(g); + }); + graphs[i] = null; +} + +function beforeChangeSplitArea(graph, config) { + var side = config.shape.side; + if (typeof side !== 'number') return; + graph.shape.side = side; +} + +function getSplitLineConfig(radarAxis) { + var ringRadius = radarAxis.ringRadius, + polygon = radarAxis.polygon, + animationCurve = radarAxis.animationCurve, + animationFrame = radarAxis.animationFrame, + rLevel = radarAxis.rLevel; + var name = polygon ? 'regPolygon' : 'ring'; + return ringRadius.map(function (foo, i) { + return { + name: name, + index: rLevel, + animationCurve: animationCurve, + animationFrame: animationFrame, + visible: radarAxis.splitLine.show, + shape: getSplitLineShape(radarAxis, i), + style: getSplitLineStyle(radarAxis, i) + }; + }); +} + +function getSplitLineShape(radarAxis, i) { + var ringRadius = radarAxis.ringRadius, + centerPos = radarAxis.centerPos, + indicator = radarAxis.indicator, + polygon = radarAxis.polygon; + var shape = { + rx: centerPos[0], + ry: centerPos[1], + r: ringRadius[i] + }; + var indicatorNum = indicator.length; + if (polygon) shape.side = indicatorNum; + return shape; +} + +function getSplitLineStyle(radarAxis, i) { + var splitLine = radarAxis.splitLine; + var color = splitLine.color, + style = splitLine.style; + style = _objectSpread({ + fill: 'rgba(0, 0, 0, 0)' + }, style); + if (!color.length) return style; + var colorNum = color.length; + return (0, _util2.deepMerge)(style, { + stroke: color[i % colorNum] + }); +} + +function beforeUpdateSplitLine(graphs, radarAxis, i, updater) { + var cache = graphs[i]; + if (!cache) return; + var render = updater.chart.render; + var polygon = radarAxis.polygon; + var name = cache[0].name; + var currenName = polygon ? 'regPolygon' : 'ring'; + var delAll = currenName !== name; + if (!delAll) return; + cache.forEach(function (g) { + return render.delGraph(g); + }); + graphs[i] = null; +} + +function beforeChangeSplitLine(graph, config) { + var side = config.shape.side; + if (typeof side !== 'number') return; + graph.shape.side = side; +} + +function getAxisLineConfig(radarAxis) { + var axisLinePosition = radarAxis.axisLinePosition, + animationCurve = radarAxis.animationCurve, + animationFrame = radarAxis.animationFrame, + rLevel = radarAxis.rLevel; + return axisLinePosition.map(function (foo, i) { + return { + name: 'polyline', + index: rLevel, + visible: radarAxis.axisLine.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getAxisLineShape(radarAxis, i), + style: getAxisLineStyle(radarAxis, i) + }; + }); +} + +function getAxisLineShape(radarAxis, i) { + var centerPos = radarAxis.centerPos, + axisLinePosition = radarAxis.axisLinePosition; + var points = [centerPos, axisLinePosition[i]]; + return { + points: points + }; +} + +function getAxisLineStyle(radarAxis, i) { + var axisLine = radarAxis.axisLine; + var color = axisLine.color, + style = axisLine.style; + if (!color.length) return style; + var colorNum = color.length; + return (0, _util2.deepMerge)(style, { + stroke: color[i % colorNum] + }); +} + +function getAxisLabelConfig(radarAxis) { + var axisLabelPosition = radarAxis.axisLabelPosition, + animationCurve = radarAxis.animationCurve, + animationFrame = radarAxis.animationFrame, + rLevel = radarAxis.rLevel; + return axisLabelPosition.map(function (foo, i) { + return { + name: 'text', + index: rLevel, + visible: radarAxis.axisLabel.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: getAxisLableShape(radarAxis, i), + style: getAxisLableStyle(radarAxis, i) + }; + }); +} + +function getAxisLableShape(radarAxis, i) { + var axisLabelPosition = radarAxis.axisLabelPosition, + indicator = radarAxis.indicator; + return { + content: indicator[i].name, + position: axisLabelPosition[i] + }; +} + +function getAxisLableStyle(radarAxis, i) { + var axisLabel = radarAxis.axisLabel, + _radarAxis$centerPos = (0, _slicedToArray2["default"])(radarAxis.centerPos, 2), + x = _radarAxis$centerPos[0], + y = _radarAxis$centerPos[1], + axisLabelPosition = radarAxis.axisLabelPosition; + + var color = axisLabel.color, + style = axisLabel.style; + + var _axisLabelPosition$i = (0, _slicedToArray2["default"])(axisLabelPosition[i], 2), + labelXpos = _axisLabelPosition$i[0], + labelYPos = _axisLabelPosition$i[1]; + + var textAlign = labelXpos > x ? 'left' : 'right'; + var textBaseline = labelYPos > y ? 'top' : 'bottom'; + style = (0, _util2.deepMerge)({ + textAlign: textAlign, + textBaseline: textBaseline + }, style); + if (!color.length) return style; + var colorNum = color.length; + return (0, _util2.deepMerge)(style, { + fill: color[i % colorNum] + }); +} +},{"../class/updater.class":3,"../config/index":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render/lib/plugin/util":54}],27:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.title = title; + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); + +var _updater = require("../class/updater.class"); + +var _util = require("@jiaminghi/c-render/lib/plugin/util"); + +var _config = require("../config"); + +var _util2 = require("../util"); + +function title(chart) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var title = []; + + if (option.title) { + title[0] = (0, _util2.deepMerge)((0, _util.deepClone)(_config.titleConfig, true), option.title); + } + + (0, _updater.doUpdate)({ + chart: chart, + series: title, + key: 'title', + getGraphConfig: getTitleConfig + }); +} + +function getTitleConfig(titleItem, updater) { + var animationCurve = _config.titleConfig.animationCurve, + animationFrame = _config.titleConfig.animationFrame, + rLevel = _config.titleConfig.rLevel; + var shape = getTitleShape(titleItem, updater); + var style = getTitleStyle(titleItem); + return [{ + name: 'text', + index: rLevel, + visible: titleItem.show, + animationCurve: animationCurve, + animationFrame: animationFrame, + shape: shape, + style: style + }]; +} + +function getTitleShape(titleItem, updater) { + var offset = titleItem.offset, + text = titleItem.text; + var _updater$chart$gridAr = updater.chart.gridArea, + x = _updater$chart$gridAr.x, + y = _updater$chart$gridAr.y, + w = _updater$chart$gridAr.w; + + var _offset = (0, _slicedToArray2["default"])(offset, 2), + ox = _offset[0], + oy = _offset[1]; + + return { + content: text, + position: [x + w / 2 + ox, y + oy] + }; +} + +function getTitleStyle(titleItem) { + var style = titleItem.style; + return style; +} +},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@jiaminghi/c-render/lib/plugin/util":54}],28:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _cRender = require("@jiaminghi/c-render"); + +var _util = require("@jiaminghi/c-render/lib/plugin/util"); + +var _color = require("@jiaminghi/color"); + +var _index = require("../util/index"); + +var pie = { + shape: { + rx: 0, + ry: 0, + ir: 0, + or: 0, + startAngle: 0, + endAngle: 0, + clockWise: true + }, + validator: function validator(_ref) { + var shape = _ref.shape; + var keys = ['rx', 'ry', 'ir', 'or', 'startAngle', 'endAngle']; + + if (keys.find(function (key) { + return typeof shape[key] !== 'number'; + })) { + console.error('Pie shape configuration is abnormal!'); + return false; + } + + return true; + }, + draw: function draw(_ref2, _ref3) { + var ctx = _ref2.ctx; + var shape = _ref3.shape; + ctx.beginPath(); + var rx = shape.rx, + ry = shape.ry, + ir = shape.ir, + or = shape.or, + startAngle = shape.startAngle, + endAngle = shape.endAngle, + clockWise = shape.clockWise; + rx = parseInt(rx) + 0.5; + ry = parseInt(ry) + 0.5; + ctx.arc(rx, ry, ir > 0 ? ir : 0, startAngle, endAngle, !clockWise); + var connectPoint1 = (0, _util.getCircleRadianPoint)(rx, ry, or, endAngle).map(function (p) { + return parseInt(p) + 0.5; + }); + var connectPoint2 = (0, _util.getCircleRadianPoint)(rx, ry, ir, startAngle).map(function (p) { + return parseInt(p) + 0.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 - 0.001; + + for (var i = 0; i < gradientArcNum; i++) { + ctx.beginPath(); + var startPoint = (0, _util.getCircleRadianPoint)(rx, ry, r, startAngle + angleGap * i); + var endPoint = (0, _util.getCircleRadianPoint)(rx, ry, r, startAngle + angleGap * (i + 1)); + var color = (0, _index.getLinearGradientColor)(ctx, startPoint, endPoint, [gradient[i], gradient[i + 1]]); + var arcStartAngle = startAngle + angleGap * i; + var arcEndAngle = startAngle + angleGap * (i + 1); + var doBreak = false; + + if (arcEndAngle > endAngle) { + arcEndAngle = endAngle; + doBreak = true; + } + + ctx.arc(rx, ry, r, arcStartAngle, arcEndAngle); + ctx.strokeStyle = color; + ctx.stroke(); + if (doBreak) break; + } + } +}; +var numberText = { + shape: { + number: [], + content: '', + position: [0, 0], + toFixed: 0 + }, + validator: function validator(_ref7) { + var shape = _ref7.shape; + var number = shape.number, + content = shape.content, + position = shape.position; + + if (!(number instanceof Array) || typeof content !== 'string' || !(position instanceof Array)) { + console.error('NumberText shape configuration is abnormal!'); + return false; + } + + return true; + }, + draw: function draw(_ref8, _ref9) { + var ctx = _ref8.ctx; + var shape = _ref9.shape; + ctx.beginPath(); + var number = shape.number, + content = shape.content, + position = shape.position, + toFixed = shape.toFixed; + var textSegments = content.split('{nt}'); + var lastSegmentIndex = textSegments.length - 1; + var textString = ''; + textSegments.forEach(function (t, i) { + var currentNumber = number[i]; + if (i === lastSegmentIndex) currentNumber = ''; + if (typeof currentNumber === 'number') currentNumber = currentNumber.toFixed(toFixed); + textString += t + (currentNumber || ''); + }); + ctx.closePath(); + ctx.strokeText.apply(ctx, [textString].concat((0, _toConsumableArray2["default"])(position))); + ctx.fillText.apply(ctx, [textString].concat((0, _toConsumableArray2["default"])(position))); + } +}; +var lineIcon = { + shape: { + x: 0, + y: 0, + w: 0, + h: 0 + }, + validator: function validator(_ref10) { + var shape = _ref10.shape; + var x = shape.x, + y = shape.y, + w = shape.w, + h = shape.h; + + if (typeof x !== 'number' || typeof y !== 'number' || typeof w !== 'number' || typeof h !== 'number') { + console.error('lineIcon shape configuration is abnormal!'); + return false; + } + + return true; + }, + draw: function draw(_ref11, _ref12) { + var ctx = _ref11.ctx; + var shape = _ref12.shape; + ctx.beginPath(); + var x = shape.x, + y = shape.y, + w = shape.w, + h = shape.h; + var halfH = h / 2; + ctx.strokeStyle = ctx.fillStyle; + ctx.moveTo(x, y + halfH); + ctx.lineTo(x + w, y + halfH); + ctx.lineWidth = 1; + ctx.stroke(); + ctx.beginPath(); + var radius = halfH - 5 * 2; + if (radius <= 0) radius = 3; + ctx.arc(x + w / 2, y + halfH, radius, 0, Math.PI * 2); + ctx.lineWidth = 5; + ctx.stroke(); + ctx.fillStyle = '#fff'; + ctx.fill(); + }, + hoverCheck: function hoverCheck(position, _ref13) { + var shape = _ref13.shape; + var x = shape.x, + y = shape.y, + w = shape.w, + h = shape.h; + return (0, _util.checkPointIsInRect)(position, x, y, w, h); + }, + setGraphCenter: function setGraphCenter(e, _ref14) { + var shape = _ref14.shape, + style = _ref14.style; + var x = shape.x, + y = shape.y, + w = shape.w, + h = shape.h; + style.graphCenter = [x + w / 2, y + h / 2]; + } +}; +(0, _cRender.extendNewGraph)('pie', pie); +(0, _cRender.extendNewGraph)('agArc', agArc); +(0, _cRender.extendNewGraph)('numberText', numberText); +(0, _cRender.extendNewGraph)('lineIcon', lineIcon); +},{"../util/index":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],29:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "changeDefaultConfig", { + enumerable: true, + get: function get() { + return _config.changeDefaultConfig; + } +}); +exports["default"] = void 0; + +var _charts = _interopRequireDefault(require("./class/charts.class")); + +var _config = require("./config"); + +var _default = _charts["default"]; +exports["default"] = _default; +},{"./class/charts.class":2,"./config":9,"@babel/runtime/helpers/interopRequireDefault":36}],30:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.filterNonNumber = filterNonNumber; +exports.deepMerge = deepMerge; +exports.mulAdd = mulAdd; +exports.mergeSameStackData = mergeSameStackData; +exports.getTwoPointDistance = getTwoPointDistance; +exports.getLinearGradientColor = getLinearGradientColor; +exports.getPolylineLength = getPolylineLength; +exports.getPointToLineDistance = getPointToLineDistance; +exports.initNeedSeries = initNeedSeries; +exports.radianToAngle = radianToAngle; + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _util = require("@jiaminghi/c-render/lib/plugin/util"); + +function filterNonNumber(array) { + return array.filter(function (n) { + return typeof n === 'number'; + }); +} + +function deepMerge(target, merged) { + for (var key in merged) { + target[key] = target[key] && (0, _typeof2["default"])(target[key]) === 'object' ? deepMerge(target[key], merged[key]) : target[key] = merged[key]; + } + + return target; +} + +function mulAdd(nums) { + nums = filterNonNumber(nums); + return nums.reduce(function (all, num) { + return all + num; + }, 0); +} + +function mergeSameStackData(item, series) { + var stack = item.stack; + if (!stack) return (0, _toConsumableArray2["default"])(item.data); + var stacks = series.filter(function (_ref) { + var s = _ref.stack; + return s === stack; + }); + var index = stacks.findIndex(function (_ref2) { + var d = _ref2.data; + return d === item.data; + }); + var datas = stacks.splice(0, index + 1).map(function (_ref3) { + var data = _ref3.data; + return data; + }); + var dataLength = datas[0].length; + return new Array(dataLength).fill(0).map(function (foo, i) { + return mulAdd(datas.map(function (d) { + return d[i]; + })); + }); +} + +function getTwoPointDistance(pointOne, pointTwo) { + var minusX = Math.abs(pointOne[0] - pointTwo[0]); + var minusY = Math.abs(pointOne[1] - pointTwo[1]); + return Math.sqrt(minusX * minusX + minusY * minusY); +} + +function getLinearGradientColor(ctx, begin, end, color) { + if (!ctx || !begin || !end || !color.length) return; + var colors = color; + typeof colors === 'string' && (colors = [color, color]); + var linearGradientColor = ctx.createLinearGradient.apply(ctx, (0, _toConsumableArray2["default"])(begin).concat((0, _toConsumableArray2["default"])(end))); + var colorGap = 1 / (colors.length - 1); + colors.forEach(function (c, i) { + return linearGradientColor.addColorStop(colorGap * i, c); + }); + return linearGradientColor; +} + +function getPolylineLength(points) { + var lineSegments = new Array(points.length - 1).fill(0).map(function (foo, i) { + return [points[i], points[i + 1]]; + }); + var lengths = lineSegments.map(function (item) { + return getTwoPointDistance.apply(void 0, (0, _toConsumableArray2["default"])(item)); + }); + return mulAdd(lengths); +} + +function getPointToLineDistance(point, linePointOne, linePointTwo) { + var a = getTwoPointDistance(point, linePointOne); + var b = getTwoPointDistance(point, linePointTwo); + var c = getTwoPointDistance(linePointOne, linePointTwo); + return 0.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); i < arr.length; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } +} + +module.exports = _arrayWithoutHoles; +},{}],33:[function(require,module,exports){ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } +} + +function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + + _next(undefined); + }); + }; +} + +module.exports = _asyncToGenerator; +},{}],34:[function(require,module,exports){ +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +} + +module.exports = _classCallCheck; +},{}],35:[function(require,module,exports){ +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +module.exports = _defineProperty; +},{}],36:[function(require,module,exports){ +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} + +module.exports = _interopRequireDefault; +},{}],37:[function(require,module,exports){ +function _iterableToArray(iter) { + if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); +} + +module.exports = _iterableToArray; +},{}],38:[function(require,module,exports){ +function _iterableToArrayLimit(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; +} + +module.exports = _iterableToArrayLimit; +},{}],39:[function(require,module,exports){ +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); +} + +module.exports = _nonIterableRest; +},{}],40:[function(require,module,exports){ +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance"); +} + +module.exports = _nonIterableSpread; +},{}],41:[function(require,module,exports){ +var arrayWithHoles = require("./arrayWithHoles"); + +var iterableToArrayLimit = require("./iterableToArrayLimit"); + +var nonIterableRest = require("./nonIterableRest"); + +function _slicedToArray(arr, i) { + return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest(); +} + +module.exports = _slicedToArray; +},{"./arrayWithHoles":31,"./iterableToArrayLimit":38,"./nonIterableRest":39}],42:[function(require,module,exports){ +var arrayWithoutHoles = require("./arrayWithoutHoles"); + +var iterableToArray = require("./iterableToArray"); + +var nonIterableSpread = require("./nonIterableSpread"); + +function _toConsumableArray(arr) { + return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread(); +} + +module.exports = _toConsumableArray; +},{"./arrayWithoutHoles":32,"./iterableToArray":37,"./nonIterableSpread":40}],43:[function(require,module,exports){ +function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } + +function _typeof(obj) { + if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { + module.exports = _typeof = function _typeof(obj) { + return _typeof2(obj); + }; + } else { + module.exports = _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); + }; + } + + return _typeof(obj); +} + +module.exports = _typeof; +},{}],44:[function(require,module,exports){ +module.exports = require("regenerator-runtime"); + +},{"regenerator-runtime":59}],45:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.bezierCurveToPolyline = bezierCurveToPolyline; +exports.getBezierCurveLength = getBezierCurveLength; +exports["default"] = void 0; + +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var sqrt = Math.sqrt, + pow = Math.pow, + ceil = Math.ceil, + abs = Math.abs; // Initialize the number of points per curve + +var defaultSegmentPointsNum = 50; +/** + * @example data structure of bezierCurve + * bezierCurve = [ + * // Starting point of the curve + * [10, 10], + * // BezierCurve segment data (controlPoint1, controlPoint2, endPoint) + * [ + * [20, 20], [40, 20], [50, 10] + * ], + * ... + * ] + */ + +/** + * @description Abstract the curve as a polyline consisting of N points + * @param {Array} bezierCurve bezierCurve data + * @param {Number} precision calculation accuracy. Recommended for 1-20. Default = 5 + * @return {Object} Calculation results and related data + * @return {Array} Option.segmentPoints Point data that constitutes a polyline after calculation + * @return {Number} Option.cycles Number of iterations + * @return {Number} Option.rounds The number of recursions for the last iteration + */ + +function abstractBezierCurveToPolyline(bezierCurve) { + var precision = arguments.length > 1 && 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))); + }); // Initialize the curve to a polyline + + var segmentPointsNum = new Array(segmentsNum).fill(defaultSegmentPointsNum); + var segmentPoints = getSegmentPointsByNum(getSegmentTPointFuns, segmentPointsNum); // Calculate uniformly distributed points by iteratively + + var result = calcUniformPointsByIteration(segmentPoints, getSegmentTPointFuns, segments, precision); + result.segmentPoints.push(endPoint); + return result; +} +/** + * @description Generate a method for obtaining corresponding point by t according to curve data + * @param {Array} beginPoint BezierCurve begin point. [x, y] + * @param {Array} controlPoint1 BezierCurve controlPoint1. [x, y] + * @param {Array} controlPoint2 BezierCurve controlPoint2. [x, y] + * @param {Array} endPoint BezierCurve end point. [x, y] + * @return {Function} Expected function + */ + + +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]; + }; +} +/** + * @description Get the distance between two points + * @param {Array} point1 BezierCurve begin point. [x, y] + * @param {Array} point2 BezierCurve controlPoint1. [x, y] + * @return {Number} Expected distance + */ + + +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)); +} +/** + * @description Get the sum of the array of numbers + * @param {Array} nums An array of numbers + * @return {Number} Expected sum + */ + + +function getNumsSum(nums) { + return nums.reduce(function (sum, num) { + return sum + num; + }, 0); +} +/** + * @description Get the distance of multiple sets of points + * @param {Array} segmentPoints Multiple sets of point data + * @return {Array} Distance of multiple sets of point data + */ + + +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]); + }); + }); +} +/** + * @description Get the distance of multiple sets of points + * @param {Array} segmentPoints Multiple sets of point data + * @return {Array} Distance of multiple sets of point data + */ + + +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); + }); + }); +} +/** + * @description Get the sum of deviations between line segment and the average length + * @param {Array} segmentPointsDistance Segment length of polyline + * @param {Number} avgLength Average length of the line segment + * @return {Number} Deviations + */ + + +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); +} +/** + * @description Calculate uniformly distributed points by iteratively + * @param {Array} segmentPoints Multiple setd of points that make up a polyline + * @param {Array} getSegmentTPointFuns Functions of get a point on the curve with t + * @param {Array} segments BezierCurve data + * @param {Number} precision Calculation accuracy + * @return {Object} Calculation results and related data + * @return {Array} Option.segmentPoints Point data that constitutes a polyline after calculation + * @return {Number} Option.cycles Number of iterations + * @return {Number} Option.rounds The number of recursions for the last iteration + */ + + +function calcUniformPointsByIteration(segmentPoints, getSegmentTPointFuns, segments, precision) { + // The number of loops for the current iteration + var rounds = 4; // Number of iterations + + var cycles = 1; + + var _loop = function _loop() { + // Recalculate the number of points per curve based on the last iteration data + var totalPointsNum = segmentPoints.reduce(function (total, seg) { + return total + seg.length; + }, 0); // Add last points of segment to calc exact segment length + + 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; // Check if precision is reached + + 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); + }); // Calculate the points after redistribution + + 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; // Recursively for each segment of the polyline + + getSegmentTPointFuns.forEach(function (getSegmentTPointFun, i) { + var currentSegmentPointsNum = segmentPointsNum[i]; + var t = new Array(currentSegmentPointsNum).fill('').map(function (foo, j) { + return j / segmentPointsNum[i]; + }); // Repeated recursive offset + + for (var r = 0; r < rounds; r++) { + var distance = getSegmentPointsDistance([segmentPoints[i]])[0]; + var deviations = distance.map(function (d) { + return d - avgLength; + }); + var offset = 0; + + for (var j = 0; j < currentSegmentPointsNum; j++) { + if (j === 0) return; + offset += deviations[j - 1]; + t[j] -= stepSize * offset; + if (t[j] > 1) 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 + }; +} +/** + * @description Get the polyline corresponding to the Bezier curve + * @param {Array} bezierCurve BezierCurve data + * @param {Number} precision Calculation accuracy. Recommended for 1-20. Default = 5 + * @return {Array|Boolean} Point data that constitutes a polyline after calculation (Invalid input will return false) + */ + + +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; +} +/** + * @description Get the bezier curve length + * @param {Array} bezierCurve bezierCurve data + * @param {Number} precision calculation accuracy. Recommended for 5-10. Default = 5 + * @return {Number|Boolean} BezierCurve length (Invalid input will return false) + */ + + +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; // Calculate the total length of the points that make up the polyline + + + 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")); + +/** + * @description Abstract the polyline formed by N points into a set of bezier curve + * @param {Array} polyline A set of points that make up a polyline + * @param {Boolean} close Closed curve + * @param {Number} offsetA Smoothness + * @param {Number} offsetB Smoothness + * @return {Array|Boolean} A set of bezier curve (Invalid input will return false) + */ +function polylineToBezierCurve(polyline) { + var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var offsetA = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.25; + var offsetB = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.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; +} +/** + * @description Get the control points of the Bezier curve + * @param {Array} polyline A set of points that make up a polyline + * @param {Number} index The index of which get controls points's point in polyline + * @param {Boolean} close Closed curve + * @param {Number} offsetA Smoothness + * @param {Number} offsetB Smoothness + * @return {Array} Control points + */ + + +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] : 0.25; + var offsetB = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.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])]]; +} +/** + * @description Get the last curve of the closure + * @param {Array} bezierCurve A set of sub-curve + * @param {Array} startPoint Start point + * @return {Array} The last curve for closure + */ + + +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; +} +/** + * @description Get the symmetry point + * @param {Array} point Symmetric point + * @param {Array} centerPoint Symmetric center + * @return {Array} Symmetric point + */ + + +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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +/** + * @description Class of CRender + * @param {Object} canvas Canvas DOM + * @return {CRender} Instance of CRender + */ +var CRender = function CRender(canvas) { + (0, _classCallCheck2["default"])(this, CRender); + + if (!canvas) { + console.error('CRender Missing parameters!'); + return; + } + + var ctx = canvas.getContext('2d'); + var clientWidth = canvas.clientWidth, + clientHeight = canvas.clientHeight; + var area = [clientWidth, clientHeight]; + canvas.setAttribute('width', clientWidth); + canvas.setAttribute('height', clientHeight); + /** + * @description Context of the canvas + * @type {Object} + * @example ctx = canvas.getContext('2d') + */ + + this.ctx = ctx; + /** + * @description Width and height of the canvas + * @type {Array} + * @example area = [300,100] + */ + + this.area = area; + /** + * @description Whether render is in animation rendering + * @type {Boolean} + * @example animationStatus = true|false + */ + + this.animationStatus = false; + /** + * @description Added graph + * @type {[Graph]} + * @example graphs = [Graph, Graph, ...] + */ + + this.graphs = []; + /** + * @description Color plugin + * @type {Object} + * @link https://github.com/jiaming743/color + */ + + this.color = _color["default"]; + /** + * @description Bezier Curve plugin + * @type {Object} + * @link https://github.com/jiaming743/BezierCurve + */ + + this.bezierCurve = _bezierCurve["default"]; // bind event handler + + canvas.addEventListener('mousedown', mouseDown.bind(this)); + canvas.addEventListener('mousemove', mouseMove.bind(this)); + canvas.addEventListener('mouseup', mouseUp.bind(this)); +}; +/** + * @description Clear canvas drawing area + * @return {Undefined} Void + */ + + +exports["default"] = CRender; + +CRender.prototype.clearArea = function () { + var _this$ctx; + + var area = this.area; + + (_this$ctx = this.ctx).clearRect.apply(_this$ctx, [0, 0].concat((0, _toConsumableArray2["default"])(area))); +}; +/** + * @description Add graph to render + * @param {Object} config Graph configuration + * @return {Graph} Graph instance + */ + + +CRender.prototype.add = function () { + var config = arguments.length > 0 && 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; +}; +/** + * @description Sort the graph by index + * @return {Undefined} Void + */ + + +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.index < b.index) return -1; + }); +}; +/** + * @description Delete graph in render + * @param {Graph} graph The graph to be deleted + * @return {Undefined} Void + */ + + +CRender.prototype.delGraph = function (graph) { + if (typeof graph.delProcessor !== 'function') return; + graph.delProcessor(this); + this.graphs = this.graphs.filter(function (graph) { + return graph; + }); + this.drawAllGraph(); +}; +/** + * @description Delete all graph in render + * @return {Undefined} Void + */ + + +CRender.prototype.delAllGraph = function () { + var _this = this; + + this.graphs.forEach(function (graph) { + return graph.delProcessor(_this); + }); + this.graphs = this.graphs.filter(function (graph) { + return graph; + }); + this.drawAllGraph(); +}; +/** + * @description Draw all the graphs in the render + * @return {Undefined} Void + */ + + +CRender.prototype.drawAllGraph = function () { + var _this2 = this; + + this.clearArea(); + this.graphs.filter(function (graph) { + return graph && graph.visible; + }).forEach(function (graph) { + return graph.drawProcessor(_this2, graph); + }); +}; +/** + * @description Animate the graph whose animation queue is not empty + * and the animationPause is equal to false + * @return {Promise} Animation Promise + */ + + +CRender.prototype.launchAnimation = function () { + var _this3 = this; + + var animationStatus = this.animationStatus; + if (animationStatus) return; + this.animationStatus = true; + return new Promise(function (resolve) { + animation.call(_this3, function () { + _this3.animationStatus = false; + resolve(); + }, Date.now()); + }); +}; +/** + * @description Try to animate every graph + * @param {Function} callback Callback in animation end + * @param {Number} timeStamp Time stamp of animation start + * @return {Undefined} Void + */ + + +function animation(callback, timeStamp) { + var graphs = this.graphs; + + if (!animationAble(graphs)) { + callback(); + return; + } + + graphs.forEach(function (graph) { + return graph.turnNextAnimationFrame(timeStamp); + }); + this.drawAllGraph(); + requestAnimationFrame(animation.bind(this, callback, timeStamp)); +} +/** + * @description Find if there are graph that can be animated + * @param {[Graph]} graphs + * @return {Boolean} + */ + + +function animationAble(graphs) { + return graphs.find(function (graph) { + return !graph.animationPause && graph.animationFrameState.length; + }); +} +/** + * @description Handler of CRender mousedown event + * @return {Undefined} Void + */ + + +function mouseDown(e) { + var graphs = this.graphs; + var hoverGraph = graphs.find(function (graph) { + return graph.status === 'hover'; + }); + if (!hoverGraph) return; + hoverGraph.status = 'active'; +} +/** + * @description Handler of CRender mousemove event + * @return {Undefined} Void + */ + + +function mouseMove(e) { + var offsetX = e.offsetX, + offsetY = e.offsetY; + var position = [offsetX, offsetY]; + var graphs = this.graphs; + var activeGraph = graphs.find(function (graph) { + return graph.status === 'active' || graph.status === 'drag'; + }); + + if (activeGraph) { + if (!activeGraph.drag) return; + + if (typeof activeGraph.move !== 'function') { + console.error('No move method is provided, cannot be dragged!'); + return; + } + + activeGraph.moveProcessor(e); + activeGraph.status = 'drag'; + return; + } + + var hoverGraph = graphs.find(function (graph) { + return graph.status === 'hover'; + }); + var hoverAbleGraphs = graphs.filter(function (graph) { + return graph.hover && (typeof graph.hoverCheck === 'function' || graph.hoverRect); + }); + var hoveredGraph = hoverAbleGraphs.find(function (graph) { + return graph.hoverCheckProcessor(position, graph); + }); + + if (hoveredGraph) { + document.body.style.cursor = hoveredGraph.style.hoverCursor; + } else { + document.body.style.cursor = 'default'; + } + + var hoverGraphMouseOuterIsFun = false, + hoveredGraphMouseEnterIsFun = false; + if (hoverGraph) hoverGraphMouseOuterIsFun = typeof hoverGraph.mouseOuter === 'function'; + if (hoveredGraph) hoveredGraphMouseEnterIsFun = typeof hoveredGraph.mouseEnter === 'function'; + if (!hoveredGraph && !hoverGraph) return; + + if (!hoveredGraph && hoverGraph) { + if (hoverGraphMouseOuterIsFun) hoverGraph.mouseOuter(e, hoverGraph); + hoverGraph.status = 'static'; + return; + } + + if (hoveredGraph && hoveredGraph === hoverGraph) return; + + if (hoveredGraph && !hoverGraph) { + if (hoveredGraphMouseEnterIsFun) hoveredGraph.mouseEnter(e, hoveredGraph); + hoveredGraph.status = 'hover'; + return; + } + + if (hoveredGraph && hoverGraph && hoveredGraph !== hoverGraph) { + if (hoverGraphMouseOuterIsFun) hoverGraph.mouseOuter(e, hoverGraph); + hoverGraph.status = 'static'; + if (hoveredGraphMouseEnterIsFun) hoveredGraph.mouseEnter(e, hoveredGraph); + hoveredGraph.status = 'hover'; + } +} +/** + * @description Handler of CRender mouseup event + * @return {Undefined} Void + */ + + +function mouseUp(e) { + var graphs = this.graphs; + var activeGraph = graphs.find(function (graph) { + return graph.status === 'active'; + }); + var dragGraph = graphs.find(function (graph) { + return graph.status === 'drag'; + }); + if (activeGraph && typeof activeGraph.click === 'function') activeGraph.click(e, activeGraph); + graphs.forEach(function (graph) { + return graph && (graph.status = 'static'); + }); + if (activeGraph) activeGraph.status = 'hover'; + if (dragGraph) dragGraph.status = 'hover'; +} +/** + * @description Clone Graph + * @param {Graph} graph The target to be cloned + * @return {Graph} Cloned graph + */ + + +CRender.prototype.clone = function (graph) { + var style = graph.style.getStyle(); + + var clonedGraph = _objectSpread({}, graph, { + style: style + }); + + delete clonedGraph.render; + clonedGraph = (0, _util.deepClone)(clonedGraph, true); + return this.add(clonedGraph); +}; +},{"../config/graphs":51,"../plugin/util":54,"./graph.class":49,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/bezier-curve":47,"@jiaminghi/color":56}],49:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); + +var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); + +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); + +var _style = _interopRequireDefault(require("./style.class")); + +var _transition = _interopRequireDefault(require("@jiaminghi/transition")); + +var _util = require("../plugin/util"); + +/** + * @description Class Graph + * @param {Object} graph Graph default configuration + * @param {Object} config Graph config + * @return {Graph} Instance of Graph + */ +var Graph = function Graph(graph, config) { + (0, _classCallCheck2["default"])(this, Graph); + config = (0, _util.deepClone)(config, true); + var defaultConfig = { + /** + * @description Weather to render graph + * @type {Boolean} + * @default visible = true + */ + visible: true, + + /** + * @description Whether to enable drag + * @type {Boolean} + * @default drag = false + */ + drag: false, + + /** + * @description Whether to enable hover + * @type {Boolean} + * @default hover = false + */ + hover: false, + + /** + * @description Graph rendering index + * Give priority to index high graph in rendering + * @type {Number} + * @example index = 1 + */ + index: 1, + + /** + * @description Animation delay time(ms) + * @type {Number} + * @default animationDelay = 0 + */ + animationDelay: 0, + + /** + * @description Number of animation frames + * @type {Number} + * @default animationFrame = 30 + */ + animationFrame: 30, + + /** + * @description Animation dynamic curve (Supported by transition) + * @type {String} + * @default animationCurve = 'linear' + * @link https://github.com/jiaming743/Transition + */ + animationCurve: 'linear', + + /** + * @description Weather to pause graph animation + * @type {Boolean} + * @default animationPause = false + */ + animationPause: false, + + /** + * @description Rectangular hover detection zone + * Use this method for hover detection first + * @type {Null|Array} + * @default hoverRect = null + * @example hoverRect = [0, 0, 100, 100] // [Rect start x, y, Rect width, height] + */ + hoverRect: null, + + /** + * @description Mouse enter event handler + * @type {Function|Null} + * @default mouseEnter = null + */ + mouseEnter: null, + + /** + * @description Mouse outer event handler + * @type {Function|Null} + * @default mouseOuter = null + */ + mouseOuter: null, + + /** + * @description Mouse click event handler + * @type {Function|Null} + * @default click = null + */ + click: null + }; + var configAbleNot = { + status: 'static', + animationRoot: [], + animationKeys: [], + animationFrameState: [], + cache: {} + }; + if (!config.shape) config.shape = {}; + if (!config.style) config.style = {}; + var shape = Object.assign({}, graph.shape, config.shape); + Object.assign(defaultConfig, config, configAbleNot); + Object.assign(this, graph, defaultConfig); + this.shape = shape; + this.style = new _style["default"](config.style); + this.addedProcessor(); +}; +/** + * @description Processor of added + * @return {Undefined} Void + */ + + +exports["default"] = Graph; + +Graph.prototype.addedProcessor = function () { + if (typeof this.setGraphCenter === 'function') this.setGraphCenter(null, this); // The life cycle 'added" + + if (typeof this.added === 'function') this.added(this); +}; +/** + * @description Processor of draw + * @param {CRender} render Instance of CRender + * @param {Graph} graph Instance of Graph + * @return {Undefined} Void + */ + + +Graph.prototype.drawProcessor = function (render, graph) { + var ctx = render.ctx; + graph.style.initStyle(ctx); + if (typeof this.beforeDraw === 'function') this.beforeDraw(this, render); + graph.draw(render, graph); + if (typeof this.drawed === 'function') this.drawed(this, render); + graph.style.restoreTransform(ctx); +}; +/** + * @description Processor of hover check + * @param {Array} position Mouse Position + * @param {Graph} graph Instance of Graph + * @return {Boolean} Result of hover check + */ + + +Graph.prototype.hoverCheckProcessor = function (position, _ref) { + var hoverRect = _ref.hoverRect, + style = _ref.style, + hoverCheck = _ref.hoverCheck; + var graphCenter = style.graphCenter, + rotate = style.rotate, + scale = style.scale, + translate = style.translate; + + if (graphCenter) { + if (rotate) position = (0, _util.getRotatePointPos)(-rotate, position, graphCenter); + if (scale) position = (0, _util.getScalePointPos)(scale.map(function (s) { + return 1 / s; + }), position, graphCenter); + if (translate) position = (0, _util.getTranslatePointPos)(translate.map(function (v) { + return v * -1; + }), position); + } + + if (hoverRect) return _util.checkPointIsInRect.apply(void 0, [position].concat((0, _toConsumableArray2["default"])(hoverRect))); + return hoverCheck(position, this); +}; +/** + * @description Processor of move + * @param {Event} e Mouse movement event + * @return {Undefined} Void + */ + + +Graph.prototype.moveProcessor = function (e) { + this.move(e, this); + if (typeof this.beforeMove === 'function') this.beforeMove(e, this); + if (typeof this.setGraphCenter === 'function') this.setGraphCenter(e, this); + if (typeof this.moved === 'function') this.moved(e, this); +}; +/** + * @description Update graph state + * @param {String} attrName Updated attribute name + * @param {Any} change Updated value + * @return {Undefined} Void + */ + + +Graph.prototype.attr = function (attrName) { + var change = arguments.length > 1 && 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(); +}; +/** + * @description Update graphics state (with animation) + * Only shape and style attributes are supported + * @param {String} attrName Updated attribute name + * @param {Any} change Updated value + * @param {Boolean} wait Whether to store the animation waiting + * for the next animation request + * @return {Promise} Animation Promise + */ + + +Graph.prototype.animation = +/*#__PURE__*/ +function () { + var _ref2 = (0, _asyncToGenerator2["default"])( + /*#__PURE__*/ + _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( + /*#__PURE__*/ + function () { + var _ref3 = (0, _asyncToGenerator2["default"])( + /*#__PURE__*/ + _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); + }; +}(); +/** + * @description Extract the next frame of data from the animation queue + * and update the graph state + * @return {Undefined} Void + */ + + +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() - timeStamp < animationDelay) return; + animationRoot.forEach(function (root, i) { + animationKeys[i].forEach(function (key) { + root[key] = animationFrameState[i][0][key]; + }); + }); + animationFrameState.forEach(function (stateItem, i) { + stateItem.shift(); + var noFrame = stateItem.length === 0; + if (noFrame) animationRoot[i] = null; + if (noFrame) animationKeys[i] = null; + }); + this.animationFrameState = animationFrameState.filter(function (state) { + return state.length; + }); + this.animationRoot = animationRoot.filter(function (root) { + return root; + }); + this.animationKeys = animationKeys.filter(function (keys) { + return keys; + }); +}; +/** + * @description Skip to the last frame of animation + * @return {Undefined} Void + */ + + +Graph.prototype.animationEnd = function () { + var animationFrameState = this.animationFrameState, + animationKeys = this.animationKeys, + animationRoot = this.animationRoot, + render = this.render; + animationRoot.forEach(function (root, i) { + var currentKeys = animationKeys[i]; + var lastState = animationFrameState[i].pop(); + currentKeys.forEach(function (key) { + return root[key] = lastState[key]; + }); + }); + this.animationFrameState = []; + this.animationKeys = []; + this.animationRoot = []; + return render.drawAllGraph(); +}; +/** + * @description Pause animation behavior + * @return {Undefined} Void + */ + + +Graph.prototype.pauseAnimation = function () { + this.attr('animationPause', true); +}; +/** + * @description Try animation behavior + * @return {Undefined} Void + */ + + +Graph.prototype.playAnimation = function () { + var render = this.render; + this.attr('animationPause', false); + return new Promise( + /*#__PURE__*/ + function () { + var _ref4 = (0, _asyncToGenerator2["default"])( + /*#__PURE__*/ + _regenerator["default"].mark(function _callee3(resolve) { + return _regenerator["default"].wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return render.launchAnimation(); + + case 2: + resolve(); + + case 3: + case "end": + return _context3.stop(); + } + } + }, _callee3); + })); + + return function (_x4) { + return _ref4.apply(this, arguments); + }; + }()); +}; +/** + * @description Processor of delete + * @param {CRender} render Instance of CRender + * @return {Undefined} Void + */ + + +Graph.prototype.delProcessor = function (render) { + var _this = this; + + var graphs = render.graphs; + var index = graphs.findIndex(function (graph) { + return graph === _this; + }); + if (index === -1) return; + if (typeof this.beforeDelete === 'function') this.beforeDelete(this); + graphs.splice(index, 1, null); + if (typeof this.deleted === 'function') this.deleted(this); +}; +/** + * @description Return a timed release Promise + * @param {Number} time Release time + * @return {Promise} A timed release Promise + */ + + +function delay(time) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} +},{"../plugin/util":54,"./style.class":50,"@babel/runtime/helpers/asyncToGenerator":33,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@babel/runtime/regenerator":44,"@jiaminghi/transition":58}],50:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); + +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); + +var _color = require("@jiaminghi/color"); + +var _util = require("../plugin/util"); + +/** + * @description Class Style + * @param {Object} style Style configuration + * @return {Style} Instance of Style + */ +var Style = function Style(style) { + (0, _classCallCheck2["default"])(this, Style); + this.colorProcessor(style); + var defaultStyle = { + /** + * @description Rgba value of graph fill color + * @type {Array} + * @default fill = [0, 0, 0, 1] + */ + fill: [0, 0, 0, 1], + + /** + * @description Rgba value of graph stroke color + * @type {Array} + * @default stroke = [0, 0, 0, 1] + */ + stroke: [0, 0, 0, 0], + + /** + * @description Opacity of graph + * @type {Number} + * @default opacity = 1 + */ + opacity: 1, + + /** + * @description LineCap of Ctx + * @type {String} + * @default lineCap = null + * @example lineCap = 'butt'|'round'|'square' + */ + lineCap: null, + + /** + * @description Linejoin of Ctx + * @type {String} + * @default lineJoin = null + * @example lineJoin = 'round'|'bevel'|'miter' + */ + lineJoin: null, + + /** + * @description LineDash of Ctx + * @type {Array} + * @default lineDash = null + * @example lineDash = [10, 10] + */ + lineDash: null, + + /** + * @description LineDashOffset of Ctx + * @type {Number} + * @default lineDashOffset = null + * @example lineDashOffset = 10 + */ + lineDashOffset: null, + + /** + * @description ShadowBlur of Ctx + * @type {Number} + * @default shadowBlur = 0 + */ + shadowBlur: 0, + + /** + * @description Rgba value of graph shadow color + * @type {Array} + * @default shadowColor = [0, 0, 0, 0] + */ + shadowColor: [0, 0, 0, 0], + + /** + * @description ShadowOffsetX of Ctx + * @type {Number} + * @default shadowOffsetX = 0 + */ + shadowOffsetX: 0, + + /** + * @description ShadowOffsetY of Ctx + * @type {Number} + * @default shadowOffsetY = 0 + */ + shadowOffsetY: 0, + + /** + * @description LineWidth of Ctx + * @type {Number} + * @default lineWidth = 0 + */ + lineWidth: 0, + + /** + * @description Center point of the graph + * @type {Array} + * @default graphCenter = null + * @example graphCenter = [10, 10] + */ + graphCenter: null, + + /** + * @description Graph scale + * @type {Array} + * @default scale = null + * @example scale = [1.5, 1.5] + */ + scale: null, + + /** + * @description Graph rotation degree + * @type {Number} + * @default rotate = null + * @example rotate = 10 + */ + rotate: null, + + /** + * @description Graph translate distance + * @type {Array} + * @default translate = null + * @example translate = [10, 10] + */ + translate: null, + + /** + * @description Cursor status when hover + * @type {String} + * @default hoverCursor = 'pointer' + * @example hoverCursor = 'default'|'pointer'|'auto'|'crosshair'|'move'|'wait'|... + */ + hoverCursor: 'pointer', + + /** + * @description Font style of Ctx + * @type {String} + * @default fontStyle = 'normal' + * @example fontStyle = 'normal'|'italic'|'oblique' + */ + fontStyle: 'normal', + + /** + * @description Font varient of Ctx + * @type {String} + * @default fontVarient = 'normal' + * @example fontVarient = 'normal'|'small-caps' + */ + fontVarient: 'normal', + + /** + * @description Font weight of Ctx + * @type {String|Number} + * @default fontWeight = 'normal' + * @example fontWeight = 'normal'|'bold'|'bolder'|'lighter'|Number + */ + fontWeight: 'normal', + + /** + * @description Font size of Ctx + * @type {Number} + * @default fontSize = 10 + */ + fontSize: 10, + + /** + * @description Font family of Ctx + * @type {String} + * @default fontFamily = 'Arial' + */ + fontFamily: 'Arial', + + /** + * @description TextAlign of Ctx + * @type {String} + * @default textAlign = 'center' + * @example textAlign = 'start'|'end'|'left'|'right'|'center' + */ + textAlign: 'center', + + /** + * @description TextBaseline of Ctx + * @type {String} + * @default textBaseline = 'middle' + * @example textBaseline = 'top'|'bottom'|'middle'|'alphabetic'|'hanging' + */ + textBaseline: 'middle', + + /** + * @description The color used to create the gradient + * @type {Array} + * @default gradientColor = null + * @example gradientColor = ['#000', '#111', '#222'] + */ + gradientColor: null, + + /** + * @description Gradient type + * @type {String} + * @default gradientType = 'linear' + * @example gradientType = 'linear' | 'radial' + */ + gradientType: 'linear', + + /** + * @description Gradient params + * @type {Array} + * @default gradientParams = null + * @example gradientParams = [x0, y0, x1, y1] (Linear Gradient) + * @example gradientParams = [x0, y0, r0, x1, y1, r1] (Radial Gradient) + */ + gradientParams: null, + + /** + * @description When to use gradients + * @type {String} + * @default gradientWith = 'stroke' + * @example gradientWith = 'stroke' | 'fill' + */ + gradientWith: 'stroke', + + /** + * @description Gradient color stops + * @type {String} + * @default gradientStops = 'auto' + * @example gradientStops = 'auto' | [0, .2, .3, 1] + */ + gradientStops: 'auto', + + /** + * @description Extended color that supports animation transition + * @type {Array|Object} + * @default colors = null + * @example colors = ['#000', '#111', '#222', 'red' ] + * @example colors = { a: '#000', b: '#111' } + */ + colors: null + }; + Object.assign(this, defaultStyle, style); +}; +/** + * @description Set colors to rgba value + * @param {Object} style style config + * @param {Boolean} reverse Whether to perform reverse operation + * @return {Undefined} Void + */ + + +exports["default"] = Style; + +Style.prototype.colorProcessor = function (style) { + var reverse = arguments.length > 1 && 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]); + }); + } +}; +/** + * @description Init graph style + * @param {Object} ctx Context of canvas + * @return {Undefined} Void + */ + + +Style.prototype.initStyle = function (ctx) { + initTransform(ctx, this); + initGraphStyle(ctx, this); + initGradient(ctx, this); +}; +/** + * @description Init canvas transform + * @param {Object} ctx Context of canvas + * @param {Style} style Instance of Style + * @return {Undefined} Void + */ + + +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']; +/** + * @description Set the style of canvas ctx + * @param {Object} ctx Context of canvas + * @param {Style} style Instance of Style + * @return {Undefined} Void + */ + +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 : 0.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; +} +/** + * @description Set the gradient color of canvas ctx + * @param {Object} ctx Context of canvas + * @param {Style} style Instance of Style + * @return {Undefined} Void + */ + + +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; +} +/** + * @description Check if the gradient configuration is legal + * @param {Style} style Instance of Style + * @return {Boolean} Check Result + */ + + +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; +} +/** + * @description Get a uniform gradient color stop + * @param {Array} color Gradient color + * @return {Array} Gradient color stop + */ + + +function getAutoColorStops(color) { + var stopGap = 1 / (color.length - 1); + return color.map(function (foo, i) { + return stopGap * i; + }); +} +/** + * @description Restore canvas ctx transform + * @param {Object} ctx Context of canvas + * @return {Undefined} Void + */ + + +Style.prototype.restoreTransform = function (ctx) { + ctx.restore(); +}; +/** + * @description Update style data + * @param {Object} change Changed data + * @return {Undefined} Void + */ + + +Style.prototype.update = function (change) { + this.colorProcessor(change); + Object.assign(this, change); +}; +/** + * @description Get the current style configuration + * @return {Object} Style configuration + */ + + +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 : 0.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 : 0.01, vr > 0 ? vr : 0.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 : 0.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 : 0.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 : 0.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; +/** + * @description Extend new graph + * @param {String} name Name of Graph + * @param {Object} config Configuration of Graph + * @return {Undefined} Void + */ + +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")); + +/** + * @description Draw a polyline path + * @param {Object} ctx Canvas 2d context + * @param {Array} points The points that makes up a polyline + * @param {Boolean} beginPath Whether to execute beginPath + * @param {Boolean} closePath Whether to execute closePath + * @return {Undefined} Void + */ +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(); +} +/** + * @description Draw a bezier curve path + * @param {Object} ctx Canvas 2d context + * @param {Array} points The points that makes up a bezier curve + * @param {Array} moveTo The point need to excute moveTo + * @param {Boolean} beginPath Whether to execute beginPath + * @param {Boolean} closePath Whether to execute closePath + * @return {Undefined} Void + */ + + +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; +/** + * @description Clone an object or array + * @param {Object|Array} object Cloned object + * @param {Boolean} recursion Whether to use recursive cloning + * @return {Object|Array} Clone object + */ + +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; +} +/** + * @description Eliminate line blur due to 1px line width + * @param {Array} points Line points + * @return {Array} Line points after processed + */ + + +function eliminateBlur(points) { + return points.map(function (_ref) { + var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), + x = _ref2[0], + y = _ref2[1]; + + return [parseInt(x) + 0.5, parseInt(y) + 0.5]; + }); +} +/** + * @description Check if the point is inside the circle + * @param {Array} point Postion of point + * @param {Number} rx Circle x coordinate + * @param {Number} ry Circle y coordinate + * @param {Number} r Circle radius + * @return {Boolean} Result of check + */ + + +function checkPointIsInCircle(point, rx, ry, r) { + return getTwoPointDistance(point, [rx, ry]) <= r; +} +/** + * @description Get the distance between two points + * @param {Array} point1 point1 + * @param {Array} point2 point2 + * @return {Number} Distance between two points + */ + + +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); +} +/** + * @description Check if the point is inside the polygon + * @param {Array} point Postion of point + * @param {Array} points The points that makes up a polyline + * @return {Boolean} Result of check + */ + + +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; +} +/** + * @description Check if the point is inside the sector + * @param {Array} point Postion of point + * @param {Number} rx Sector x coordinate + * @param {Number} ry Sector y coordinate + * @param {Number} r Sector radius + * @param {Number} startAngle Sector start angle + * @param {Number} endAngle Sector end angle + * @param {Boolean} clockWise Whether the sector angle is clockwise + * @return {Boolean} Result of check + */ + + +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; +} +/** + * @description Determine if the point is in the clockwise direction of the vector + * @param {Array} vArm Vector + * @param {Array} vPoint Point + * @return {Boolean} Result of check + */ + + +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; +} +/** + * @description Check if the point is inside the polyline + * @param {Array} point Postion of point + * @param {Array} polyline The points that makes up a polyline + * @param {Number} lineWidth Polyline linewidth + * @return {Boolean} Result of check + */ + + +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); +} +/** + * @description Check if the point is inside the rect + * @param {Array} point Postion of point + * @param {Number} x Rect start x coordinate + * @param {Number} y Rect start y coordinate + * @param {Number} width Rect width + * @param {Number} height Rect height + * @return {Boolean} Result of check + */ + + +function checkPointIsInRect(_ref12, x, y, width, height) { + var _ref13 = (0, _slicedToArray2["default"])(_ref12, 2), + px = _ref13[0], + py = _ref13[1]; + + if (px < x) return false; + if (py < y) return false; + if (px > x + width) return false; + if (py > y + height) return false; + return true; +} +/** + * @description Get the coordinates of the rotated point + * @param {Number} rotate Degree of rotation + * @param {Array} point Postion of point + * @param {Array} origin Rotation center + * @param {Array} origin Rotation center + * @return {Number} Coordinates after rotation + */ + + +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]; +} +/** + * @description Get the coordinates of the scaled point + * @param {Array} scale Scale factor + * @param {Array} point Postion of point + * @param {Array} origin Scale center + * @return {Number} Coordinates after scale + */ + + +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]; +} +/** + * @description Get the coordinates of the scaled point + * @param {Array} translate Translation distance + * @param {Array} point Postion of point + * @return {Number} Coordinates after translation + */ + + +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]; +} +/** + * @description Get the distance from the point to the line + * @param {Array} point Postion of point + * @param {Array} lineBegin Line start position + * @param {Array} lineEnd Line end position + * @return {Number} Distance between point and line + */ + + +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; +} +/** + * @description Get the coordinates of the specified radian on the circle + * @param {Number} x Circle x coordinate + * @param {Number} y Circle y coordinate + * @param {Number} radius Circle radius + * @param {Number} radian Specfied radian + * @return {Array} Postion of point + */ + + +function getCircleRadianPoint(x, y, radius, radian) { + return [x + cos(radian) * radius, y + sin(radian) * radius]; +} +/** + * @description Get the points that make up a regular polygon + * @param {Number} x X coordinate of the polygon inscribed circle + * @param {Number} y Y coordinate of the polygon inscribed circle + * @param {Number} r Radius of the polygon inscribed circle + * @param {Number} side Side number + * @param {Number} minus Radian offset + * @return {Array} Points that make up a regular polygon + */ + + +function getRegularPolygonPoints(rx, ry, r, side) { + var minus = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : PI * -0.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)/; +/** + * @description Color validator + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @return {String|Boolean} Valid color Or false + */ + +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; +} +/** + * @description Get color by keyword + * @param {String} keyword Color keyword like red, green and etc. + * @return {String|Boolean} Hex or rgba color (Invalid keyword will return false) + */ + + +function getColorByKeyword(keyword) { + if (!keyword) { + console.error('getColorByKeywords: Missing parameters!'); + return false; + } + + if (!_keywords["default"].has(keyword)) return false; + return _keywords["default"].get(keyword); +} +/** + * @description Get the Rgb value of the color + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @return {Array|Boolean} Rgb value of the color (Invalid input will return false) + */ + + +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); +} +/** + * @description Get the rgb value of the hex color + * @param {String} color Hex color + * @return {Array} Rgb value of the color + */ + + +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])); + }); +} +/** + * @description Get the rgb value of the rgb/rgba color + * @param {String} color Hex color + * @return {Array} Rgb value of the color + */ + + +function getRgbValueFromRgb(color) { + return color.replace(/rgb\(|rgba\(|\)/g, '').split(',').slice(0, 3).map(function (n) { + return parseInt(n); + }); +} +/** + * @description Get the Rgba value of the color + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @return {Array|Boolean} Rgba value of the color (Invalid input will return false) + */ + + +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; +} +/** + * @description Get the opacity of color + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @return {Number|Boolean} Color opacity (Invalid input will return false) + */ + + +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, '')); +} +/** + * @description Convert color to Rgb|Rgba color + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @param {Number} opacity The opacity of color + * @return {String|Boolean} Rgb|Rgba color (Invalid input will return false) + */ + + +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(',') + ')'; +} +/** + * @description Convert color to Hex color + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @return {String|Boolean} Hex color (Invalid input will return false) + */ + + +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(''); +} +/** + * @description Get Color from Rgb|Rgba value + * @param {Array} value Rgb|Rgba color value + * @return {String|Boolean} Rgb|Rgba color (Invalid input will return false) + */ + + +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; +} +/** + * @description Deepen color + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @return {Number} Percent of Deepen (1-100) + * @return {String|Boolean} Rgba color (Invalid input will return false) + */ + + +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); +} +/** + * @description Brighten color + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @return {Number} Percent of brighten (1-100) + * @return {String|Boolean} Rgba color (Invalid input will return false) + */ + + +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); +} +/** + * @description Adjust color opacity + * @param {String} color Hex|Rgb|Rgba color or color keyword + * @param {Number} Percent of opacity + * @return {String|Boolean} Rgba color (Invalid input will return false) + */ + + +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], '', [0.33, 0.67]], [[1, 0], [0.67, 0.33]]]; +/** + * @description Sine + */ + +exports.linear = linear; +var easeInSine = [[[0, 1]], [[0.538, 0.564], [0.169, 0.912], [0.880, 0.196]], [[1, 0]]]; +exports.easeInSine = easeInSine; +var easeOutSine = [[[0, 1]], [[0.444, 0.448], [0.169, 0.736], [0.718, 0.16]], [[1, 0]]]; +exports.easeOutSine = easeOutSine; +var easeInOutSine = [[[0, 1]], [[0.5, 0.5], [0.2, 1], [0.8, 0]], [[1, 0]]]; +/** + * @description Quad + */ + +exports.easeInOutSine = easeInOutSine; +var easeInQuad = [[[0, 1]], [[0.550, 0.584], [0.231, 0.904], [0.868, 0.264]], [[1, 0]]]; +exports.easeInQuad = easeInQuad; +var easeOutQuad = [[[0, 1]], [[0.413, 0.428], [0.065, 0.816], [0.760, 0.04]], [[1, 0]]]; +exports.easeOutQuad = easeOutQuad; +var easeInOutQuad = [[[0, 1]], [[0.5, 0.5], [0.3, 0.9], [0.7, 0.1]], [[1, 0]]]; +/** + * @description Cubic + */ + +exports.easeInOutQuad = easeInOutQuad; +var easeInCubic = [[[0, 1]], [[0.679, 0.688], [0.366, 0.992], [0.992, 0.384]], [[1, 0]]]; +exports.easeInCubic = easeInCubic; +var easeOutCubic = [[[0, 1]], [[0.321, 0.312], [0.008, 0.616], [0.634, 0.008]], [[1, 0]]]; +exports.easeOutCubic = easeOutCubic; +var easeInOutCubic = [[[0, 1]], [[0.5, 0.5], [0.3, 1], [0.7, 0]], [[1, 0]]]; +/** + * @description Quart + */ + +exports.easeInOutCubic = easeInOutCubic; +var easeInQuart = [[[0, 1]], [[0.812, 0.74], [0.611, 0.988], [1.013, 0.492]], [[1, 0]]]; +exports.easeInQuart = easeInQuart; +var easeOutQuart = [[[0, 1]], [[0.152, 0.244], [0.001, 0.448], [0.285, -0.02]], [[1, 0]]]; +exports.easeOutQuart = easeOutQuart; +var easeInOutQuart = [[[0, 1]], [[0.5, 0.5], [0.4, 1], [0.6, 0]], [[1, 0]]]; +/** + * @description Quint + */ + +exports.easeInOutQuart = easeInOutQuart; +var easeInQuint = [[[0, 1]], [[0.857, 0.856], [0.714, 1], [1, 0.712]], [[1, 0]]]; +exports.easeInQuint = easeInQuint; +var easeOutQuint = [[[0, 1]], [[0.108, 0.2], [0.001, 0.4], [0.214, -0.012]], [[1, 0]]]; +exports.easeOutQuint = easeOutQuint; +var easeInOutQuint = [[[0, 1]], [[0.5, 0.5], [0.5, 1], [0.5, 0]], [[1, 0]]]; +/** + * @description Back + */ + +exports.easeInOutQuint = easeInOutQuint; +var easeInBack = [[[0, 1]], [[0.667, 0.896], [0.380, 1.184], [0.955, 0.616]], [[1, 0]]]; +exports.easeInBack = easeInBack; +var easeOutBack = [[[0, 1]], [[0.335, 0.028], [0.061, 0.22], [0.631, -0.18]], [[1, 0]]]; +exports.easeOutBack = easeOutBack; +var easeInOutBack = [[[0, 1]], [[0.5, 0.5], [0.4, 1.4], [0.6, -0.4]], [[1, 0]]]; +/** + * @description Elastic + */ + +exports.easeInOutBack = easeInOutBack; +var easeInElastic = [[[0, 1]], [[0.474, 0.964], [0.382, 0.988], [0.557, 0.952]], [[0.619, 1.076], [0.565, 1.088], [0.669, 1.08]], [[0.770, 0.916], [0.712, 0.924], [0.847, 0.904]], [[0.911, 1.304], [0.872, 1.316], [0.961, 1.34]], [[1, 0]]]; +exports.easeInElastic = easeInElastic; +var easeOutElastic = [[[0, 1]], [[0.073, -0.32], [0.034, -0.328], [0.104, -0.344]], [[0.191, 0.092], [0.110, 0.06], [0.256, 0.08]], [[0.310, -0.076], [0.260, -0.068], [0.357, -0.076]], [[0.432, 0.032], [0.362, 0.028], [0.683, -0.004]], [[1, 0]]]; +exports.easeOutElastic = easeOutElastic; +var easeInOutElastic = [[[0, 1]], [[0.210, 0.94], [0.167, 0.884], [0.252, 0.98]], [[0.299, 1.104], [0.256, 1.092], [0.347, 1.108]], [[0.5, 0.496], [0.451, 0.672], [0.548, 0.324]], [[0.696, -0.108], [0.652, -0.112], [0.741, -0.124]], [[0.805, 0.064], [0.756, 0.012], [0.866, 0.096]], [[1, 0]]]; +/** + * @description Bounce + */ + +exports.easeInOutElastic = easeInOutElastic; +var easeInBounce = [[[0, 1]], [[0.148, 1], [0.075, 0.868], [0.193, 0.848]], [[0.326, 1], [0.276, 0.836], [0.405, 0.712]], [[0.600, 1], [0.511, 0.708], [0.671, 0.348]], [[1, 0]]]; +exports.easeInBounce = easeInBounce; +var easeOutBounce = [[[0, 1]], [[0.357, 0.004], [0.270, 0.592], [0.376, 0.252]], [[0.604, -0.004], [0.548, 0.312], [0.669, 0.184]], [[0.820, 0], [0.749, 0.184], [0.905, 0.132]], [[1, 0]]]; +exports.easeOutBounce = easeOutBounce; +var easeInOutBounce = [[[0, 1]], [[0.102, 1], [0.050, 0.864], [0.117, 0.86]], [[0.216, 0.996], [0.208, 0.844], [0.227, 0.808]], [[0.347, 0.996], [0.343, 0.8], [0.480, 0.292]], [[0.635, 0.004], [0.511, 0.676], [0.656, 0.208]], [[0.787, 0], [0.760, 0.2], [0.795, 0.144]], [[0.905, -0.004], [0.899, 0.164], [0.944, 0.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'; +/** + * @description Get the N-frame animation state by the start and end state + * of the animation and the easing curve + * @param {String|Array} tBC Easing curve name or data + * @param {Number|Array|Object} startState Animation start state + * @param {Number|Array|Object} endState Animation end state + * @param {Number} frameNum Number of Animation frames + * @param {Boolean} deep Whether to use recursive mode + * @return {Array|Boolean} State of each frame of the animation (Invalid input will return false) + */ + +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 { + // Get the transition bezier curve + var bezierCurve = getBezierCurve(tBC); // Get the progress of each frame state + + var frameStateProgress = getFrameStateProgress(bezierCurve, frameNum); // If the recursion mode is not enabled or the state type is Number, the shallow state calculation is performed directly. + + 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]; + } +} +/** + * @description Check if the parameters are legal + * @param {String} tBC Name of transition bezier curve + * @param {Any} startState Transition start state + * @param {Any} endState Transition end state + * @param {Number} frameNum Number of transition frames + * @return {Boolean} Is the parameter legal + */ + + +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; +} +/** + * @description Get the transition bezier curve + * @param {String} tBC Name of transition bezier curve + * @return {Array} Bezier curve data + */ + + +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; +} +/** + * @description Get the progress of each frame state + * @param {Array} bezierCurve Transition bezier curve + * @param {Number} frameNum Number of transition frames + * @return {Array} Progress of each frame state + */ + + +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; +} +/** + * @description Get the progress of the corresponding frame according to t + * @param {Array} bezierCurve Transition bezier curve + * @param {Number} t Current frame t + * @return {Number} Progress of current frame + */ + + +function getFrameStateFromT(bezierCurve, t) { + var tBezierCurvePoint = getBezierCurvePointFromT(bezierCurve, t); + var bezierCurvePointT = getBezierCurvePointTFromReT(tBezierCurvePoint, t); + return getBezierCurveTState(tBezierCurvePoint, bezierCurvePointT); +} +/** + * @description Get the corresponding sub-curve according to t + * @param {Array} bezierCurve Transition bezier curve + * @param {Number} t Current frame t + * @return {Array} Sub-curve of t + */ + + +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 < nextMainPointX; + }); + var p0 = begin[0]; + var p1 = begin[2] || begin[0]; + var p2 = end[1] || end[0]; + var p3 = end[0]; + return [p0, p1, p2, p3]; +} +/** + * @description Get local t based on t and sub-curve + * @param {Array} bezierCurve Sub-curve + * @param {Number} t Current frame t + * @return {Number} local t of sub-curve + */ + + +function getBezierCurvePointTFromReT(bezierCurve, t) { + var reBeginX = bezierCurve[0][0]; + var reEndX = bezierCurve[3][0]; + var xMinus = reEndX - reBeginX; + var tMinus = t - reBeginX; + return tMinus / xMinus; +} +/** + * @description Get the curve progress of t + * @param {Array} bezierCurve Sub-curve + * @param {Number} t Current frame t + * @return {Number} Progress of current frame + */ + + +function getBezierCurveTState(_ref, t) { + var _ref2 = (0, _slicedToArray2["default"])(_ref, 4), + _ref2$ = (0, _slicedToArray2["default"])(_ref2[0], 2), + p0 = _ref2$[1], + _ref2$2 = (0, _slicedToArray2["default"])(_ref2[1], 2), + p1 = _ref2$2[1], + _ref2$3 = (0, _slicedToArray2["default"])(_ref2[2], 2), + p2 = _ref2$3[1], + _ref2$4 = (0, _slicedToArray2["default"])(_ref2[3], 2), + p3 = _ref2$4[1]; + + var pow = Math.pow; + var tMinus = 1 - t; + var result1 = p0 * pow(tMinus, 3); + var result2 = 3 * p1 * t * pow(tMinus, 2); + var result3 = 3 * p2 * pow(t, 2) * tMinus; + var result4 = p3 * pow(t, 3); + return 1 - (result1 + result2 + result3 + result4); +} +/** + * @description Get transition state according to frame progress + * @param {Any} startState Transition start state + * @param {Any} endState Transition end state + * @param {Array} frameState Frame state progress + * @return {Array} Transition frame state + */ + + +function getTransitionState(begin, end, frameState) { + var stateType = 'object'; + if (typeof begin === 'number') stateType = 'number'; + if (begin instanceof Array) stateType = 'array'; + if (stateType === 'number') return getNumberTransitionState(begin, end, frameState); + if (stateType === 'array') return getArrayTransitionState(begin, end, frameState); + if (stateType === 'object') return getObjectTransitionState(begin, end, frameState); + return frameState.map(function (t) { + return end; + }); +} +/** + * @description Get the transition data of the number type + * @param {Number} startState Transition start state + * @param {Number} endState Transition end state + * @param {Array} frameState Frame state progress + * @return {Array} Transition frame state + */ + + +function getNumberTransitionState(begin, end, frameState) { + var minus = end - begin; + return frameState.map(function (s) { + return begin + minus * s; + }); +} +/** + * @description Get the transition data of the array type + * @param {Array} startState Transition start state + * @param {Array} endState Transition end state + * @param {Array} frameState Frame state progress + * @return {Array} Transition frame state + */ + + +function getArrayTransitionState(begin, end, frameState) { + var minus = end.map(function (v, i) { + if (typeof v !== 'number') return false; + return v - begin[i]; + }); + return frameState.map(function (s) { + return minus.map(function (v, i) { + if (v === false) return end[i]; + return begin[i] + v * s; + }); + }); +} +/** + * @description Get the transition data of the object type + * @param {Object} startState Transition start state + * @param {Object} endState Transition end state + * @param {Array} frameState Frame state progress + * @return {Array} Transition frame state + */ + + +function getObjectTransitionState(begin, end, frameState) { + var keys = Object.keys(end); + var beginValue = keys.map(function (k) { + return begin[k]; + }); + var endValue = keys.map(function (k) { + return end[k]; + }); + var arrayState = getArrayTransitionState(beginValue, endValue, frameState); + return arrayState.map(function (item) { + var frameData = {}; + item.forEach(function (v, i) { + return frameData[keys[i]] = v; + }); + return frameData; + }); +} +/** + * @description Get the transition state data by recursion + * @param {Array|Object} startState Transition start state + * @param {Array|Object} endState Transition end state + * @param {Array} frameState Frame state progress + * @return {Array} Transition frame state + */ + + +function recursionTransitionState(begin, end, frameState) { + var state = getTransitionState(begin, end, frameState); + + var _loop = function _loop(key) { + var bTemp = begin[key]; + var eTemp = end[key]; + if ((0, _typeof2["default"])(eTemp) !== 'object') return "continue"; + var data = recursionTransitionState(bTemp, eTemp, frameState); + state.forEach(function (fs, i) { + return fs[key] = data[i]; + }); + }; + + for (var key in end) { + var _ret = _loop(key); + + if (_ret === "continue") continue; + } + + return state; +} +/** + * @description Inject new curve into curves as config + * @param {Any} key The key of curve + * @param {Array} curve Bezier curve data + * @return {Undefined} No return + */ + + +function injectNewCurve(key, curve) { + if (!key || !curve) { + console.error('InjectNewCurve Missing Parameters!'); + return; + } + + _curves["default"].set(key, curve); +} + +var _default = transition; +exports["default"] = _default; +},{"./config/curves":57,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/typeof":43}],59:[function(require,module,exports){ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +var runtime = (function (exports) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + exports.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + exports.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + exports.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + exports.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. + result.value = unwrapped; + resolve(result); + }, function(error) { + // If a rejected Promise was yielded, throw the rejection back + // into the async generator function so it can be handled there. + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + exports.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + exports.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return exports.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + // Note: ["return"] must be used for ES3 parsing compatibility. + if (delegate.iterator["return"]) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + exports.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + exports.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + 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 < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 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; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; + + // Regardless of whether this script is executing as a CommonJS module + // or not, return the runtime object so that we can declare the variable + // regeneratorRuntime in the outer scope, which allows this module to be + // injected easily by `bin/regenerator --include-runtime script.js`. + return exports; + +}( + // If this script is executing as a CommonJS module, use module.exports + // as the regeneratorRuntime namespace. Otherwise create a new empty + // object. Either way, the resulting object will be used to initialize + // the regeneratorRuntime variable at the top of this file. + typeof module === "object" ? module.exports : {} +)); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + // This module should not be running in strict mode, so the above + // assignment should always work unless something is misconfigured. Just + // in case runtime.js accidentally runs in strict mode, we can escape + // strict mode using a global Function call. This could conceivably fail + // if a Content Security Policy forbids using Function, but in that case + // the proper solution is to fix the accidental strict mode problem. If + // you've misconfigured your bundler to force strict mode and applied a + // CSP to forbid Function, and you're not willing to fix either of those + // problems, please detail your unique predicament in a GitHub issue. + Function("r", "regeneratorRuntime = r")(runtime); +} + +},{}]},{},[1]) +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9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Agc2hvdzogdHJ1ZSxcblxuICAgIC8qKlxyXG4gICAgICogQGRlc2NyaXB0aW9uIFBvaW50IHJhZGl1c1xyXG4gICAgICogQHR5cGUge051bWJlcn1cclxuICAgICAqIEBkZWZhdWx0IHJhZGl1cyA9IDJcclxuICAgICAqL1xuICAgIHJhZGl1czogMixcblxuICAgIC8qKlxyXG4gICAgICogQGRlc2NyaXB0aW9uIFJhZGFyIHBvaW50IGRlZmF1bHQgc3R5bGUgY29uZmlndXJhdGlvblxyXG4gICAgICogQHR5cGUge09iamVjdH1cclxuICAgICAqIEBkZWZhdWx0IHN0eWxlID0ge0NvbmZpZ3VyYXRpb24gT2YgQ2xhc3MgU3R5bGV9XHJcbiAgICAgKi9cbiAgICBzdHlsZToge1xuICAgICAgZmlsbDogJyNmZmYnXG4gICAgfVxuICB9LFxuXG4gIC8qKlxyXG4gICAqIEBkZXNjcmlwdGlvbiBSYWRhciBsYWJlbCBjb25maWd1cmF0aW9uXHJcbiAgICogQHR5cGUge09iamVjdH1cclxuICAgKi9cbiAgbGFiZWw6IHtcbiAgICAvKipcclxuICAgICAqIEBkZXNjcmlwdGlvbiBXaGV0aGVyIHRvIGRpc3BsYXkgcmFkYXIgbGFiZWxcclxuICAgICAqIEB0eXBlIHtCb29sZWFufVxyXG4gICAgICogQGRlZmF1bHQgc2hvdyA9IHRydWVcclxuICAgICAqL1xuICAgIHNob3c6IHRydWUsXG5cbiAgICAvKipcclxuICAgICAqIEBkZXNjcmlwdGlvbiBMYWJlbCBwb3NpdGlvbiBvZmZzZXRcclxuICAgICAqIEB0eXBlIHtBcnJheX1cclxuICAgICAqIEBkZWZhdWx0IG9mZnNldCA9IFswLCAwXVxyXG4gICAgICovXG4gICAgb2Zmc2V0OiBbMCwgMF0sXG5cbiAgICAvKipcclxuICAgICAqIEBkZXNjcmlwdGlvbiBMYWJlbCBnYXAgYmV0d2VlbiBsYWJlbCBhbmQgcmFkYXJcclxuICAgICAqIEB0eXBlIHtOdW1iZXJ9X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TdGF0ZSA9ICgwLCBfdHJhbnNpdGlvbltcImRlZmF1bHRcIl0pKGFuaW1hdGlvbkN1cnZlLCBiZWZvcmVTdGF0ZSwgY2hhbmdlLCBhbmltYXRpb25GcmFtZSwgdHJ1ZSk7XG4gICAgICAgICAgICB0aGlzLmFuaW1hdGlvblJvb3QucHVzaChjaGFuZ2VSb290KTtcbiAgICAgICAgICAgIHRoaXMuYW5pbWF0aW9uS2V5cy5wdXNoKGNoYW5nZUtleXMpO1xuICAgICAgICAgICAgdGhpcy5hbmltYXRpb25GcmFtZVN0YXRlLnB1c2goYW5pbWF0aW9uRnJhbWVTdGF0ZSk7XG5cbiAgICAgICAgICAgIGlmICghd2FpdCkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDE3O1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIF9jb250ZXh0Mi5hYnJ1cHQoXCJyZXR1cm5cIik7XG5cbiAgICAgICAgICBjYXNlIDE3OlxuICAgICAgICAgICAgaWYgKCEoYW5pbWF0aW9uRGVsYXkgPiAwKSkge1xuICAgICAgICAgICAgICBfY29udGV4dDIubmV4dCA9IDIwO1xuICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgX2NvbnRleHQyLm5leHQgPSAyMDtcbiAgICAgICAgICAgIHJldHVybiBkZWxheShhbmltYXRpb25EZWxheSk7XG5cbiAgICAgICAgICBjYXNlIDIwOlxuICAgICAgICAgICAgcmVuZGVyID0gdGhpcy5yZW5kZXI7XG4gICAgICAgICAgICByZXR1cm4gX2NvbnRleHQyLmFicnVwdChcInJldHVyblwiLCBuZXcgUHJvbWlzZShcbiAgICAgICAgICAgIC8qI19fUFVSRV9fKi9cbiAgICAgICAgICAgIGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgICAgdmFyIF9yZWYzID0gKDAsIF9hc3luY1RvR2VuZXJhdG9yMltcImRlZmF1bHRcIl0pKFxuICAgICAgICAgICAgICAvKiNfX1BVUkVfXyovXG4gICAgICAgICAgICAgIF9yZWdlbmVyYXRvcltcImRlZmF1bHRcIl0ubWFyayhmdW5jdGlvbiBfY2FsbGVlKHJlc29sdmUpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gX3JlZ2VuZXJhdG9yW1wiZGVmYXVsdFwiXS53cmFwKGZ1bmN0aW9uIF9jYWxsZWUkKF9jb250ZXh0KSB7XG4gICAgICAgICAgICAgICAgICB3aGlsZSAoMSkge1xuICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKF9jb250ZXh0LnByZXYgPSBfY29udGV4dC5uZXh0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgY2FzZSAwOlxuICAgICAgICAgICAgICAgICAgICAgICAgX2NvbnRleHQubmV4dCA9IDI7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmVuZGVyLmxhdW5jaEFuaW1hdGlvbigpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXCJlbmRcIjpcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBfY29udGV4dC5zdG9wKCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LCBfY2FsbGVlKTtcbiAgICAgICAgICAgICAgfSkpO1xuXG4gICAgICAgICAgICAgIHJldHVybiBmdW5jdGlvbiAoX3gzKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9yZWYzLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9KCkpKTtcblxuICAgICAgICAgIGNhc2UgMjI6XG4gICAgICAgICAgY2FzZSBcImVuZFw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uICAgICAgICByZWplY3QocmVjb3JkLmFyZyk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB2YXIgcmVzdWx0ID0gcmVjb3JkLmFyZztcbiAgICAgICAgdmFyIHZhbHVlID0gcmVzdWx0LnZhbHVlO1xuICAgICAgICBpZiAodmFsdWUgJiZcbiAgICAgICAgICAgIHR5cGVvZiB2YWx1ZSA9PT0gXCJvYmplY3RcIiAmJlxuICAgICAgICAgICAgaGFzT3duLmNhbGwodmFsdWUsIFwiX19hd2FpdFwiKSkge1xuICAgICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUodmFsdWUuX19hd2FpdCkudGhlbihmdW5jdGlvbih2YWx1ZSkge1xuICAgICAgICAgICAgaW52b2tlKFwibmV4dFwiLCB2YWx1ZSwgcmVzb2x2ZSwgcmVqZWN0KTtcbiAgICAgICAgICB9LCBmdW5jdGlvbihlcnIpIHtcbiAgICAgICAgICAgIGludm9rZShcInRocm93XCIsIGVyciwgcmVzb2x2ZSwgcmVqZWN0KTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUodmFsdWUpLnRoZW4oZnVuY3Rpb24odW53cmFwcGVkKSB7XG4gICAgICAgICAgLy8gV2hlbiBhIHlpZWxkZWQgUHJvbWlzZSBpcyByZXNvbHZlZCwgaXRzIGZpbmFsIHZhbHVlIGJlY29tZXNcbiAgICAgICAgICAvLyB0aGUgLnZhbHVlIG9mIHRoZSBQcm9taXNlPHt2YWx1ZSxkb25lfT4gcmVzdWx0IGZvciB0aGVcbiAgICAgICAgICAvLyBjdXJyZW50IGl0ZXJhdGlvbi5cbiAgICAgICAgICByZXN1bHQudmFsdWUgPSB1bndyYXBwZWQ7XG4gICAgICAgICAgcmVzb2x2ZShyZXN1bHQpO1xuICAgICAgICB9LCBmdW5jdGlvbihlcnJvcikge1xuICAgICAgICAgIC8vIElmIGEgcmVqZWN0ZWQgUHJvbWlzZSB3YXMgeW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Xh0LmRlbGVnYXRlO1xuICAgICAgICBpZiAoZGVsZWdhdGUpIHtcbiAgICAgICAgICB2YXIgZGVsZWdhdGVSZXN1bHQgPSBtYXliZUludm9rZURlbGVnYXRlKGRlbGVnYXRlLCBjb250ZXh0KTtcbiAgICAgICAgICBpZiAoZGVsZWdhdGVSZXN1bHQpIHtcbiAgICAgICAgICAgIGlmIChkZWxlZ2F0ZVJlc3VsdCA9PT0gQ29udGludWVTZW50aW5lbCkgY29udGludWU7XG4gICAgICAgICAgICByZXR1cm4gZGVsZWdhdGVSZXN1bHQ7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGNvbnRleHQubWV0aG9kID09PSBcIm5leHRcIikge1xuICAgICAgICAgIC8vIFNldHRpbmcgY29udGV4dC5fc2VudCBmb3IgbGVnYWN5IHN1cHBvcnQgb2YgQmFiZWwnc1xuICAgICAgICAgIC8vIGZ1bmN0aW9uLnNlbnQgaW1wbGVtZW50YXRpb24uXG4gICAgICAgICAgY29udGV4dC5zZW50ID0gY29udGV4dC5fc2VudCA9IGNvbnRleHQuYXJnO1xuXG4gICAgICAgIH0gZWxzZSBpZiAoY29udGV4dC5tZXRob2QgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIGlmIChzdGF0ZSA9PT0gR2VuU3RhdGVTdXNwZW5kZWRTdGFydCkge1xuICAgICAgICAgICAgc3RhdGUgPSBHZW5TdGF0ZUNvbXBsZXRlZDtcbiAgICAgICAgICAgIHRocm93IGNvbnRleHQuYXJnO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpO1xuXG4gICAgICAgIH0gZWxzZSBpZiAoY29udGV4dC5tZXRob2QgPT09IFwicmV0dXJuXCIpIHtcbiAgICAgICAgICBjb250ZXh0LmFicnVwdChcInJldHVyblwiLCBjb250ZXh0LmFyZyk7XG4gICAgICAgIH1cblxuICAgICAgICBzdGF0ZSA9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UgZnVuY3Rpb24gdG9cbiAgICAgICAgICAvLyB0aHJvdyB0aGUgZXhjZXB0aW9uLlxuICAgICAgICAgIHJldHVybiBoYW5kbGUoXCJlbmRcIik7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoZW50cnkudHJ5TG9jIDw9IHRoaXMucHJldikge1xuICAgICAgICAgIHZhciBoYXNDYXRjaCA9IGhhc093bi5jYWxsKGVudHJ5LCBcImNhdGNoTG9jXCIpO1xuICAgICAgICAgIHZhciBoYXNGaW5hbGx5ID0gaGFzT3duLmNhbGwoZW50cnksIFwiZmluYWxseUxvY1wiKTtcblxuICAgICAgICAgIGlmIChoYXNDYXRjaCAmJiBoYXNGaW5hbGx5KSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5maW5hbGx5TG9jKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSBpZiAoaGFzQ2F0Y2gpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5jYXRjaExvYykge1xuICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlKGVudHJ5LmNhdGNoTG9jLCB0cnVlKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSBpZiAoaGFzRmluYWxseSkge1xuICAgICAgICAgICAgaWYgKHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5maW5hbGx5TG9jKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICA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maW5hbGx5RW50cnkuY29tcGxldGlvbiA6IHt9O1xuICAgICAgcmVjb3JkLnR5cGUgPSB0eXBlO1xuICAgICAgcmVjb3JkLmFyZyA9IGFyZztcblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSkge1xuICAgICAgICB0aGlzLm1ldGhvZCA9IFwibmV4dFwiO1xuICAgICAgICB0aGlzLm5leHQgPSBmaW5hbGx5RW50cnkuZmluYWxseUxvYztcbiAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiB0aGlzLmNvbXBsZXRlKHJlY29yZCk7XG4gICAgfSxcblxuICAgIGNvbXBsZXRlOiBmdW5jdGlvbihyZWNvcmQsIGFmdGVyTG9jKSB7XG4gICAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgICB0aHJvdyByZWNvcmQuYXJnO1xuICAgICAgfVxuXG4gICAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwiYnJlYWtcIiB8fFxuICAgICAgICAgIHJlY29yZC50eXBlID09PSBcImNvbnRpbnVlXCIpIHtcbiAgICAgICAgdGhpcy5uZXh0ID0gcmVjb3JkLmFyZztcbiAgICAgIH0gZWxzZSBpZiAocmVjb3JkLnR5cGUgPT09IFwicmV0dXJuXCIpIHtcbiAgICAgICAgdGhpcy5ydmFsID0gdGhpcy5hcmcgPSByZWNvcmQuYXJnO1xuICAgICAgICB0aGlzLm1ldGhvZCA9IFwicmV0dXJuXCI7XG4gICAgICAgIHRoaXMubmV4dCA9IFwiZW5kXCI7XG4gICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcIm5vcm1hbFwiICYmIGFmdGVyTG9jKSB7XG4gICAgICAgIHRoaXMubmV4dCA9IGFmdGVyTG9jO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gQ29udGludWVTZW50aW5lbDtcbiAgICB9LFxuXG4gICAgZmluaXNoOiBmdW5jdGlvbihmaW5hbGx5TG9jKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LmZpbmFsbHlMb2MgPT09IGZpbmFsbHlMb2MpIHtcbiAgICAgICAgICB0aGlzLmNvbXBsZXRlKGVudHJ5LmNvbXBsZXRpb24sIGVudHJ5LmFmdGVyTG9jKTtcbiAgICAgICAgICByZXNldFRyeUVudHJ5KGVudHJ5KTtcbiAgICAgICAgICByZXR1cm4gQ29udGludWVTZW50aW5lbDtcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH0sXG5cbiAgICBcImNhdGNoXCI6IGZ1bmN0aW9uKHRyeUxvYykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS50cnlMb2MgPT09IHRyeUxvYykge1xuICAgICAgICAgIHZhciByZWNvcmQgPSBlbnRyeS5jb21wbGV0aW9uO1xuICAgICAgICAgIGlmIChyZWNvcmQudHlwZSA9PT0gXCJ0aHJvd1wiKSB7XG4gICAgICAgICAgICB2YXIgdGhyb3duID0gcmVjb3JkLmFyZztcbiAgICAgICAgICAgIHJlc2V0VHJ5RW50cnkoZW50cnkpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4gdGhyb3duO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIFRoZSBjb250ZXh0LmNhdGNoIG1ldGhvZCBtdXN0IG9ubHkgYmUgY2FsbGVkIHdpdGggYSBsb2NhdGlvblxuICAgICAgLy8gYXJndW1lbnQgdGhhdCBjb3JyZXNwb25kcyB0byBhIGtub3duIGNhdGNoIGJsb2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pb24sIGJ1dCBpbiB0aGF0IGNhc2VcbiAgLy8gdGhlIHByb3BlciBzb2x1dGlvbiBpcyB0byBmaXggdGhlIGFjY2lkZW50YWwgc3RyaWN0IG1vZGUgcHJvYmxlbS4gSWZcbiAgLy8geW91J3ZlIG1pc2NvbmZpZ3VyZWQgeW91ciBidW5kbGVyIHRvIGZvcmNlIHN0cmljdCBtb2RlIGFuZCBhcHBsaWVkIGFcbiAgLy8gQ1NQIHRvIGZvcmJpZCBGdW5jdGlvbiwgYW5kIHlvdSdyZSBub3Qgd2lsbGluZyB0byBmaXggZWl0aGVyIG9mIHRob3NlXG4gIC8vIHByb2JsZW1zLCBwbGVhc2UgZGV0YWlsIHlvdXIgdW5pcXVlIHByZWRpY2FtZW50IGluIGEgR2l0SHViIGlzc3VlLlxuICBGdW5jdGlvbihcInJcIiwgXCJyZWdlbmVyYXRvclJ1bnRpbWUgPSByXCIpKHJ1bnRpbWUpO1xufVxuIl19 diff --git a/dist/charts.min.js b/dist/charts.min.js new file mode 100644 index 0000000..8171d09 --- /dev/null +++ b/dist/charts.min.js @@ -0,0 +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;ineedGraphNum){var needDelGraphs=graphs.splice(needGraphNum);needDelGraphs.forEach(function(item){return item.forEach(function(g){return render.delGraph(g)})})}}function changeGraphs(cache,seriesItem,i,updater){var getGraphConfig=updater.getGraphConfig,render=updater.chart.render,beforeChange=updater.beforeChange;var configs=getGraphConfig(seriesItem,updater);balanceGraphsNum(cache,configs,render);cache.forEach(function(graph,j){var config=configs[j];if(typeof beforeChange==="function")beforeChange(graph,config);updateGraphConfigByKey(graph,config)})}function balanceGraphsNum(graphs,graphConfig,render){var cacheGraphNum=graphs.length;var needGraphNum=graphConfig.length;if(needGraphNum>cacheGraphNum){var lastCacheGraph=graphs.slice(-1)[0];var needAddGraphNum=needGraphNum-cacheGraphNum;var needAddGraphs=new Array(needAddGraphNum).fill(0).map(function(foo){return render.clone(lastCacheGraph)});graphs.push.apply(graphs,(0,_toConsumableArray2["default"])(needAddGraphs))}else if(needGraphNum0&&arguments[0]!==undefined?arguments[0]:{},chart=_ref.chart,series=_ref.series,key=_ref.key,getGraphConfig=_ref.getGraphConfig,getStartGraphConfig=_ref.getStartGraphConfig,beforeChange=_ref.beforeChange,beforeUpdate=_ref.beforeUpdate,afterAddGraph=_ref.afterAddGraph;if(chart[key]){chart[key].update(series)}else{chart[key]=new Updater({chart:chart,key:key,getGraphConfig:getGraphConfig,getStartGraphConfig:getStartGraphConfig,beforeChange:beforeChange,beforeUpdate:beforeUpdate,afterAddGraph:afterAddGraph},series)}}},{"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.yAxisConfig=exports.xAxisConfig=void 0;var xAxisConfig={name:"",show:true,position:"bottom",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:false,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.xAxisConfig=xAxisConfig;var yAxisConfig={name:"",show:true,position:"left",nameGap:15,nameLocation:"end",nameTextStyle:{fill:"#333",fontSize:10},min:"20%",max:"20%",interval:null,minInterval:null,maxInterval:null,boundaryGap:null,splitNumber:5,axisLine:{show:true,style:{stroke:"#333",lineWidth:1}},axisTick:{show:true,style:{stroke:"#333",lineWidth:1}},axisLabel:{show:true,formatter:null,style:{fill:"#333",fontSize:10,rotate:0}},splitLine:{show:true,style:{stroke:"#d4d4d4",lineWidth:1}},rLevel:-20,animationCurve:"easeOutCubic",animationFrame:50};exports.yAxisConfig=yAxisConfig},{}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.barConfig=void 0;var barConfig={show:true,name:"",stack:"",shapeType:"normal",echelonOffset:10,barWidth:"auto",barGap:"30%",barCategoryGap:"20%",xAxisIndex:0,yAxisIndex:0,data:[],backgroundBar:{show:false,width:"auto",style:{fill:"rgba(200, 200, 200, .4)"}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},gradient:{color:[],local:true},barStyle:{},rLevel:0,animationCurve:"easeOutCubic",animationFrame:50};exports.barConfig=barConfig},{}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.colorConfig=void 0;var colorConfig=["#37a2da","#32c5e9","#67e0e3","#9fe6b8","#ffdb5c","#ff9f7f","#fb7293","#e062ae","#e690d1","#e7bcf3","#9d96f5","#8378ea","#96bfff"];exports.colorConfig=colorConfig},{}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gaugeConfig=void 0;var gaugeConfig={show:true,name:"",radius:"60%",center:["50%","50%"],startAngle:-(Math.PI/4)*5,endAngle:Math.PI/4,min:0,max:100,splitNum:5,arcLineWidth:15,data:[],dataItemStyle:{},axisTick:{show:true,tickLength:6,style:{stroke:"#999",lineWidth:1}},axisLabel:{show:true,data:[],formatter:null,labelGap:5,style:{}},pointer:{show:true,valueIndex:0,style:{scale:[1,1],fill:"#fb7293"}},details:{show:false,formatter:null,offset:[0,0],valueToFixed:0,position:"center",style:{fontSize:20,fontWeight:"bold",textAlign:"center",textBaseline:"middle"}},backgroundArc:{show:true,style:{stroke:"#e0e0e0"}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.gaugeConfig=gaugeConfig},{}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.gridConfig=void 0;var gridConfig={left:"10%",right:"10%",top:60,bottom:60,style:{fill:"rgba(0, 0, 0, 0)"},rLevel:-30,animationCurve:"easeOutCubic",animationFrame:30};exports.gridConfig=gridConfig},{}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.changeDefaultConfig=changeDefaultConfig;Object.defineProperty(exports,"colorConfig",{enumerable:true,get:function get(){return _color.colorConfig}});Object.defineProperty(exports,"gridConfig",{enumerable:true,get:function get(){return _grid.gridConfig}});Object.defineProperty(exports,"xAxisConfig",{enumerable:true,get:function get(){return _axis.xAxisConfig}});Object.defineProperty(exports,"yAxisConfig",{enumerable:true,get:function get(){return _axis.yAxisConfig}});Object.defineProperty(exports,"titleConfig",{enumerable:true,get:function get(){return _title.titleConfig}});Object.defineProperty(exports,"lineConfig",{enumerable:true,get:function get(){return _line.lineConfig}});Object.defineProperty(exports,"barConfig",{enumerable:true,get:function get(){return _bar.barConfig}});Object.defineProperty(exports,"pieConfig",{enumerable:true,get:function get(){return _pie.pieConfig}});Object.defineProperty(exports,"radarAxisConfig",{enumerable:true,get:function get(){return _radarAxis.radarAxisConfig}});Object.defineProperty(exports,"radarConfig",{enumerable:true,get:function get(){return _radar.radarConfig}});Object.defineProperty(exports,"gaugeConfig",{enumerable:true,get:function get(){return _gauge.gaugeConfig}});Object.defineProperty(exports,"legendConfig",{enumerable:true,get:function get(){return _legend.legendConfig}});exports.keys=void 0;var _color=require("./color");var _grid=require("./grid");var _axis=require("./axis");var _title=require("./title");var _line=require("./line");var _bar=require("./bar");var _pie=require("./pie");var _radarAxis=require("./radarAxis");var _radar=require("./radar");var _gauge=require("./gauge");var _legend=require("./legend");var _util=require("../util");var allConfig={colorConfig:_color.colorConfig,gridConfig:_grid.gridConfig,xAxisConfig:_axis.xAxisConfig,yAxisConfig:_axis.yAxisConfig,titleConfig:_title.titleConfig,lineConfig:_line.lineConfig,barConfig:_bar.barConfig,pieConfig:_pie.pieConfig,radarAxisConfig:_radarAxis.radarAxisConfig,radarConfig:_radar.radarConfig,gaugeConfig:_gauge.gaugeConfig,legendConfig:_legend.legendConfig};function changeDefaultConfig(key,config){if(!allConfig["".concat(key,"Config")]){console.warn("Change default config Error - Invalid key!");return}(0,_util.deepMerge)(allConfig["".concat(key,"Config")],config)}var keys=["color","title","legend","xAxis","yAxis","grid","radarAxis","line","bar","pie","radar","gauge"];exports.keys=keys},{"../util":30,"./axis":4,"./bar":5,"./color":6,"./gauge":7,"./grid":8,"./legend":10,"./line":11,"./pie":12,"./radar":13,"./radarAxis":14,"./title":15}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.legendConfig=void 0;var legendConfig={show:true,orient:"horizontal",left:"auto",right:"auto",top:"auto",bottom:"auto",itemGap:10,iconWidth:25,iconHeight:10,selectAble:true,data:[],textStyle:{fontFamily:"Arial",fontSize:13,fill:"#000"},iconStyle:{},textUnselectedStyle:{fontFamily:"Arial",fontSize:13,fill:"#999"},iconUnselectedStyle:{fill:"#999"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.legendConfig=legendConfig},{}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.lineConfig=void 0;var lineConfig={show:true,name:"",stack:"",smooth:false,xAxisIndex:0,yAxisIndex:0,data:[],lineStyle:{lineWidth:1},linePoint:{show:true,radius:2,style:{fill:"#fff",lineWidth:1}},lineArea:{show:false,gradient:[],style:{opacity:.5}},label:{show:false,position:"top",offset:[0,-10],formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrame:50};exports.lineConfig=lineConfig},{}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.pieConfig=void 0;var pieConfig={show:true,name:"",radius:"50%",center:["50%","50%"],startAngle:-Math.PI/2,roseType:false,roseSort:true,roseIncrement:"auto",data:[],insideLabel:{show:false,formatter:"{percent}%",style:{fontSize:10,fill:"#fff",textAlign:"center",textBaseline:"middle"}},outsideLabel:{show:true,formatter:"{name}",style:{fontSize:11},labelLineBendGap:"20%",labelLineEndLength:50,labelLineStyle:{lineWidth:1}},pieStyle:{},percentToFixed:0,rLevel:10,animationDelayGap:60,animationCurve:"easeOutCubic",startAnimationCurve:"easeOutBack",animationFrame:50};exports.pieConfig=pieConfig},{}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarConfig=void 0;var radarConfig={show:true,name:"",data:[],radarStyle:{lineWidth:1},point:{show:true,radius:2,style:{fill:"#fff"}},label:{show:true,offset:[0,0],labelGap:5,formatter:null,style:{fontSize:10}},rLevel:10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarConfig=radarConfig},{}],14:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.radarAxisConfig=void 0;var radarAxisConfig={show:true,center:["50%","50%"],radius:"65%",startAngle:-Math.PI/2,splitNum:5,polygon:false,axisLabel:{show:true,labelGap:15,color:[],style:{fill:"#333"}},axisLine:{show:true,color:[],style:{stroke:"#999",lineWidth:1}},splitLine:{show:true,color:[],style:{stroke:"#d4d4d4",lineWidth:1}},splitArea:{show:false,color:["#f5f5f5","#e6e6e6"],style:{}},rLevel:-10,animationCurve:"easeOutCubic",animationFrane:50};exports.radarAxisConfig=radarAxisConfig},{}],15:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.titleConfig=void 0;var titleConfig={show:true,text:"",offset:[0,-20],style:{fill:"#333",fontSize:17,fontWeight:"bold",textAlign:"center",textBaseline:"bottom"},rLevel:20,animationCurve:"easeOutCubic",animationFrame:50};exports.titleConfig=titleConfig},{}],16:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.axis=axis;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _config=require("../config");var _util=require("../util");var _util2=require("@jiaminghi/c-render/lib/plugin/util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var allAxis=[];if(xAxis&&yAxis&&series){allAxis=getAllAxis(xAxis,yAxis);allAxis=mergeDefaultAxisConfig(allAxis);allAxis=allAxis.filter(function(_ref){var show=_ref.show;return show});allAxis=mergeDefaultBoundaryGap(allAxis);allAxis=calcAxisLabelData(allAxis,series);allAxis=setAxisPosition(allAxis);allAxis=calcAxisLinePosition(allAxis,chart);allAxis=calcAxisTickPosition(allAxis,chart);allAxis=calcAxisNamePosition(allAxis,chart);allAxis=calcSplitLinePosition(allAxis,chart)}(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLine",getGraphConfig:getLineConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisTick",getGraphConfig:getTickConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisLabel",getGraphConfig:getLabelConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"axisName",getGraphConfig:getNameConfig});(0,_updater.doUpdate)({chart:chart,series:allAxis,key:"splitLine",getGraphConfig:getSplitLineConfig});chart.axisData=allAxis}function getAllAxis(xAxis,yAxis){var allXAxis=[],allYAxis=[];if(xAxis instanceof Array){var _allXAxis;(_allXAxis=allXAxis).push.apply(_allXAxis,(0,_toConsumableArray2["default"])(xAxis))}else{allXAxis.push(xAxis)}if(yAxis instanceof Array){var _allYAxis;(_allYAxis=allYAxis).push.apply(_allYAxis,(0,_toConsumableArray2["default"])(yAxis))}else{allYAxis.push(yAxis)}allXAxis.splice(2);allYAxis.splice(2);allXAxis=allXAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"x"})});allYAxis=allYAxis.map(function(axis,i){return _objectSpread({},axis,{index:i,axis:"y"})});return[].concat((0,_toConsumableArray2["default"])(allXAxis),(0,_toConsumableArray2["default"])(allYAxis))}function mergeDefaultAxisConfig(allAxis){var xAxis=allAxis.filter(function(_ref2){var axis=_ref2.axis;return axis==="x"});var yAxis=allAxis.filter(function(_ref3){var axis=_ref3.axis;return axis==="y"});xAxis=xAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.xAxisConfig),axis)});yAxis=yAxis.map(function(axis){return(0,_util.deepMerge)((0,_util2.deepClone)(_config.yAxisConfig),axis)});return[].concat((0,_toConsumableArray2["default"])(xAxis),(0,_toConsumableArray2["default"])(yAxis))}function mergeDefaultBoundaryGap(allAxis){var valueAxis=allAxis.filter(function(_ref4){var data=_ref4.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref5){var data=_ref5.data;return data!=="value"});valueAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=false});labelAxis.forEach(function(axis){if(typeof axis.boundaryGap==="boolean")return;axis.boundaryGap=true});return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcAxisLabelData(allAxis,series){var valueAxis=allAxis.filter(function(_ref6){var data=_ref6.data;return data==="value"});var labelAxis=allAxis.filter(function(_ref7){var data=_ref7.data;return data instanceof Array});valueAxis=calcValueAxisLabelData(valueAxis,series);labelAxis=calcLabelAxisLabelData(labelAxis);return[].concat((0,_toConsumableArray2["default"])(valueAxis),(0,_toConsumableArray2["default"])(labelAxis))}function calcValueAxisLabelData(valueAxis,series){return valueAxis.map(function(axis){var minMaxValue=getValueAxisMaxMinValue(axis,series);var _getTrueMinMax=getTrueMinMax(axis,minMaxValue),_getTrueMinMax2=(0,_slicedToArray2["default"])(_getTrueMinMax,2),min=_getTrueMinMax2[0],max=_getTrueMinMax2[1];var interval=getValueInterval(min,max,axis);var formatter=axis.axisLabel.formatter;var label=[];if(minMaxValue[0]===minMaxValue[1]){label=minMaxValue}else if(min<0&&max>0){label=getValueAxisLabelFromZero(min,max,interval)}else{label=getValueAxisLabelFromMin(min,max,interval)}label=label.map(function(l){return parseFloat(l.toFixed(2))});return _objectSpread({},axis,{maxValue:label.slice(-1)[0],minValue:label[0],label:getAfterFormatterLabel(label,formatter)})})}function getValueAxisMaxMinValue(axis,series){series=series.filter(function(_ref8){var show=_ref8.show,type=_ref8.type;if(show===false)return false;if(type==="pie")return false;return true});if(series.length===0)return[0,0];var index=axis.index,axisType=axis.axis;series=mergeStackData(series);var axisName=axisType+"Axis";var valueSeries=series.filter(function(s){return s[axisName]===index});if(!valueSeries.length)valueSeries=series;return getSeriesMinMaxValue(valueSeries)}function getSeriesMinMaxValue(series){if(!series)return;var minValue=min.apply(void 0,(0,_toConsumableArray2["default"])(series.map(function(_ref9){var data=_ref9.data;return min.apply(void 0,(0,_toConsumableArray2["default"])((0,_util.filterNonNumber)(data)))})));var maxValue=max.apply(void 0,(0,_toConsumableArray2["default"])(series.map(function(_ref10){var data=_ref10.data;return max.apply(void 0,(0,_toConsumableArray2["default"])((0,_util.filterNonNumber)(data)))})));return[minValue,maxValue]}function mergeStackData(series){var seriesCloned=(0,_util2.deepClone)(series,true);series.forEach(function(item,i){var data=(0,_util.mergeSameStackData)(item,series);seriesCloned[i].data=data});return seriesCloned}function getTrueMinMax(_ref11,_ref12){var min=_ref11.min,max=_ref11.max,axis=_ref11.axis;var _ref13=(0,_slicedToArray2["default"])(_ref12,2),minValue=_ref13[0],maxValue=_ref13[1];var minType=(0,_typeof2["default"])(min),maxType=(0,_typeof2["default"])(max);if(!testMinMaxType(min)){min=axisConfig[axis+"AxisConfig"].min;minType="string"}if(!testMinMaxType(max)){max=axisConfig[axis+"AxisConfig"].max;maxType="string"}if(minType==="string"){min=parseInt(minValue-abs(minValue*parseFloat(min)/100));var lever=getValueLever(min);min=parseFloat((min/lever-.1).toFixed(1))*lever}if(maxType==="string"){max=parseInt(maxValue+abs(maxValue*parseFloat(max)/100));var _lever=getValueLever(max);max=parseFloat((max/_lever+.1).toFixed(1))*_lever}return[min,max]}function getValueLever(value){var valueString=abs(value).toString();var valueLength=valueString.length;var firstZeroIndex=valueString.replace(/0*$/g,"").indexOf("0");var pow10Num=valueLength-1;if(firstZeroIndex!==-1)pow10Num-=firstZeroIndex;return pow(10,pow10Num)}function testMinMaxType(val){var valType=(0,_typeof2["default"])(val);var isValidString=valType==="string"&&/^\d+%$/.test(val);var isValidNumber=valType==="number";return isValidString||isValidNumber}function getValueAxisLabelFromZero(min,max,interval){var negative=[],positive=[];var currentNegative=0,currentPositive=0;do{negative.push(currentNegative-=interval)}while(currentNegative>min);do{positive.push(currentPositive+=interval)}while(currentPositive1)valueInterval=parseInt(valueInterval.toString().replace(/\d$/,"0"));if(valueInterval===0)valueInterval=1;if(typeof minInterval==="number"&&valueIntervalmaxInterval)return maxInterval;return valueInterval}function setAxisPosition(allAxis){var xAxis=allAxis.filter(function(_ref14){var axis=_ref14.axis;return axis==="x"});var yAxis=allAxis.filter(function(_ref15){var axis=_ref15.axis;return axis==="y"});if(xAxis[0]&&!xAxis[0].position)xAxis[0].position=_config.xAxisConfig.position;if(xAxis[1]&&!xAxis[1].position){xAxis[1].position=xAxis[0].position==="bottom"?"top":"bottom"}if(yAxis[0]&&!yAxis[0].position)yAxis[0].position=_config.yAxisConfig.position;if(yAxis[1]&&!yAxis[1].position){yAxis[1].position=yAxis[0].position==="left"?"right":"left"}return[].concat((0,_toConsumableArray2["default"])(xAxis),(0,_toConsumableArray2["default"])(yAxis))}function calcAxisLinePosition(allAxis,chart){var _chart$gridArea=chart.gridArea,x=_chart$gridArea.x,y=_chart$gridArea.y,w=_chart$gridArea.w,h=_chart$gridArea.h;allAxis=allAxis.map(function(axis){var position=axis.position;var linePosition=[];if(position==="left"){linePosition=[[x,y],[x,y+h]].reverse()}else if(position==="right"){linePosition=[[x+w,y],[x+w,y+h]].reverse()}else if(position==="top"){linePosition=[[x,y],[x+w,y]]}else if(position==="bottom"){linePosition=[[x,y+h],[x+w,y+h]]}return _objectSpread({},axis,{linePosition:linePosition})});return allAxis}function calcAxisTickPosition(allAxis,chart){return allAxis.map(function(axisItem){var axis=axisItem.axis,linePosition=axisItem.linePosition,position=axisItem.position,label=axisItem.label,boundaryGap=axisItem.boundaryGap;if(typeof boundaryGap!=="boolean")boundaryGap=axisConfig[axis+"AxisConfig"].boundaryGap;var labelNum=label.length;var _linePosition=(0,_slicedToArray2["default"])(linePosition,2),_linePosition$=(0,_slicedToArray2["default"])(_linePosition[0],2),startX=_linePosition$[0],startY=_linePosition$[1],_linePosition$2=(0,_slicedToArray2["default"])(_linePosition[1],2),endX=_linePosition$2[0],endY=_linePosition$2[1];var gapLength=axis==="x"?endX-startX:endY-startY;var gap=gapLength/(boundaryGap?labelNum:labelNum-1);var tickPosition=new Array(labelNum).fill(0).map(function(foo,i){if(axis==="x"){return[startX+gap*(boundaryGap?i+.5:i),startY]}return[startX,startY+gap*(boundaryGap?i+.5:i)]});var tickLinePosition=getTickLinePosition(axis,boundaryGap,position,tickPosition,gap);return _objectSpread({},axisItem,{tickPosition:tickPosition,tickLinePosition:tickLinePosition,tickGap:gap})})}function getTickLinePosition(axisType,boundaryGap,position,tickPosition,gap){var index=axisType==="x"?1:0;var plus=5;if(axisType==="x"&&position==="top")plus=-5;if(axisType==="y"&&position==="left")plus=-5;var tickLinePosition=tickPosition.map(function(lineStart){var lineEnd=(0,_util2.deepClone)(lineStart);lineEnd[index]+=plus;return[(0,_util2.deepClone)(lineStart),lineEnd]});if(!boundaryGap)return tickLinePosition;index=axisType==="x"?0:1;plus=gap/2;tickLinePosition.forEach(function(_ref16){var _ref17=(0,_slicedToArray2["default"])(_ref16,2),lineStart=_ref17[0],lineEnd=_ref17[1];lineStart[index]+=plus;lineEnd[index]+=plus});return tickLinePosition}function calcAxisNamePosition(allAxis,chart){return allAxis.map(function(axisItem){var nameGap=axisItem.nameGap,nameLocation=axisItem.nameLocation,position=axisItem.position,linePosition=axisItem.linePosition;var _linePosition2=(0,_slicedToArray2["default"])(linePosition,2),lineStart=_linePosition2[0],lineEnd=_linePosition2[1];var namePosition=(0,_toConsumableArray2["default"])(lineStart);if(nameLocation==="end")namePosition=(0,_toConsumableArray2["default"])(lineEnd);if(nameLocation==="center"){namePosition[0]=(lineStart[0]+lineEnd[0])/2;namePosition[1]=(lineStart[1]+lineEnd[1])/2}var index=0;if(position==="top"&&nameLocation==="center")index=1;if(position==="bottom"&&nameLocation==="center")index=1;if(position==="left"&&nameLocation!=="center")index=1;if(position==="right"&&nameLocation!=="center")index=1;var plus=nameGap;if(position==="top"&&nameLocation!=="end")plus*=-1;if(position==="left"&&nameLocation!=="start")plus*=-1;if(position==="bottom"&&nameLocation==="start")plus*=-1;if(position==="right"&&nameLocation==="end")plus*=-1;namePosition[index]+=plus;return _objectSpread({},axisItem,{namePosition:namePosition})})}function calcSplitLinePosition(allAxis,chart){var _chart$gridArea2=chart.gridArea,w=_chart$gridArea2.w,h=_chart$gridArea2.h;return allAxis.map(function(axisItem){var tickLinePosition=axisItem.tickLinePosition,position=axisItem.position,boundaryGap=axisItem.boundaryGap;var index=0,plus=w;if(position==="top"||position==="bottom")index=1;if(position==="top"||position==="bottom")plus=h;if(position==="right"||position==="bottom")plus*=-1;var splitLinePosition=tickLinePosition.map(function(_ref18){var _ref19=(0,_slicedToArray2["default"])(_ref18,1),startPoint=_ref19[0];var endPoint=(0,_toConsumableArray2["default"])(startPoint);endPoint[index]+=plus;return[(0,_toConsumableArray2["default"])(startPoint),endPoint]});if(!boundaryGap)splitLinePosition.shift();return _objectSpread({},axisItem,{splitLinePosition:splitLinePosition})})}function getLineConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;return[{name:"polyline",index:rLevel,visible:axisItem.axisLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getLineShape(axisItem),style:getLineStyle(axisItem)}]}function getLineShape(axisItem){var linePosition=axisItem.linePosition;return{points:linePosition}}function getLineStyle(axisItem){return axisItem.axisLine.style}function getTickConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getTickShapes(axisItem);var style=getTickStyle(axisItem);return shapes.map(function(shape){return{name:"polyline",index:rLevel,visible:axisItem.axisTick.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getTickShapes(axisItem){var tickLinePosition=axisItem.tickLinePosition;return tickLinePosition.map(function(points){return{points:points}})}function getTickStyle(axisItem){return axisItem.axisTick.style}function getLabelConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getLabelShapes(axisItem);var styles=getLabelStyle(axisItem,shapes);return shapes.map(function(shape,i){return{name:"text",index:rLevel,visible:axisItem.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:styles[i],setGraphCenter:function setGraphCenter(){return void 0}}})}function getLabelShapes(axisItem){var label=axisItem.label,tickPosition=axisItem.tickPosition,position=axisItem.position;return tickPosition.map(function(point,i){return{position:getLabelRealPosition(point,position),content:label[i].toString()}})}function getLabelRealPosition(points,position){var index=0,plus=10;if(position==="top"||position==="bottom")index=1;if(position==="top"||position==="left")plus=-10;points=(0,_util2.deepClone)(points);points[index]+=plus;return points}function getLabelStyle(axisItem,shapes){var position=axisItem.position;var style=axisItem.axisLabel.style;var align=getAxisLabelRealAlign(position);style=(0,_util.deepMerge)(align,style);var styles=shapes.map(function(_ref20){var position=_ref20.position;return _objectSpread({},style,{graphCenter:position})});return styles}function getAxisLabelRealAlign(position){if(position==="left")return{textAlign:"right",textBaseline:"middle"};if(position==="right")return{textAlign:"left",textBaseline:"middle"};if(position==="top")return{textAlign:"center",textBaseline:"bottom"};if(position==="bottom")return{textAlign:"center",textBaseline:"top"}}function getNameConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;return[{name:"text",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getNameShape(axisItem),style:getNameStyle(axisItem)}]}function getNameShape(axisItem){var name=axisItem.name,namePosition=axisItem.namePosition;return{content:name,position:namePosition}}function getNameStyle(axisItem){var nameLocation=axisItem.nameLocation,position=axisItem.position,style=axisItem.nameTextStyle;var align=getNameRealAlign(position,nameLocation);return(0,_util.deepMerge)(align,style)}function getNameRealAlign(position,location){if(position==="top"&&location==="start"||position==="bottom"&&location==="start"||position==="left"&&location==="center")return{textAlign:"right",textBaseline:"middle"};if(position==="top"&&location==="end"||position==="bottom"&&location==="end"||position==="right"&&location==="center")return{textAlign:"left",textBaseline:"middle"};if(position==="top"&&location==="center"||position==="left"&&location==="end"||position==="right"&&location==="end")return{textAlign:"center",textBaseline:"bottom"};if(position==="bottom"&&location==="center"||position==="left"&&location==="start"||position==="right"&&location==="start")return{textAlign:"center",textBaseline:"top"}}function getSplitLineConfig(axisItem){var animationCurve=axisItem.animationCurve,animationFrame=axisItem.animationFrame,rLevel=axisItem.rLevel;var shapes=getSplitLineShapes(axisItem);var style=getSplitLineStyle(axisItem);return shapes.map(function(shape){return{name:"polyline",index:rLevel,visible:axisItem.splitLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getSplitLineShapes(axisItem){var splitLinePosition=axisItem.splitLinePosition;return splitLinePosition.map(function(points){return{points:points}})}function getSplitLineStyle(axisItem){return axisItem.splitLine.style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],17:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.bar=bar;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _config=require("../config");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var bars=[];if(xAxis&&yAxis&&series){bars=(0,_util2.initNeedSeries)(series,_config.barConfig,"bar");bars=setBarAxis(bars,chart);bars=setBarPositionData(bars,chart);bars=calcBarsPosition(bars,chart)}(0,_updater.doUpdate)({chart:chart,series:bars.slice(-1),key:"backgroundBar",getGraphConfig:getBackgroundBarConfig});bars.reverse();(0,_updater.doUpdate)({chart:chart,series:bars,key:"bar",getGraphConfig:getBarConfig,getStartGraphConfig:getStartBarConfig,beforeUpdate:beforeUpdateBar});(0,_updater.doUpdate)({chart:chart,series:bars,key:"barLabel",getGraphConfig:getLabelConfig})}function setBarAxis(bars,chart){var axisData=chart.axisData;bars.forEach(function(bar){var xAxisIndex=bar.xAxisIndex,yAxisIndex=bar.yAxisIndex;if(typeof xAxisIndex!=="number")xAxisIndex=0;if(typeof yAxisIndex!=="number")yAxisIndex=0;var xAxis=axisData.find(function(_ref){var axis=_ref.axis,index=_ref.index;return"".concat(axis).concat(index)==="x".concat(xAxisIndex)});var yAxis=axisData.find(function(_ref2){var axis=_ref2.axis,index=_ref2.index;return"".concat(axis).concat(index)==="y".concat(yAxisIndex)});var axis=[xAxis,yAxis];var valueAxisIndex=axis.findIndex(function(_ref3){var data=_ref3.data;return data==="value"});bar.valueAxis=axis[valueAxisIndex];bar.labelAxis=axis[1-valueAxisIndex]});return bars}function setBarPositionData(bars,chart){var labelBarGroup=groupBarByLabelAxis(bars);labelBarGroup.forEach(function(group){setBarIndex(group);setBarNum(group);setBarCategoryWidth(group,chart);setBarWidthAndGap(group);setBarAllWidthAndGap(group)});return bars}function setBarIndex(bars){var stacks=getBarStack(bars);stacks=stacks.map(function(stack){return{stack:stack,index:-1}});var currentIndex=0;bars.forEach(function(bar){var stack=bar.stack;if(!stack){bar.barIndex=currentIndex;currentIndex++}else{var stackData=stacks.find(function(_ref4){var s=_ref4.stack;return s===stack});if(stackData.index===-1){stackData.index=currentIndex;currentIndex++}bar.barIndex=stackData.index}})}function groupBarByLabelAxis(bars){var labelAxis=bars.map(function(_ref5){var _ref5$labelAxis=_ref5.labelAxis,axis=_ref5$labelAxis.axis,index=_ref5$labelAxis.index;return axis+index});labelAxis=(0,_toConsumableArray2["default"])(new Set(labelAxis));return labelAxis.map(function(axisIndex){return bars.filter(function(_ref6){var _ref6$labelAxis=_ref6.labelAxis,axis=_ref6$labelAxis.axis,index=_ref6$labelAxis.index;return axis+index===axisIndex})})}function getBarStack(bars){var stacks=[];bars.forEach(function(_ref7){var stack=_ref7.stack;if(stack)stacks.push(stack)});return(0,_toConsumableArray2["default"])(new Set(stacks))}function setBarNum(bars){var barNum=(0,_toConsumableArray2["default"])(new Set(bars.map(function(_ref8){var barIndex=_ref8.barIndex;return barIndex}))).length;bars.forEach(function(bar){return bar.barNum=barNum})}function setBarCategoryWidth(bars){var lastBar=bars.slice(-1)[0];var barCategoryGap=lastBar.barCategoryGap,tickGap=lastBar.labelAxis.tickGap;var barCategoryWidth=0;if(typeof barCategoryGap==="number"){barCategoryWidth=barCategoryGap}else{barCategoryWidth=(1-parseInt(barCategoryGap)/100)*tickGap}bars.forEach(function(bar){return bar.barCategoryWidth=barCategoryWidth})}function setBarWidthAndGap(bars){var _bars$slice$=bars.slice(-1)[0],barCategoryWidth=_bars$slice$.barCategoryWidth,barWidth=_bars$slice$.barWidth,barGap=_bars$slice$.barGap,barNum=_bars$slice$.barNum;var widthAndGap=[];if(typeof barWidth==="number"||barWidth!=="auto"){widthAndGap=getBarWidthAndGapWithPercentOrNumber(barCategoryWidth,barWidth,barGap,barNum)}else if(barWidth==="auto"){widthAndGap=getBarWidthAndGapWidthAuto(barCategoryWidth,barWidth,barGap,barNum)}var _widthAndGap=widthAndGap,_widthAndGap2=(0,_slicedToArray2["default"])(_widthAndGap,2),width=_widthAndGap2[0],gap=_widthAndGap2[1];bars.forEach(function(bar){bar.barWidth=width;bar.barGap=gap})}function getBarWidthAndGapWithPercentOrNumber(barCategoryWidth,barWidth,barGap){var width=0,gap=0;if(typeof barWidth==="number"){width=barWidth}else{width=parseInt(barWidth)/100*barCategoryWidth}if(typeof barGap==="number"){gap=barGap}else{gap=parseInt(barGap)/100*width}return[width,gap]}function getBarWidthAndGapWidthAuto(barCategoryWidth,barWidth,barGap,barNum){var width=0,gap=0;var barItemWidth=barCategoryWidth/barNum;if(typeof barGap==="number"){gap=barGap;width=barItemWidth-gap}else{var percent=10+parseInt(barGap)/10;if(percent===0){width=barItemWidth*2;gap=-width}else{width=barItemWidth/percent*10;gap=barItemWidth-width}}return[width,gap]}function setBarAllWidthAndGap(bars){var _bars$slice$2=bars.slice(-1)[0],barGap=_bars$slice$2.barGap,barWidth=_bars$slice$2.barWidth,barNum=_bars$slice$2.barNum;var barAllWidthAndGap=(barGap+barWidth)*barNum-barGap;bars.forEach(function(bar){return bar.barAllWidthAndGap=barAllWidthAndGap})}function calcBarsPosition(bars,chart){bars=calcBarValueAxisCoordinate(bars);bars=calcBarLabelAxisCoordinate(bars);bars=eliminateNullBarLabelAxis(bars);bars=keepSameNumBetweenBarAndData(bars);return bars}function calcBarLabelAxisCoordinate(bars){return bars.map(function(bar){var labelAxis=bar.labelAxis,barAllWidthAndGap=bar.barAllWidthAndGap,barGap=bar.barGap,barWidth=bar.barWidth,barIndex=bar.barIndex;var tickGap=labelAxis.tickGap,tickPosition=labelAxis.tickPosition,axis=labelAxis.axis;var coordinateIndex=axis==="x"?0:1;var barLabelAxisPos=tickPosition.map(function(tick,i){var barCategoryStartPos=tickPosition[i][coordinateIndex]-tickGap/2;var barItemsStartPos=barCategoryStartPos+(tickGap-barAllWidthAndGap)/2;return barItemsStartPos+(barIndex+.5)*barWidth+barIndex*barGap});return _objectSpread({},bar,{barLabelAxisPos:barLabelAxisPos})})}function calcBarValueAxisCoordinate(bars){return bars.map(function(bar){var data=(0,_util2.mergeSameStackData)(bar,bars);data=eliminateNonNumberData(bar,data);var _bar$valueAxis=bar.valueAxis,axis=_bar$valueAxis.axis,minValue=_bar$valueAxis.minValue,maxValue=_bar$valueAxis.maxValue,linePosition=_bar$valueAxis.linePosition;var startPos=getValuePos(minValue,maxValue,minValue<0?0:minValue,linePosition,axis);var endPos=data.map(function(v){return getValuePos(minValue,maxValue,v,linePosition,axis)});var barValueAxisPos=endPos.map(function(p){return[startPos,p]});return _objectSpread({},bar,{barValueAxisPos:barValueAxisPos})})}function eliminateNonNumberData(barItem,barData){var data=barItem.data;return barData.map(function(v,i){return typeof data[i]==="number"?v:null}).filter(function(d){return d!==null})}function eliminateNullBarLabelAxis(bars){return bars.map(function(bar){var barLabelAxisPos=bar.barLabelAxisPos,data=bar.data;data.forEach(function(d,i){if(typeof d==="number")return;barLabelAxisPos[i]=null});return _objectSpread({},bar,{barLabelAxisPos:barLabelAxisPos.filter(function(p){return p!==null})})})}function keepSameNumBetweenBarAndData(bars){bars.forEach(function(bar){var data=bar.data,barLabelAxisPos=bar.barLabelAxisPos,barValueAxisPos=bar.barValueAxisPos;var dataNum=data.filter(function(d){return typeof d==="number"}).length;var axisPosNum=barLabelAxisPos.length;if(axisPosNum>dataNum){barLabelAxisPos.splice(dataNum);barValueAxisPos.splice(dataNum)}});return bars}function getValuePos(min,max,value,linePosition,axis){if(typeof value!=="number")return null;var valueMinus=max-min;var coordinateIndex=axis==="x"?0:1;var posMinus=linePosition[1][coordinateIndex]-linePosition[0][coordinateIndex];var percent=(value-min)/valueMinus;if(valueMinus===0)percent=0;var pos=percent*posMinus;return pos+linePosition[0][coordinateIndex]}function getBackgroundBarConfig(barItem){var animationCurve=barItem.animationCurve,animationFrame=barItem.animationFrame,rLevel=barItem.rLevel;var shapes=getBackgroundBarShapes(barItem);var style=getBackgroundBarStyle(barItem);return shapes.map(function(shape){return{name:"rect",index:rLevel,visible:barItem.backgroundBar.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getBackgroundBarShapes(barItem){var labelAxis=barItem.labelAxis,valueAxis=barItem.valueAxis;var tickPosition=labelAxis.tickPosition;var axis=valueAxis.axis,linePosition=valueAxis.linePosition;var width=getBackgroundBarWidth(barItem);var haltWidth=width/2;var posIndex=axis==="x"?0:1;var centerPos=tickPosition.map(function(p){return p[1-posIndex]});var _ref9=[linePosition[0][posIndex],linePosition[1][posIndex]],start=_ref9[0],end=_ref9[1];return centerPos.map(function(center){if(axis==="x"){return{x:start,y:center-haltWidth,w:end-start,h:width}}else{return{x:center-haltWidth,y:end,w:width,h:start-end}}})}function getBackgroundBarWidth(barItem){var barAllWidthAndGap=barItem.barAllWidthAndGap,barCategoryWidth=barItem.barCategoryWidth,backgroundBar=barItem.backgroundBar;var width=backgroundBar.width;if(typeof width==="number")return width;if(width==="auto")return barAllWidthAndGap;return parseInt(width)/100*barCategoryWidth}function getBackgroundBarStyle(barItem){return barItem.backgroundBar.style}function getBarConfig(barItem){var barLabelAxisPos=barItem.barLabelAxisPos,animationCurve=barItem.animationCurve,animationFrame=barItem.animationFrame,rLevel=barItem.rLevel;var name=getBarName(barItem);return barLabelAxisPos.map(function(foo,i){return{name:name,index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getBarShape(barItem,i),style:getBarStyle(barItem,i)}})}function getBarName(barItem){var shapeType=barItem.shapeType;if(shapeType==="leftEchelon"||shapeType==="rightEchelon")return"polyline";return"rect"}function getBarShape(barItem,i){var shapeType=barItem.shapeType;if(shapeType==="leftEchelon"){return getLeftEchelonShape(barItem,i)}else if(shapeType==="rightEchelon"){return getRightEchelonShape(barItem,i)}else{return getNormalBarShape(barItem,i)}}function getLeftEchelonShape(barItem,i){var barValueAxisPos=barItem.barValueAxisPos,barLabelAxisPos=barItem.barLabelAxisPos,barWidth=barItem.barWidth,echelonOffset=barItem.echelonOffset;var _barValueAxisPos$i=(0,_slicedToArray2["default"])(barValueAxisPos[i],2),start=_barValueAxisPos$i[0],end=_barValueAxisPos$i[1];var labelAxisPos=barLabelAxisPos[i];var halfWidth=barWidth/2;var valueAxis=barItem.valueAxis.axis;var points=[];if(valueAxis==="x"){points[0]=[end,labelAxisPos-halfWidth];points[1]=[end,labelAxisPos+halfWidth];points[2]=[start,labelAxisPos+halfWidth];points[3]=[start+echelonOffset,labelAxisPos-halfWidth];if(end-start1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var gauges=(0,_util2.initNeedSeries)(series,_gauge.gaugeConfig,"gauge");gauges=calcGaugesCenter(gauges,chart);gauges=calcGaugesRadius(gauges,chart);gauges=calcGaugesDataRadiusAndLineWidth(gauges,chart);gauges=calcGaugesDataAngles(gauges,chart);gauges=calcGaugesDataGradient(gauges,chart);gauges=calcGaugesAxisTickPosition(gauges,chart);gauges=calcGaugesLabelPositionAndAlign(gauges,chart);gauges=calcGaugesLabelData(gauges,chart);gauges=calcGaugesDetailsPosition(gauges,chart);gauges=calcGaugesDetailsContent(gauges,chart);(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeAxisTick",getGraphConfig:getAxisTickConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeAxisLabel",getGraphConfig:getAxisLabelConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeBackgroundArc",getGraphConfig:getBackgroundArcConfig,getStartGraphConfig:getStartBackgroundArcConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeArc",getGraphConfig:getArcConfig,getStartGraphConfig:getStartArcConfig,beforeChange:beforeChangeArc});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugePointer",getGraphConfig:getPointerConfig,getStartGraphConfig:getStartPointerConfig});(0,_updater.doUpdate)({chart:chart,series:gauges,key:"gaugeDetails",getGraphConfig:getDetailsConfig})}function calcGaugesCenter(gauges,chart){var area=chart.render.area;gauges.forEach(function(gaugeItem){var center=gaugeItem.center;center=center.map(function(pos,i){if(typeof pos==="number")return pos;return parseInt(pos)/100*area[i]});gaugeItem.center=center});return gauges}function calcGaugesRadius(gauges,chart){var area=chart.render.area;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;gauges.forEach(function(gaugeItem){var radius=gaugeItem.radius;if(typeof radius!=="number"){radius=parseInt(radius)/100*maxRadius}gaugeItem.radius=radius});return gauges}function calcGaugesDataRadiusAndLineWidth(gauges,chart){var area=chart.render.area;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;gauges.forEach(function(gaugeItem){var radius=gaugeItem.radius,data=gaugeItem.data,arcLineWidth=gaugeItem.arcLineWidth;data.forEach(function(item){var arcRadius=item.radius,lineWidth=item.lineWidth;if(!arcRadius)arcRadius=radius;if(typeof arcRadius!=="number")arcRadius=parseInt(arcRadius)/100*maxRadius;item.radius=arcRadius;if(!lineWidth)lineWidth=arcLineWidth;item.lineWidth=lineWidth})});return gauges}function calcGaugesDataAngles(gauges,chart){gauges.forEach(function(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,data=gaugeItem.data,min=gaugeItem.min,max=gaugeItem.max;var angleMinus=endAngle-startAngle;var valueMinus=max-min;data.forEach(function(item){var value=item.value;var itemAngle=Math.abs((value-min)/valueMinus*angleMinus);item.startAngle=startAngle;item.endAngle=startAngle+itemAngle})});return gauges}function calcGaugesDataGradient(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data;data.forEach(function(item){var color=item.color,gradient=item.gradient;if(!gradient||!gradient.length)gradient=color;if(!(gradient instanceof Array))gradient=[gradient];item.gradient=gradient})});return gauges}function calcGaugesAxisTickPosition(gauges,chart){gauges.forEach(function(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,splitNum=gaugeItem.splitNum,center=gaugeItem.center,radius=gaugeItem.radius,arcLineWidth=gaugeItem.arcLineWidth,axisTick=gaugeItem.axisTick;var tickLength=axisTick.tickLength,lineWidth=axisTick.style.lineWidth;var angles=endAngle-startAngle;var outerRadius=radius-arcLineWidth/2;var innerRadius=outerRadius-tickLength;var angleGap=angles/(splitNum-1);var arcLength=2*Math.PI*radius*angles/(Math.PI*2);var offset=Math.ceil(lineWidth/2)/arcLength*angles;gaugeItem.tickAngles=[];gaugeItem.tickInnerRadius=[];gaugeItem.tickPosition=new Array(splitNum).fill(0).map(function(foo,i){var angle=startAngle+angleGap*i;if(i===0)angle+=offset;if(i===splitNum-1)angle-=offset;gaugeItem.tickAngles[i]=angle;gaugeItem.tickInnerRadius[i]=innerRadius;return[_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([outerRadius,angle])),_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([innerRadius,angle]))]})});return gauges}function calcGaugesLabelPositionAndAlign(gauges,chart){gauges.forEach(function(gaugeItem){var center=gaugeItem.center,tickInnerRadius=gaugeItem.tickInnerRadius,tickAngles=gaugeItem.tickAngles,labelGap=gaugeItem.axisLabel.labelGap;var position=tickAngles.map(function(angle,i){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([tickInnerRadius[i]-labelGap,tickAngles[i]]))});var align=position.map(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),x=_ref2[0],y=_ref2[1];return{textAlign:x>center[0]?"right":"left",textBaseline:y>center[1]?"bottom":"top"}});gaugeItem.labelPosition=position;gaugeItem.labelAlign=align});return gauges}function calcGaugesLabelData(gauges,chart){gauges.forEach(function(gaugeItem){var axisLabel=gaugeItem.axisLabel,min=gaugeItem.min,max=gaugeItem.max,splitNum=gaugeItem.splitNum;var data=axisLabel.data,formatter=axisLabel.formatter;var valueGap=(max-min)/(splitNum-1);var value=new Array(splitNum).fill(0).map(function(foo,i){return parseInt(min+valueGap*i)});var formatterType=(0,_typeof2["default"])(formatter);data=(0,_util2.deepMerge)(value,data).map(function(v,i){var label=v;if(formatterType==="string"){label=formatter.replace("{value}",v)}if(formatterType==="function"){label=formatter({value:v,index:i})}return label});axisLabel.data=data});return gauges}function calcGaugesDetailsPosition(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data,details=gaugeItem.details,center=gaugeItem.center;var position=details.position,offset=details.offset;var detailsPosition=data.map(function(_ref3){var startAngle=_ref3.startAngle,endAngle=_ref3.endAngle,radius=_ref3.radius;var point=null;if(position==="center"){point=center}else if(position==="start"){point=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,startAngle]))}else if(position==="end"){point=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,endAngle]))}return getOffsetedPoint(point,offset)});gaugeItem.detailsPosition=detailsPosition});return gauges}function calcGaugesDetailsContent(gauges,chart){gauges.forEach(function(gaugeItem){var data=gaugeItem.data,details=gaugeItem.details;var formatter=details.formatter;var formatterType=(0,_typeof2["default"])(formatter);var contents=data.map(function(dataItem){var content=dataItem.value;if(formatterType==="string"){content=formatter.replace("{value}","{nt}");content=content.replace("{name}",dataItem.name)}if(formatterType==="function")content=formatter(dataItem);return content.toString()});gaugeItem.detailsContent=contents});return gauges}function getOffsetedPoint(_ref4,_ref5){var _ref6=(0,_slicedToArray2["default"])(_ref4,2),x=_ref6[0],y=_ref6[1];var _ref7=(0,_slicedToArray2["default"])(_ref5,2),ox=_ref7[0],oy=_ref7[1];return[x+ox,y+oy]}function getAxisTickConfig(gaugeItem){var tickPosition=gaugeItem.tickPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return tickPosition.map(function(foo,i){return{name:"polyline",index:rLevel,visible:gaugeItem.axisTick.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisTickShape(gaugeItem,i),style:getAxisTickStyle(gaugeItem,i)}})}function getAxisTickShape(gaugeItem,i){var tickPosition=gaugeItem.tickPosition;return{points:tickPosition[i]}}function getAxisTickStyle(gaugeItem,i){var style=gaugeItem.axisTick.style;return style}function getAxisLabelConfig(gaugeItem){var labelPosition=gaugeItem.labelPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return labelPosition.map(function(foo,i){return{name:"text",index:rLevel,visible:gaugeItem.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLabelShape(gaugeItem,i),style:getAxisLabelStyle(gaugeItem,i)}})}function getAxisLabelShape(gaugeItem,i){var labelPosition=gaugeItem.labelPosition,data=gaugeItem.axisLabel.data;return{content:data[i].toString(),position:labelPosition[i]}}function getAxisLabelStyle(gaugeItem,i){var labelAlign=gaugeItem.labelAlign,axisLabel=gaugeItem.axisLabel;var style=axisLabel.style;return(0,_util2.deepMerge)(_objectSpread({},labelAlign[i]),style)}function getBackgroundArcConfig(gaugeItem){var animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return[{name:"arc",index:rLevel,visible:gaugeItem.backgroundArc.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getGaugeBackgroundArcShape(gaugeItem),style:getGaugeBackgroundArcStyle(gaugeItem)}]}function getGaugeBackgroundArcShape(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,center=gaugeItem.center,radius=gaugeItem.radius;return{rx:center[0],ry:center[1],r:radius,startAngle:startAngle,endAngle:endAngle}}function getGaugeBackgroundArcStyle(gaugeItem){var backgroundArc=gaugeItem.backgroundArc,arcLineWidth=gaugeItem.arcLineWidth;var style=backgroundArc.style;return(0,_util2.deepMerge)({lineWidth:arcLineWidth},style)}function getStartBackgroundArcConfig(gaugeItem){var config=getBackgroundArcConfig(gaugeItem)[0];var shape=_objectSpread({},config.shape);shape.endAngle=config.shape.startAngle;config.shape=shape;return[config]}function getArcConfig(gaugeItem){var data=gaugeItem.data,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;return data.map(function(foo,i){return{name:"agArc",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getGaugeArcShape(gaugeItem,i),style:getGaugeArcStyle(gaugeItem,i)}})}function getGaugeArcShape(gaugeItem,i){var data=gaugeItem.data,center=gaugeItem.center,gradientEndAngle=gaugeItem.endAngle;var _data$i=data[i],radius=_data$i.radius,startAngle=_data$i.startAngle,endAngle=_data$i.endAngle,localGradient=_data$i.localGradient;if(localGradient)gradientEndAngle=endAngle;return{rx:center[0],ry:center[1],r:radius,startAngle:startAngle,endAngle:endAngle,gradientEndAngle:gradientEndAngle}}function getGaugeArcStyle(gaugeItem,i){var data=gaugeItem.data,dataItemStyle=gaugeItem.dataItemStyle;var _data$i2=data[i],lineWidth=_data$i2.lineWidth,gradient=_data$i2.gradient;gradient=gradient.map(function(c){return(0,_color.getRgbaValue)(c)});return(0,_util2.deepMerge)({lineWidth:lineWidth,gradient:gradient},dataItemStyle)}function getStartArcConfig(gaugeItem){var configs=getArcConfig(gaugeItem);configs.map(function(config){var shape=_objectSpread({},config.shape);shape.endAngle=config.shape.startAngle;config.shape=shape});return configs}function beforeChangeArc(graph,config){var graphGradient=graph.style.gradient;var cacheNum=graphGradient.length;var needNum=config.style.gradient.length;if(cacheNum>needNum){graphGradient.splice(needNum)}else{var last=graphGradient.slice(-1)[0];graphGradient.push.apply(graphGradient,(0,_toConsumableArray2["default"])(new Array(needNum-cacheNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(last)})))}}function getPointerConfig(gaugeItem){var animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,center=gaugeItem.center,rLevel=gaugeItem.rLevel;return[{name:"polyline",index:rLevel,visible:gaugeItem.pointer.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getPointerShape(gaugeItem),style:getPointerStyle(gaugeItem),setGraphCenter:function setGraphCenter(foo,graph){graph.style.graphCenter=center}}]}function getPointerShape(gaugeItem){var center=gaugeItem.center;return{points:getPointerPoints(center),close:true}}function getPointerStyle(gaugeItem){var startAngle=gaugeItem.startAngle,endAngle=gaugeItem.endAngle,min=gaugeItem.min,max=gaugeItem.max,data=gaugeItem.data,pointer=gaugeItem.pointer,center=gaugeItem.center;var valueIndex=pointer.valueIndex,style=pointer.style;var value=data[valueIndex]?data[valueIndex].value:0;var angle=(value-min)/(max-min)*(endAngle-startAngle)+startAngle+Math.PI/2;return(0,_util2.deepMerge)({rotate:(0,_util2.radianToAngle)(angle),scale:[1,1],graphCenter:center},style)}function getPointerPoints(_ref8){var _ref9=(0,_slicedToArray2["default"])(_ref8,2),x=_ref9[0],y=_ref9[1];var point1=[x,y-40];var point2=[x+5,y];var point3=[x,y+10];var point4=[x-5,y];return[point1,point2,point3,point4]}function getStartPointerConfig(gaugeItem){var startAngle=gaugeItem.startAngle;var config=getPointerConfig(gaugeItem)[0];config.style.rotate=(0,_util2.radianToAngle)(startAngle+Math.PI/2);return[config]}function getDetailsConfig(gaugeItem){var detailsPosition=gaugeItem.detailsPosition,animationCurve=gaugeItem.animationCurve,animationFrame=gaugeItem.animationFrame,rLevel=gaugeItem.rLevel;var visible=gaugeItem.details.show;return detailsPosition.map(function(foo,i){return{name:"numberText",index:rLevel,visible:visible,animationCurve:animationCurve,animationFrame:animationFrame,shape:getDetailsShape(gaugeItem,i),style:getDetailsStyle(gaugeItem,i)}})}function getDetailsShape(gaugeItem,i){var detailsPosition=gaugeItem.detailsPosition,detailsContent=gaugeItem.detailsContent,data=gaugeItem.data,details=gaugeItem.details;var position=detailsPosition[i];var content=detailsContent[i];var dataValue=data[i].value;var toFixed=details.valueToFixed;return{number:[dataValue],content:content,position:position,toFixed:toFixed}}function getDetailsStyle(gaugeItem,i){var details=gaugeItem.details,data=gaugeItem.data;var style=details.style;var color=data[i].color;return(0,_util2.deepMerge)({fill:color},style)}},{"../class/updater.class":3,"../config/gauge":7,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],19:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.grid=grid;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var grid=option.grid;grid=(0,_util2.deepMerge)((0,_util.deepClone)(_config.gridConfig,true),grid||{});(0,_updater.doUpdate)({chart:chart,series:[grid],key:"grid",getGraphConfig:getGridConfig})}function getGridConfig(gridItem,updater){var animationCurve=gridItem.animationCurve,animationFrame=gridItem.animationFrame,rLevel=gridItem.rLevel;var shape=getGridShape(gridItem,updater);var style=getGridStyle(gridItem);updater.chart.gridArea=_objectSpread({},shape);return[{name:"rect",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}]}function getGridShape(gridItem,updater){var _updater$chart$render=(0,_slicedToArray2["default"])(updater.chart.render.area,2),w=_updater$chart$render[0],h=_updater$chart$render[1];var left=getNumberValue(gridItem.left,w);var right=getNumberValue(gridItem.right,w);var top=getNumberValue(gridItem.top,h);var bottom=getNumberValue(gridItem.bottom,h);var width=w-left-right;var height=h-top-bottom;return{x:left,y:top,w:width,h:height}}function getNumberValue(val,all){if(typeof val==="number")return val;if(typeof val!=="string")return 0;return all*parseInt(val)/100}function getGridStyle(gridItem){var style=gridItem.style;return style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@jiaminghi/c-render/lib/plugin/util":54}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"mergeColor",{enumerable:true,get:function get(){return _mergeColor.mergeColor}});Object.defineProperty(exports,"title",{enumerable:true,get:function get(){return _title.title}});Object.defineProperty(exports,"grid",{enumerable:true,get:function get(){return _grid.grid}});Object.defineProperty(exports,"axis",{enumerable:true,get:function get(){return _axis.axis}});Object.defineProperty(exports,"line",{enumerable:true,get:function get(){return _line.line}});Object.defineProperty(exports,"bar",{enumerable:true,get:function get(){return _bar.bar}});Object.defineProperty(exports,"pie",{enumerable:true,get:function get(){return _pie.pie}});Object.defineProperty(exports,"radarAxis",{enumerable:true,get:function get(){return _radarAxis.radarAxis}});Object.defineProperty(exports,"radar",{enumerable:true,get:function get(){return _radar.radar}});Object.defineProperty(exports,"gauge",{enumerable:true,get:function get(){return _gauge.gauge}});Object.defineProperty(exports,"legend",{enumerable:true,get:function get(){return _legend.legend}});var _mergeColor=require("./mergeColor");var _title=require("./title");var _grid=require("./grid");var _axis=require("./axis");var _line=require("./line");var _bar=require("./bar");var _pie=require("./pie");var _radarAxis=require("./radarAxis");var _radar=require("./radar");var _gauge=require("./gauge");var _legend=require("./legend")},{"./axis":16,"./bar":17,"./gauge":18,"./grid":19,"./legend":21,"./line":22,"./mergeColor":23,"./pie":24,"./radar":25,"./radarAxis":26,"./title":27}],21:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.legend=legend;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function legend(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var legend=option.legend;if(legend){legend=(0,_util2.deepMerge)((0,_util.deepClone)(_config.legendConfig,true),legend);legend=initLegendData(legend);legend=filterInvalidData(legend,option,chart);legend=calcLegendTextWidth(legend,chart);legend=calcLegendPosition(legend,chart);legend=[legend]}else{legend=[]}(0,_updater.doUpdate)({chart:chart,series:legend,key:"legendIcon",getGraphConfig:getIconConfig});(0,_updater.doUpdate)({chart:chart,series:legend,key:"legendText",getGraphConfig:getTextConfig})}function initLegendData(legend){var data=legend.data;legend.data=data.map(function(item){var itemType=(0,_typeof2["default"])(item);if(itemType==="string"){return{name:item}}else if(itemType==="object"){return item}return{name:""}});return legend}function filterInvalidData(legend,option,chart){var series=option.series;var legendStatus=chart.legendStatus;var data=legend.data.filter(function(item){var name=item.name;var result=series.find(function(_ref){var sn=_ref.name;return name===sn});if(!result)return false;if(!item.color)item.color=result.color;if(!item.icon)item.icon=result.type;return item});if(!legendStatus||legendStatus.length!==legend.data.length)legendStatus=new Array(legend.data.length).fill(true);data.forEach(function(item,i){return item.status=legendStatus[i]});legend.data=data;chart.legendStatus=legendStatus;return legend}function calcLegendTextWidth(legend,chart){var ctx=chart.render.ctx;var data=legend.data,textStyle=legend.textStyle,textUnselectedStyle=legend.textUnselectedStyle;data.forEach(function(item){var status=item.status,name=item.name;item.textWidth=getTextWidth(ctx,name,status?textStyle:textUnselectedStyle)});return legend}function getTextWidth(ctx,text,style){ctx.font=getFontConfig(style);return ctx.measureText(text).width}function getFontConfig(style){var fontFamily=style.fontFamily,fontSize=style.fontSize;return"".concat(fontSize,"px ").concat(fontFamily)}function calcLegendPosition(legend,chart){var orient=legend.orient;if(orient==="vertical"){calcVerticalPosition(legend,chart)}else{calcHorizontalPosition(legend,chart)}return legend}function calcHorizontalPosition(legend,chart){var iconHeight=legend.iconHeight,itemGap=legend.itemGap;var lines=calcDefaultHorizontalPosition(legend,chart);var xOffsets=lines.map(function(line){return getHorizontalXOffset(line,legend,chart)});var yOffset=getHorizontalYOffset(legend,chart);var align={textAlign:"left",textBaseline:"middle"};lines.forEach(function(line,i){return line.forEach(function(item){var iconPosition=item.iconPosition,textPosition=item.textPosition;var xOffset=xOffsets[i];var realYOffset=yOffset+i*(itemGap+iconHeight);item.iconPosition=mergeOffset(iconPosition,[xOffset,realYOffset]);item.textPosition=mergeOffset(textPosition,[xOffset,realYOffset]);item.align=align})})}function calcDefaultHorizontalPosition(legend,chart){var data=legend.data,iconWidth=legend.iconWidth;var w=chart.render.area[0];var startIndex=0;var lines=[[]];data.forEach(function(item,i){var beforeWidth=getBeforeWidth(startIndex,i,legend);var endXPos=beforeWidth+iconWidth+5+item.textWidth;if(endXPos>=w){startIndex=i;beforeWidth=getBeforeWidth(startIndex,i,legend);lines.push([])}item.iconPosition=[beforeWidth,0];item.textPosition=[beforeWidth+iconWidth+5,0];lines.slice(-1)[0].push(item)});return lines}function getBeforeWidth(startIndex,currentIndex,legend){var data=legend.data,iconWidth=legend.iconWidth,itemGap=legend.itemGap;var beforeItem=data.slice(startIndex,currentIndex);return(0,_util2.mulAdd)(beforeItem.map(function(_ref2){var textWidth=_ref2.textWidth;return textWidth}))+(currentIndex-startIndex)*(itemGap+5+iconWidth)}function getHorizontalXOffset(data,legend,chart){var left=legend.left,right=legend.right,iconWidth=legend.iconWidth,itemGap=legend.itemGap;var w=chart.render.area[0];var dataNum=data.length;var allWidth=(0,_util2.mulAdd)(data.map(function(_ref3){var textWidth=_ref3.textWidth;return textWidth}))+dataNum*(5+iconWidth)+(dataNum-1)*itemGap;var horizontal=[left,right].findIndex(function(pos){return pos!=="auto"});if(horizontal===-1){return(w-allWidth)/2}else if(horizontal===0){if(typeof left==="number")return left;return parseInt(left)/100*w}else{if(typeof right!=="number")right=parseInt(right)/100*w;return w-(allWidth+right)}}function getHorizontalYOffset(legend,chart){var top=legend.top,bottom=legend.bottom,iconHeight=legend.iconHeight;var h=chart.render.area[1];var vertical=[top,bottom].findIndex(function(pos){return pos!=="auto"});var halfIconHeight=iconHeight/2;if(vertical===-1){var _chart$gridArea=chart.gridArea,y=_chart$gridArea.y,height=_chart$gridArea.h;return y+height+45-halfIconHeight}else if(vertical===0){if(typeof top==="number")return top-halfIconHeight;return parseInt(top)/100*h-halfIconHeight}else{if(typeof bottom!=="number")bottom=parseInt(bottom)/100*h;return h-bottom-halfIconHeight}}function mergeOffset(_ref4,_ref5){var _ref6=(0,_slicedToArray2["default"])(_ref4,2),x=_ref6[0],y=_ref6[1];var _ref7=(0,_slicedToArray2["default"])(_ref5,2),ox=_ref7[0],oy=_ref7[1];return[x+ox,y+oy]}function calcVerticalPosition(legend,chart){var _getVerticalXOffset=getVerticalXOffset(legend,chart),_getVerticalXOffset2=(0,_slicedToArray2["default"])(_getVerticalXOffset,2),isRight=_getVerticalXOffset2[0],xOffset=_getVerticalXOffset2[1];var yOffset=getVerticalYOffset(legend,chart);calcDefaultVerticalPosition(legend,isRight);var align={textAlign:"left",textBaseline:"middle"};legend.data.forEach(function(item){var textPosition=item.textPosition,iconPosition=item.iconPosition;item.textPosition=mergeOffset(textPosition,[xOffset,yOffset]);item.iconPosition=mergeOffset(iconPosition,[xOffset,yOffset]);item.align=align})}function getVerticalXOffset(legend,chart){var left=legend.left,right=legend.right;var w=chart.render.area[0];var horizontal=[left,right].findIndex(function(pos){return pos!=="auto"});if(horizontal===-1){return[true,w-10]}else{var offset=[left,right][horizontal];if(typeof offset!=="number")offset=parseInt(offset)/100*w;return[Boolean(horizontal),offset]}}function getVerticalYOffset(legend,chart){var iconHeight=legend.iconHeight,itemGap=legend.itemGap,data=legend.data,top=legend.top,bottom=legend.bottom;var h=chart.render.area[1];var dataNum=data.length;var allHeight=dataNum*iconHeight+(dataNum-1)*itemGap;var vertical=[top,bottom].findIndex(function(pos){return pos!=="auto"});if(vertical===-1){return(h-allHeight)/2}else{var offset=[top,bottom][vertical];if(typeof offset!=="number")offset=parseInt(offset)/100*h;if(vertical===1)offset=h-offset-allHeight;return offset}}function calcDefaultVerticalPosition(legend,isRight){var data=legend.data,iconWidth=legend.iconWidth,iconHeight=legend.iconHeight,itemGap=legend.itemGap;var halfIconHeight=iconHeight/2;data.forEach(function(item,i){var textWidth=item.textWidth;var yPos=(iconHeight+itemGap)*i+halfIconHeight;var iconXPos=isRight?0-iconWidth:0;var textXpos=isRight?iconXPos-5-textWidth:iconWidth+5;item.iconPosition=[iconXPos,yPos];item.textPosition=[textXpos,yPos]})}function getIconConfig(legendItem,updater){var data=legendItem.data,selectAble=legendItem.selectAble,animationCurve=legendItem.animationCurve,animationFrame=legendItem.animationFrame,rLevel=legendItem.rLevel;return data.map(function(item,i){return(0,_defineProperty2["default"])({name:item.icon==="line"?"lineIcon":"rect",index:rLevel,visible:legendItem.show,hover:selectAble,click:selectAble,animationCurve:animationCurve,animationFrame:animationFrame,shape:getIconShape(legendItem,i),style:getIconStyle(legendItem,i)},"click",createClickCallBack(legendItem,i,updater))})}function getIconShape(legendItem,i){var data=legendItem.data,iconWidth=legendItem.iconWidth,iconHeight=legendItem.iconHeight;var _data$i$iconPosition=(0,_slicedToArray2["default"])(data[i].iconPosition,2),x=_data$i$iconPosition[0],y=_data$i$iconPosition[1];var halfIconHeight=iconHeight/2;return{x:x,y:y-halfIconHeight,w:iconWidth,h:iconHeight}}function getIconStyle(legendItem,i){var data=legendItem.data,iconStyle=legendItem.iconStyle,iconUnselectedStyle=legendItem.iconUnselectedStyle;var _data$i=data[i],status=_data$i.status,color=_data$i.color;var style=status?iconStyle:iconUnselectedStyle;return(0,_util2.deepMerge)({fill:color},style)}function getTextConfig(legendItem,updater){var data=legendItem.data,selectAble=legendItem.selectAble,animationCurve=legendItem.animationCurve,animationFrame=legendItem.animationFrame,rLevel=legendItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:legendItem.show,hover:selectAble,animationCurve:animationCurve,animationFrame:animationFrame,hoverRect:getTextHoverRect(legendItem,i),shape:getTextShape(legendItem,i),style:getTextStyle(legendItem,i),click:createClickCallBack(legendItem,i,updater)}})}function getTextShape(legendItem,i){var _legendItem$data$i=legendItem.data[i],textPosition=_legendItem$data$i.textPosition,name=_legendItem$data$i.name;return{content:name,position:textPosition}}function getTextStyle(legendItem,i){var textStyle=legendItem.textStyle,textUnselectedStyle=legendItem.textUnselectedStyle;var _legendItem$data$i2=legendItem.data[i],status=_legendItem$data$i2.status,align=_legendItem$data$i2.align;var style=status?textStyle:textUnselectedStyle;return(0,_util2.deepMerge)((0,_util.deepClone)(style,true),align)}function getTextHoverRect(legendItem,i){var textStyle=legendItem.textStyle,textUnselectedStyle=legendItem.textUnselectedStyle;var _legendItem$data$i3=legendItem.data[i],status=_legendItem$data$i3.status,_legendItem$data$i3$t=(0,_slicedToArray2["default"])(_legendItem$data$i3.textPosition,2),x=_legendItem$data$i3$t[0],y=_legendItem$data$i3$t[1],textWidth=_legendItem$data$i3.textWidth;var style=status?textStyle:textUnselectedStyle;var fontSize=style.fontSize;return[x,y-fontSize/2,textWidth,fontSize]}function createClickCallBack(legendItem,index,updater){var name=legendItem.data[index].name;return function(){var _updater$chart=updater.chart,legendStatus=_updater$chart.legendStatus,option=_updater$chart.option;var status=!legendStatus[index];var change=option.series.find(function(_ref9){var sn=_ref9.name;return sn===name});change.show=status;legendStatus[index]=status;updater.chart.setOption(option)}}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],22:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.line=line;var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _updater=require("../class/updater.class");var _config=require("../config");var _bezierCurve=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var xAxis=option.xAxis,yAxis=option.yAxis,series=option.series;var lines=[];if(xAxis&&yAxis&&series){lines=(0,_util.initNeedSeries)(series,_config.lineConfig,"line");lines=calcLinesPosition(lines,chart)}(0,_updater.doUpdate)({chart:chart,series:lines,key:"lineArea",getGraphConfig:getLineAreaConfig,getStartGraphConfig:getStartLineAreaConfig,beforeUpdate:beforeUpdateLineAndArea,beforeChange:beforeChangeLineAndArea});(0,_updater.doUpdate)({chart:chart,series:lines,key:"line",getGraphConfig:getLineConfig,getStartGraphConfig:getStartLineConfig,beforeUpdate:beforeUpdateLineAndArea,beforeChange:beforeChangeLineAndArea});(0,_updater.doUpdate)({chart:chart,series:lines,key:"linePoint",getGraphConfig:getPointConfig,getStartGraphConfig:getStartPointConfig});(0,_updater.doUpdate)({chart:chart,series:lines,key:"lineLabel",getGraphConfig:getLabelConfig})}function calcLinesPosition(lines,chart){var axisData=chart.axisData;return lines.map(function(lineItem){var lineData=(0,_util.mergeSameStackData)(lineItem,lines);lineData=mergeNonNumber(lineItem,lineData);var lineAxis=getLineAxis(lineItem,axisData);var linePosition=getLinePosition(lineData,lineAxis);var lineFillBottomPos=getLineFillBottomPos(lineAxis);return _objectSpread({},lineItem,{linePosition:linePosition.filter(function(p){return p}),lineFillBottomPos:lineFillBottomPos})})}function mergeNonNumber(lineItem,lineData){var data=lineItem.data;return lineData.map(function(v,i){return typeof data[i]==="number"?v:null})}function getLineAxis(line,axisData){var xAxisIndex=line.xAxisIndex,yAxisIndex=line.yAxisIndex;var xAxis=axisData.find(function(_ref){var axis=_ref.axis,index=_ref.index;return axis==="x"&&index===xAxisIndex});var yAxis=axisData.find(function(_ref2){var axis=_ref2.axis,index=_ref2.index;return axis==="y"&&index===yAxisIndex});return[xAxis,yAxis]}function getLinePosition(lineData,lineAxis){var valueAxisIndex=lineAxis.findIndex(function(_ref3){var data=_ref3.data;return data==="value"});var valueAxis=lineAxis[valueAxisIndex];var labelAxis=lineAxis[1-valueAxisIndex];var linePosition=valueAxis.linePosition,axis=valueAxis.axis;var tickPosition=labelAxis.tickPosition;var tickNum=tickPosition.length;var valueAxisPosIndex=axis==="x"?0:1;var valueAxisStartPos=linePosition[0][valueAxisPosIndex];var valueAxisEndPos=linePosition[1][valueAxisPosIndex];var valueAxisPosMinus=valueAxisEndPos-valueAxisStartPos;var maxValue=valueAxis.maxValue,minValue=valueAxis.minValue;var valueMinus=maxValue-minValue;var position=new Array(tickNum).fill(0).map(function(foo,i){var v=lineData[i];if(typeof v!=="number")return null;var valuePercent=(v-minValue)/valueMinus;if(valueMinus===0)valuePercent=0;return valuePercent*valueAxisPosMinus+valueAxisStartPos});return position.map(function(vPos,i){if(i>=tickNum||typeof vPos!=="number")return null;var pos=[vPos,tickPosition[i][1-valueAxisPosIndex]];if(valueAxisPosIndex===0)return pos;pos.reverse();return pos})}function getLineFillBottomPos(lineAxis){var valueAxis=lineAxis.find(function(_ref4){var data=_ref4.data;return data==="value"});var axis=valueAxis.axis,linePosition=valueAxis.linePosition,minValue=valueAxis.minValue,maxValue=valueAxis.maxValue;var changeIndex=axis==="x"?0:1;var changeValue=linePosition[0][changeIndex];if(minValue<0&&maxValue>0){var valueMinus=maxValue-minValue;var posMinus=Math.abs(linePosition[0][changeIndex]-linePosition[1][changeIndex]);var offset=Math.abs(minValue)/valueMinus*posMinus;if(axis==="y")offset*=-1;changeValue+=offset}return{changeIndex:changeIndex,changeValue:changeValue}}function getLineAreaConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,lineFillBottomPos=lineItem.lineFillBottomPos,rLevel=lineItem.rLevel;return[{name:getLineGraphName(lineItem),index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,visible:lineItem.lineArea.show,lineFillBottomPos:lineFillBottomPos,shape:getLineAndAreaShape(lineItem),style:getLineAreaStyle(lineItem),drawed:lineAreaDrawed}]}function getLineAndAreaShape(lineItem){var linePosition=lineItem.linePosition;return{points:linePosition}}function getLineAreaStyle(lineItem){var lineArea=lineItem.lineArea,color=lineItem.color;var gradient=lineArea.gradient,style=lineArea.style;var fillColor=[style.fill||color];var gradientColor=(0,_util.deepMerge)(fillColor,gradient);if(gradientColor.length===1)gradientColor.push(gradientColor[0]);var gradientParams=getGradientParams(lineItem);style=_objectSpread({},style,{stroke:"rgba(0, 0, 0, 0)"});return(0,_util.deepMerge)({gradientColor:gradientColor,gradientParams:gradientParams,gradientType:"linear",gradientWith:"fill"},style)}function getGradientParams(lineItem){var lineFillBottomPos=lineItem.lineFillBottomPos,linePosition=lineItem.linePosition;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;var mainPos=linePosition.map(function(p){return p[changeIndex]});var maxPos=Math.max.apply(Math,(0,_toConsumableArray2["default"])(mainPos));var minPos=Math.min.apply(Math,(0,_toConsumableArray2["default"])(mainPos));var beginPos=maxPos;if(changeIndex===1)beginPos=minPos;if(changeIndex===1){return[0,beginPos,0,changeValue]}else{return[beginPos,0,changeValue,0]}}function lineAreaDrawed(_ref5,_ref6){var lineFillBottomPos=_ref5.lineFillBottomPos,shape=_ref5.shape;var ctx=_ref6.ctx;var points=shape.points;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;var linePoint1=(0,_toConsumableArray2["default"])(points[points.length-1]);var linePoint2=(0,_toConsumableArray2["default"])(points[0]);linePoint1[changeIndex]=changeValue;linePoint2[changeIndex]=changeValue;ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(linePoint1));ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(linePoint2));ctx.closePath();ctx.fill()}function getStartLineAreaConfig(lineItem){var config=getLineAreaConfig(lineItem)[0];var style=_objectSpread({},config.style);style.opacity=0;config.style=style;return[config]}function beforeUpdateLineAndArea(graphs,lineItem,i,updater){var cache=graphs[i];if(!cache)return;var currentName=getLineGraphName(lineItem);var render=updater.chart.render;var name=cache[0].name;var delAll=currentName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeLineAndArea(graph,config){var points=config.shape.points;var graphPoints=graph.shape.points;var graphPointsNum=graphPoints.length;var pointsNum=points.length;if(pointsNum>graphPointsNum){var lastPoint=graphPoints.slice(-1)[0];var newAddPoints=new Array(pointsNum-graphPointsNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(lastPoint)});graphPoints.push.apply(graphPoints,(0,_toConsumableArray2["default"])(newAddPoints))}else if(pointsNum1&&arguments[1]!==undefined?arguments[1]:false;if(!smooth)return(0,_util.getPolylineLength)(points);var curve=polylineToBezierCurve(points);return getBezierCurveLength(curve)}function getStartLineConfig(lineItem){var lineDash=lineItem.lineStyle.lineDash;var config=getLineConfig(lineItem)[0];var realLineDash=config.style.lineDash;if(lineDash){realLineDash=[0,0]}else{realLineDash=(0,_toConsumableArray2["default"])(realLineDash).reverse()}config.style.lineDash=realLineDash;return[config]}function getPointConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,rLevel=lineItem.rLevel;var shapes=getPointShapes(lineItem);var style=getPointStyle(lineItem);return shapes.map(function(shape){return{name:"circle",index:rLevel+2,visible:lineItem.linePoint.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getPointShapes(lineItem){var linePosition=lineItem.linePosition,radius=lineItem.linePoint.radius;return linePosition.map(function(_ref7){var _ref8=(0,_slicedToArray2["default"])(_ref7,2),rx=_ref8[0],ry=_ref8[1];return{r:radius,rx:rx,ry:ry}})}function getPointStyle(lineItem){var color=lineItem.color,style=lineItem.linePoint.style;return(0,_util.deepMerge)({stroke:color},style)}function getStartPointConfig(lineItem){var configs=getPointConfig(lineItem);configs.forEach(function(config){config.shape.r=.1});return configs}function getLabelConfig(lineItem){var animationCurve=lineItem.animationCurve,animationFrame=lineItem.animationFrame,rLevel=lineItem.rLevel;var shapes=getLabelShapes(lineItem);var style=getLabelStyle(lineItem);return shapes.map(function(shape,i){return{name:"text",index:rLevel+3,visible:lineItem.label.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}})}function getLabelShapes(lineItem){var contents=formatterLabel(lineItem);var position=getLabelPosition(lineItem);return contents.map(function(content,i){return{content:content,position:position[i]}})}function getLabelPosition(lineItem){var linePosition=lineItem.linePosition,lineFillBottomPos=lineItem.lineFillBottomPos,label=lineItem.label;var position=label.position,offset=label.offset;var changeIndex=lineFillBottomPos.changeIndex,changeValue=lineFillBottomPos.changeValue;return linePosition.map(function(pos){if(position==="bottom"){pos=(0,_toConsumableArray2["default"])(pos);pos[changeIndex]=changeValue}if(position==="center"){var bottom=(0,_toConsumableArray2["default"])(pos);bottom[changeIndex]=changeValue;pos=getCenterLabelPoint(pos,bottom)}return getOffsetedPoint(pos,offset)})}function getOffsetedPoint(_ref9,_ref10){var _ref11=(0,_slicedToArray2["default"])(_ref9,2),x=_ref11[0],y=_ref11[1];var _ref12=(0,_slicedToArray2["default"])(_ref10,2),ox=_ref12[0],oy=_ref12[1];return[x+ox,y+oy]}function getCenterLabelPoint(_ref13,_ref14){var _ref15=(0,_slicedToArray2["default"])(_ref13,2),ax=_ref15[0],ay=_ref15[1];var _ref16=(0,_slicedToArray2["default"])(_ref14,2),bx=_ref16[0],by=_ref16[1];return[(ax+bx)/2,(ay+by)/2]}function formatterLabel(lineItem){var data=lineItem.data,formatter=lineItem.label.formatter;data=data.filter(function(d){return typeof d==="number"}).map(function(d){return d.toString()});if(!formatter)return data;var type=(0,_typeof2["default"])(formatter);if(type==="string")return data.map(function(d){return formatter.replace("{value}",d)});if(type==="function")return data.map(function(value,index){return formatter({value:value,index:index})});return data}function getLabelStyle(lineItem){var color=lineItem.color,style=lineItem.label.style;return(0,_util.deepMerge)({fill:color},style)}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/bezier-curve":47}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.mergeColor=mergeColor;var _config=require("../config");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function mergeColor(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var defaultColor=(0,_util.deepClone)(_config.colorConfig,true);var color=option.color,series=option.series;if(!series)series=[];if(!color)color=[];option.color=color=(0,_util2.deepMerge)(defaultColor,color);if(!series.length)return;var colorNum=color.length;series.forEach(function(item,i){if(item.color)return;item.color=color[i%colorNum]});var pies=series.filter(function(_ref){var type=_ref.type;return type==="pie"});pies.forEach(function(pie){return pie.data.forEach(function(di,i){return di.color=color[i%colorNum]})});var gauges=series.filter(function(_ref2){var type=_ref2.type;return type==="gauge"});gauges.forEach(function(gauge){return gauge.data.forEach(function(di,i){return di.color=color[i%colorNum]})})}},{"../config":9,"../util":30,"@jiaminghi/c-render/lib/plugin/util":54}],24:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.pie=pie;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _pie=require("../config/pie");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var pies=(0,_util2.initNeedSeries)(series,_pie.pieConfig,"pie");pies=calcPiesCenter(pies,chart);pies=calcPiesRadius(pies,chart);pies=calcRosePiesRadius(pies,chart);pies=calcPiesPercent(pies);pies=calcPiesAngle(pies,chart);pies=calcPiesInsideLabelPos(pies);pies=calcPiesEdgeCenterPos(pies);pies=calcPiesOutSideLabelPos(pies);(0,_updater.doUpdate)({chart:chart,series:pies,key:"pie",getGraphConfig:getPieConfig,getStartGraphConfig:getStartPieConfig,beforeChange:beforeChangePie});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieInsideLabel",getGraphConfig:getInsideLabelConfig});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieOutsideLabelLine",getGraphConfig:getOutsideLabelLineConfig,getStartGraphConfig:getStartOutsideLabelLineConfig});(0,_updater.doUpdate)({chart:chart,series:pies,key:"pieOutsideLabel",getGraphConfig:getOutsideLabelConfig,getStartGraphConfig:getStartOutsideLabelConfig})}function calcPiesCenter(pies,chart){var area=chart.render.area;pies.forEach(function(pie){var center=pie.center;center=center.map(function(pos,i){if(typeof pos==="number")return pos;return parseInt(pos)/100*area[i]});pie.center=center});return pies}function calcPiesRadius(pies,chart){var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(chart.render.area))/2;pies.forEach(function(pie){var radius=pie.radius,data=pie.data;radius=getNumberRadius(radius,maxRadius);data.forEach(function(item){var itemRadius=item.radius;if(!itemRadius)itemRadius=radius;itemRadius=getNumberRadius(itemRadius,maxRadius);item.radius=itemRadius});pie.radius=radius});return pies}function getNumberRadius(radius,maxRadius){if(!(radius instanceof Array))radius=[0,radius];radius=radius.map(function(r){if(typeof r==="number")return r;return parseInt(r)/100*maxRadius});return radius}function calcRosePiesRadius(pies,chart){var rosePie=pies.filter(function(_ref){var roseType=_ref.roseType;return roseType});rosePie.forEach(function(pie){var radius=pie.radius,data=pie.data,roseSort=pie.roseSort;var roseIncrement=getRoseIncrement(pie);var dataCopy=(0,_toConsumableArray2["default"])(data);data=sortData(data);data.forEach(function(item,i){item.radius[1]=radius[1]-roseIncrement*i});if(roseSort){data.reverse()}else{pie.data=dataCopy}pie.roseIncrement=roseIncrement});return pies}function sortData(data){return data.sort(function(_ref2,_ref3){var a=_ref2.value;var b=_ref3.value;if(a===b)return 0;if(a>b)return-1;if(a1&&arguments[1]!==undefined?arguments[1]:true;var data=pieItem.data,center=pieItem.center;var centerXPos=center[0];return data.filter(function(_ref9){var edgeCenterPos=_ref9.edgeCenterPos;var xPos=edgeCenterPos[0];if(left)return xPos<=centerXPos;return xPos>centerXPos})}function sortPiesFromTopToBottom(dataItem){dataItem.sort(function(_ref10,_ref11){var _ref10$edgeCenterPos=(0,_slicedToArray2["default"])(_ref10.edgeCenterPos,2),t=_ref10$edgeCenterPos[0],ay=_ref10$edgeCenterPos[1];var _ref11$edgeCenterPos=(0,_slicedToArray2["default"])(_ref11.edgeCenterPos,2),tt=_ref11$edgeCenterPos[0],by=_ref11$edgeCenterPos[1];if(ay>by)return 1;if(ay2&&arguments[2]!==undefined?arguments[2]:true;var center=pieItem.center,outsideLabel=pieItem.outsideLabel;var radius=getLabelLineBendRadius(pieItem);dataItem.forEach(function(item){var edgeCenterPos=item.edgeCenterPos,startAngle=item.startAngle,endAngle=item.endAngle;var labelLineEndLength=outsideLabel.labelLineEndLength;var angle=(startAngle+endAngle)/2;var bendPoint=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(center).concat([radius,angle]));var endPoint=(0,_toConsumableArray2["default"])(bendPoint);endPoint[0]+=labelLineEndLength*(left?-1:1);item.labelLine=[edgeCenterPos,bendPoint,endPoint];item.labelLineLength=(0,_util2.getPolylineLength)(item.labelLine);item.align={textAlign:"left",textBaseline:"middle"};if(left)item.align.textAlign="right"})}function getPieConfig(pieItem){var data=pieItem.data,animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"pie",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getPieShape(pieItem,i),style:getPieStyle(pieItem,i)}})}function getStartPieConfig(pieItem){var animationDelayGap=pieItem.animationDelayGap,startAnimationCurve=pieItem.startAnimationCurve;var configs=getPieConfig(pieItem);configs.forEach(function(config,i){config.animationCurve=startAnimationCurve;config.animationDelay=i*animationDelayGap;config.shape.or=config.shape.ir});return configs}function beforeChangePie(graph){graph.animationDelay=0}function getPieShape(pieItem,i){var center=pieItem.center,data=pieItem.data;var dataItem=data[i];var radius=dataItem.radius,startAngle=dataItem.startAngle,endAngle=dataItem.endAngle;return{startAngle:startAngle,endAngle:endAngle,ir:radius[0],or:radius[1],rx:center[0],ry:center[1]}}function getPieStyle(pieItem,i){var pieStyle=pieItem.pieStyle,data=pieItem.data;var dataItem=data[i];var color=dataItem.color;return(0,_util2.deepMerge)({fill:color},pieStyle)}function getInsideLabelConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:pieItem.insideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getInsideLabelShape(pieItem,i),style:getInsideLabelStyle(pieItem,i)}})}function getInsideLabelShape(pieItem,i){var insideLabel=pieItem.insideLabel,data=pieItem.data;var formatter=insideLabel.formatter;var dataItem=data[i];var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",dataItem.name);label=label.replace("{percent}",dataItem.percent);label=label.replace("{value}",dataItem.value)}if(formatterType==="function"){label=formatter(dataItem)}return{content:label,position:dataItem.insideLabelPos}}function getInsideLabelStyle(pieItem,i){var style=pieItem.insideLabel.style;return style}function getOutsideLabelLineConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"polyline",index:rLevel,visible:pieItem.outsideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getOutsideLabelLineShape(pieItem,i),style:getOutsideLabelLineStyle(pieItem,i)}})}function getStartOutsideLabelLineConfig(pieItem){var data=pieItem.data;var configs=getOutsideLabelLineConfig(pieItem);configs.forEach(function(config,i){config.style.lineDash=[0,data[i].labelLineLength]});return configs}function getOutsideLabelLineShape(pieItem,i){var data=pieItem.data;var dataItem=data[i];return{points:dataItem.labelLine}}function getOutsideLabelLineStyle(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var labelLineStyle=outsideLabel.labelLineStyle;var color=data[i].color;return(0,_util2.deepMerge)({stroke:color,lineDash:[data[i].labelLineLength,0]},labelLineStyle)}function getOutsideLabelConfig(pieItem){var animationCurve=pieItem.animationCurve,animationFrame=pieItem.animationFrame,data=pieItem.data,rLevel=pieItem.rLevel;return data.map(function(foo,i){return{name:"text",index:rLevel,visible:pieItem.outsideLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getOutsideLabelShape(pieItem,i),style:getOutsideLabelStyle(pieItem,i)}})}function getStartOutsideLabelConfig(pieItem){var data=pieItem.data;var configs=getOutsideLabelConfig(pieItem);configs.forEach(function(config,i){config.shape.position=data[i].labelLine[1]});return configs}function getOutsideLabelShape(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var formatter=outsideLabel.formatter;var _data$i=data[i],labelLine=_data$i.labelLine,name=_data$i.name,percent=_data$i.percent,value=_data$i.value;var formatterType=(0,_typeof2["default"])(formatter);var label="";if(formatterType==="string"){label=formatter.replace("{name}",name);label=label.replace("{percent}",percent);label=label.replace("{value}",value)}if(formatterType==="function"){label=formatter(data[i])}return{content:label,position:labelLine[2]}}function getOutsideLabelStyle(pieItem,i){var outsideLabel=pieItem.outsideLabel,data=pieItem.data;var _data$i2=data[i],color=_data$i2.color,align=_data$i2.align;var style=outsideLabel.style;return(0,_util2.deepMerge)(_objectSpread({fill:color},align),style)}},{"../class/updater.class":3,"../config/pie":12,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],25:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.radar=radar;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _updater=require("../class/updater.class");var _index=require("../config/index");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _util2=require("../util");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i1&&arguments[1]!==undefined?arguments[1]:{};var series=option.series;if(!series)series=[];var radars=(0,_util2.initNeedSeries)(series,_index.radarConfig,"radar");radars=calcRadarPosition(radars,chart);radars=calcRadarLabelPosition(radars,chart);radars=calcRadarLabelAlign(radars,chart);(0,_updater.doUpdate)({chart:chart,series:radars,key:"radar",getGraphConfig:getRadarConfig,getStartGraphConfig:getStartRadarConfig,beforeChange:beforeChangeRadar});(0,_updater.doUpdate)({chart:chart,series:radars,key:"radarPoint",getGraphConfig:getPointConfig,getStartGraphConfig:getStartPointConfig});(0,_updater.doUpdate)({chart:chart,series:radars,key:"radarLabel",getGraphConfig:getLabelConfig})}function calcRadarPosition(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var indicator=radarAxis.indicator,axisLineAngles=radarAxis.axisLineAngles,radius=radarAxis.radius,centerPos=radarAxis.centerPos;radars.forEach(function(radarItem){var data=radarItem.data;radarItem.dataRadius=[];radarItem.radarPosition=indicator.map(function(_ref,i){var max=_ref.max,min=_ref.min;var v=data[i];if(typeof max!=="number")max=v;if(typeof min!=="number")min=0;if(typeof v!=="number")v=min;var dataRadius=(v-min)/(max-min)*radius;radarItem.dataRadius[i]=dataRadius;return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([dataRadius,axisLineAngles[i]]))})});return radars}function calcRadarLabelPosition(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var centerPos=radarAxis.centerPos,axisLineAngles=radarAxis.axisLineAngles;radars.forEach(function(radarItem){var dataRadius=radarItem.dataRadius,label=radarItem.label;var labelGap=label.labelGap;radarItem.labelPosition=dataRadius.map(function(r,i){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([r+labelGap,axisLineAngles[i]]))})});return radars}function calcRadarLabelAlign(radars,chart){var radarAxis=chart.radarAxis;if(!radarAxis)return[];var _radarAxis$centerPos=(0,_slicedToArray2["default"])(radarAxis.centerPos,2),x=_radarAxis$centerPos[0],y=_radarAxis$centerPos[1];radars.forEach(function(radarItem){var labelPosition=radarItem.labelPosition;var labelAlign=labelPosition.map(function(_ref2){var _ref3=(0,_slicedToArray2["default"])(_ref2,2),lx=_ref3[0],ly=_ref3[1];var textAlign=lx>x?"left":"right";var textBaseline=ly>y?"top":"bottom";return{textAlign:textAlign,textBaseline:textBaseline}});radarItem.labelAlign=labelAlign});return radars}function getRadarConfig(radarItem){var animationCurve=radarItem.animationCurve,animationFrame=radarItem.animationFrame,rLevel=radarItem.rLevel;return[{name:"polyline",index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,shape:getRadarShape(radarItem),style:getRadarStyle(radarItem)}]}function getStartRadarConfig(radarItem,updater){var centerPos=updater.chart.radarAxis.centerPos;var config=getRadarConfig(radarItem)[0];var pointNum=config.shape.points.length;var points=new Array(pointNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(centerPos)});config.shape.points=points;return[config]}function getRadarShape(radarItem){var radarPosition=radarItem.radarPosition;return{points:radarPosition,close:true}}function getRadarStyle(radarItem){var radarStyle=radarItem.radarStyle,color=radarItem.color;var colorRgbaValue=(0,_color.getRgbaValue)(color);colorRgbaValue[3]=.5;var radarDefaultColor={stroke:color,fill:(0,_color.getColorFromRgbValue)(colorRgbaValue)};return(0,_util2.deepMerge)(radarDefaultColor,radarStyle)}function beforeChangeRadar(graph,_ref4){var shape=_ref4.shape;var graphPoints=graph.shape.points;var graphPointsNum=graphPoints.length;var pointsNum=shape.points.length;if(pointsNum>graphPointsNum){var lastPoint=graphPoints.slice(-1)[0];var newAddPoints=new Array(pointsNum-graphPointsNum).fill(0).map(function(foo){return(0,_toConsumableArray2["default"])(lastPoint)});graphPoints.push.apply(graphPoints,(0,_toConsumableArray2["default"])(newAddPoints))}else if(pointsNum1&&arguments[1]!==undefined?arguments[1]:{};var radar=option.radar;var radarAxis=[];if(radar){radarAxis=mergeRadarAxisDefaultConfig(radar);radarAxis=calcRadarAxisCenter(radarAxis,chart);radarAxis=calcRadarAxisRingRadius(radarAxis,chart);radarAxis=calcRadarAxisLinePosition(radarAxis);radarAxis=calcRadarAxisAreaRadius(radarAxis);radarAxis=calcRadarAxisLabelPosition(radarAxis);radarAxis=[radarAxis]}var radarAxisForUpdate=radarAxis;if(radarAxis.length&&!radarAxis[0].show)radarAxisForUpdate=[];(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisSplitArea",getGraphConfig:getSplitAreaConfig,beforeUpdate:beforeUpdateSplitArea,beforeChange:beforeChangeSplitArea});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisSplitLine",getGraphConfig:getSplitLineConfig,beforeUpdate:beforeUpdateSplitLine,beforeChange:beforeChangeSplitLine});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisLine",getGraphConfig:getAxisLineConfig});(0,_updater.doUpdate)({chart:chart,series:radarAxisForUpdate,key:"radarAxisLable",getGraphConfig:getAxisLabelConfig});chart.radarAxis=radarAxis[0]}function mergeRadarAxisDefaultConfig(radar){return(0,_util2.deepMerge)((0,_util.deepClone)(_index.radarAxisConfig),radar)}function calcRadarAxisCenter(radarAxis,chart){var area=chart.render.area;var center=radarAxis.center;radarAxis.centerPos=center.map(function(v,i){if(typeof v==="number")return v;return parseInt(v)/100*area[i]});return radarAxis}function calcRadarAxisRingRadius(radarAxis,chart){var area=chart.render.area;var splitNum=radarAxis.splitNum,radius=radarAxis.radius;var maxRadius=Math.min.apply(Math,(0,_toConsumableArray2["default"])(area))/2;if(typeof radius!=="number")radius=parseInt(radius)/100*maxRadius;var splitGap=radius/splitNum;radarAxis.ringRadius=new Array(splitNum).fill(0).map(function(foo,i){return splitGap*(i+1)});radarAxis.radius=radius;return radarAxis}function calcRadarAxisLinePosition(radarAxis){var indicator=radarAxis.indicator,centerPos=radarAxis.centerPos,radius=radarAxis.radius,startAngle=radarAxis.startAngle;var fullAngle=Math.PI*2;var indicatorNum=indicator.length;var indicatorGap=fullAngle/indicatorNum;var angles=new Array(indicatorNum).fill(0).map(function(foo,i){return indicatorGap*i+startAngle});radarAxis.axisLineAngles=angles;radarAxis.axisLinePosition=angles.map(function(g){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([radius,g]))});return radarAxis}function calcRadarAxisAreaRadius(radarAxis){var ringRadius=radarAxis.ringRadius;var subRadius=ringRadius[0]/2;radarAxis.areaRadius=ringRadius.map(function(r){return r-subRadius});return radarAxis}function calcRadarAxisLabelPosition(radarAxis){var axisLineAngles=radarAxis.axisLineAngles,centerPos=radarAxis.centerPos,radius=radarAxis.radius,axisLabel=radarAxis.axisLabel;radius+=axisLabel.labelGap;radarAxis.axisLabelPosition=axisLineAngles.map(function(angle){return _util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([radius,angle]))});return radarAxis}function getSplitAreaConfig(radarAxis){var areaRadius=radarAxis.areaRadius,polygon=radarAxis.polygon,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;var name=polygon?"regPolygon":"ring";return areaRadius.map(function(foo,i){return{name:name,index:rLevel,visible:radarAxis.splitArea.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getSplitAreaShape(radarAxis,i),style:getSplitAreaStyle(radarAxis,i)}})}function getSplitAreaShape(radarAxis,i){var polygon=radarAxis.polygon,areaRadius=radarAxis.areaRadius,indicator=radarAxis.indicator,centerPos=radarAxis.centerPos;var indicatorNum=indicator.length;var shape={rx:centerPos[0],ry:centerPos[1],r:areaRadius[i]};if(polygon)shape.side=indicatorNum;return shape}function getSplitAreaStyle(radarAxis,i){var splitArea=radarAxis.splitArea,ringRadius=radarAxis.ringRadius,axisLineAngles=radarAxis.axisLineAngles,polygon=radarAxis.polygon,centerPos=radarAxis.centerPos;var color=splitArea.color,style=splitArea.style;style=_objectSpread({fill:"rgba(0, 0, 0, 0)"},style);var lineWidth=ringRadius[0]-0;if(polygon){var point1=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([ringRadius[0],axisLineAngles[0]]));var point2=_util.getCircleRadianPoint.apply(void 0,(0,_toConsumableArray2["default"])(centerPos).concat([ringRadius[0],axisLineAngles[1]]));lineWidth=(0,_util2.getPointToLineDistance)(centerPos,point1,point2)}style=(0,_util2.deepMerge)((0,_util.deepClone)(style,true),{lineWidth:lineWidth});if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function beforeUpdateSplitArea(graphs,radarAxis,i,updater){var cache=graphs[i];if(!cache)return;var render=updater.chart.render;var polygon=radarAxis.polygon;var name=cache[0].name;var currentName=polygon?"regPolygon":"ring";var delAll=currentName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeSplitArea(graph,config){var side=config.shape.side;if(typeof side!=="number")return;graph.shape.side=side}function getSplitLineConfig(radarAxis){var ringRadius=radarAxis.ringRadius,polygon=radarAxis.polygon,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;var name=polygon?"regPolygon":"ring";return ringRadius.map(function(foo,i){return{name:name,index:rLevel,animationCurve:animationCurve,animationFrame:animationFrame,visible:radarAxis.splitLine.show,shape:getSplitLineShape(radarAxis,i),style:getSplitLineStyle(radarAxis,i)}})}function getSplitLineShape(radarAxis,i){var ringRadius=radarAxis.ringRadius,centerPos=radarAxis.centerPos,indicator=radarAxis.indicator,polygon=radarAxis.polygon;var shape={rx:centerPos[0],ry:centerPos[1],r:ringRadius[i]};var indicatorNum=indicator.length;if(polygon)shape.side=indicatorNum;return shape}function getSplitLineStyle(radarAxis,i){var splitLine=radarAxis.splitLine;var color=splitLine.color,style=splitLine.style;style=_objectSpread({fill:"rgba(0, 0, 0, 0)"},style);if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function beforeUpdateSplitLine(graphs,radarAxis,i,updater){var cache=graphs[i];if(!cache)return;var render=updater.chart.render;var polygon=radarAxis.polygon;var name=cache[0].name;var currenName=polygon?"regPolygon":"ring";var delAll=currenName!==name;if(!delAll)return;cache.forEach(function(g){return render.delGraph(g)});graphs[i]=null}function beforeChangeSplitLine(graph,config){var side=config.shape.side;if(typeof side!=="number")return;graph.shape.side=side}function getAxisLineConfig(radarAxis){var axisLinePosition=radarAxis.axisLinePosition,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;return axisLinePosition.map(function(foo,i){return{name:"polyline",index:rLevel,visible:radarAxis.axisLine.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLineShape(radarAxis,i),style:getAxisLineStyle(radarAxis,i)}})}function getAxisLineShape(radarAxis,i){var centerPos=radarAxis.centerPos,axisLinePosition=radarAxis.axisLinePosition;var points=[centerPos,axisLinePosition[i]];return{points:points}}function getAxisLineStyle(radarAxis,i){var axisLine=radarAxis.axisLine;var color=axisLine.color,style=axisLine.style;if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{stroke:color[i%colorNum]})}function getAxisLabelConfig(radarAxis){var axisLabelPosition=radarAxis.axisLabelPosition,animationCurve=radarAxis.animationCurve,animationFrame=radarAxis.animationFrame,rLevel=radarAxis.rLevel;return axisLabelPosition.map(function(foo,i){return{name:"text",index:rLevel,visible:radarAxis.axisLabel.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:getAxisLableShape(radarAxis,i),style:getAxisLableStyle(radarAxis,i)}})}function getAxisLableShape(radarAxis,i){var axisLabelPosition=radarAxis.axisLabelPosition,indicator=radarAxis.indicator;return{content:indicator[i].name,position:axisLabelPosition[i]}}function getAxisLableStyle(radarAxis,i){var axisLabel=radarAxis.axisLabel,_radarAxis$centerPos=(0,_slicedToArray2["default"])(radarAxis.centerPos,2),x=_radarAxis$centerPos[0],y=_radarAxis$centerPos[1],axisLabelPosition=radarAxis.axisLabelPosition;var color=axisLabel.color,style=axisLabel.style;var _axisLabelPosition$i=(0,_slicedToArray2["default"])(axisLabelPosition[i],2),labelXpos=_axisLabelPosition$i[0],labelYPos=_axisLabelPosition$i[1];var textAlign=labelXpos>x?"left":"right";var textBaseline=labelYPos>y?"top":"bottom";style=(0,_util2.deepMerge)({textAlign:textAlign,textBaseline:textBaseline},style);if(!color.length)return style;var colorNum=color.length;return(0,_util2.deepMerge)(style,{fill:color[i%colorNum]})}},{"../class/updater.class":3,"../config/index":9,"../util":30,"@babel/runtime/helpers/defineProperty":35,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render/lib/plugin/util":54}],27:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.title=title;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _updater=require("../class/updater.class");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _config=require("../config");var _util2=require("../util");function title(chart){var option=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var title=[];if(option.title){title[0]=(0,_util2.deepMerge)((0,_util.deepClone)(_config.titleConfig,true),option.title)}(0,_updater.doUpdate)({chart:chart,series:title,key:"title",getGraphConfig:getTitleConfig})}function getTitleConfig(titleItem,updater){var animationCurve=_config.titleConfig.animationCurve,animationFrame=_config.titleConfig.animationFrame,rLevel=_config.titleConfig.rLevel;var shape=getTitleShape(titleItem,updater);var style=getTitleStyle(titleItem);return[{name:"text",index:rLevel,visible:titleItem.show,animationCurve:animationCurve,animationFrame:animationFrame,shape:shape,style:style}]}function getTitleShape(titleItem,updater){var offset=titleItem.offset,text=titleItem.text;var _updater$chart$gridAr=updater.chart.gridArea,x=_updater$chart$gridAr.x,y=_updater$chart$gridAr.y,w=_updater$chart$gridAr.w;var _offset=(0,_slicedToArray2["default"])(offset,2),ox=_offset[0],oy=_offset[1];return{content:text,position:[x+w/2+ox,y+oy]}}function getTitleStyle(titleItem){var style=titleItem.style;return style}},{"../class/updater.class":3,"../config":9,"../util":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@jiaminghi/c-render/lib/plugin/util":54}],28:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _cRender=require("@jiaminghi/c-render");var _util=require("@jiaminghi/c-render/lib/plugin/util");var _color=require("@jiaminghi/color");var _index=require("../util/index");var pie={shape:{rx:0,ry:0,ir:0,or:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref){var shape=_ref.shape;var keys=["rx","ry","ir","or","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Pie shape configuration is abnormal!");return false}return true},draw:function draw(_ref2,_ref3){var ctx=_ref2.ctx;var shape=_ref3.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,ir=shape.ir,or=shape.or,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;rx=parseInt(rx)+.5;ry=parseInt(ry)+.5;ctx.arc(rx,ry,ir>0?ir:0,startAngle,endAngle,!clockWise);var connectPoint1=(0,_util.getCircleRadianPoint)(rx,ry,or,endAngle).map(function(p){return parseInt(p)+.5});var connectPoint2=(0,_util.getCircleRadianPoint)(rx,ry,ir,startAngle).map(function(p){return parseInt(p)+.5});ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(connectPoint1));ctx.arc(rx,ry,or>0?or:0,endAngle,startAngle,clockWise);ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(connectPoint2));ctx.closePath();ctx.stroke();ctx.fill()}};var agArc={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,gradientStartAngle:null,gradientEndAngle:null},validator:function validator(_ref4){var shape=_ref4.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("AgArc shape configuration is abnormal!");return false}return true},draw:function draw(_ref5,_ref6){var ctx=_ref5.ctx;var shape=_ref6.shape,style=_ref6.style;var gradient=style.gradient;gradient=gradient.map(function(cv){return(0,_color.getColorFromRgbValue)(cv)});if(gradient.length===1){gradient=[gradient[0],gradient[0]]}var gradientArcNum=gradient.length-1;var gradientStartAngle=shape.gradientStartAngle,gradientEndAngle=shape.gradientEndAngle,startAngle=shape.startAngle,endAngle=shape.endAngle,r=shape.r,rx=shape.rx,ry=shape.ry;if(gradientStartAngle===null)gradientStartAngle=startAngle;if(gradientEndAngle===null)gradientEndAngle=endAngle;var angleGap=(gradientEndAngle-gradientStartAngle)/gradientArcNum;if(angleGap===Math.PI*2)angleGap=Math.PI*2-.001;for(var i=0;iendAngle){arcEndAngle=endAngle;doBreak=true}ctx.arc(rx,ry,r,arcStartAngle,arcEndAngle);ctx.strokeStyle=color;ctx.stroke();if(doBreak)break}}};var numberText={shape:{number:[],content:"",position:[0,0],toFixed:0},validator:function validator(_ref7){var shape=_ref7.shape;var number=shape.number,content=shape.content,position=shape.position;if(!(number instanceof Array)||typeof content!=="string"||!(position instanceof Array)){console.error("NumberText shape configuration is abnormal!");return false}return true},draw:function draw(_ref8,_ref9){var ctx=_ref8.ctx;var shape=_ref9.shape;ctx.beginPath();var number=shape.number,content=shape.content,position=shape.position,toFixed=shape.toFixed;var textSegments=content.split("{nt}");var lastSegmentIndex=textSegments.length-1;var textString="";textSegments.forEach(function(t,i){var currentNumber=number[i];if(i===lastSegmentIndex)currentNumber="";if(typeof currentNumber==="number")currentNumber=currentNumber.toFixed(toFixed);textString+=t+(currentNumber||"")});ctx.closePath();ctx.strokeText.apply(ctx,[textString].concat((0,_toConsumableArray2["default"])(position)));ctx.fillText.apply(ctx,[textString].concat((0,_toConsumableArray2["default"])(position)))}};var lineIcon={shape:{x:0,y:0,w:0,h:0},validator:function validator(_ref10){var shape=_ref10.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"){console.error("lineIcon shape configuration is abnormal!");return false}return true},draw:function draw(_ref11,_ref12){var ctx=_ref11.ctx;var shape=_ref12.shape;ctx.beginPath();var x=shape.x,y=shape.y,w=shape.w,h=shape.h;var halfH=h/2;ctx.strokeStyle=ctx.fillStyle;ctx.moveTo(x,y+halfH);ctx.lineTo(x+w,y+halfH);ctx.lineWidth=1;ctx.stroke();ctx.beginPath();var radius=halfH-5*2;if(radius<=0)radius=3;ctx.arc(x+w/2,y+halfH,radius,0,Math.PI*2);ctx.lineWidth=5;ctx.stroke();ctx.fillStyle="#fff";ctx.fill()},hoverCheck:function hoverCheck(position,_ref13){var shape=_ref13.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;return(0,_util.checkPointIsInRect)(position,x,y,w,h)},setGraphCenter:function setGraphCenter(e,_ref14){var shape=_ref14.shape,style=_ref14.style;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;style.graphCenter=[x+w/2,y+h/2]}};(0,_cRender.extendNewGraph)("pie",pie);(0,_cRender.extendNewGraph)("agArc",agArc);(0,_cRender.extendNewGraph)("numberText",numberText);(0,_cRender.extendNewGraph)("lineIcon",lineIcon)},{"../util/index":30,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/c-render":52,"@jiaminghi/c-render/lib/plugin/util":54,"@jiaminghi/color":56}],29:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"changeDefaultConfig",{enumerable:true,get:function get(){return _config.changeDefaultConfig}});exports["default"]=void 0;var _charts=_interopRequireDefault(require("./class/charts.class"));var _config=require("./config");var _default=_charts["default"];exports["default"]=_default},{"./class/charts.class":2,"./config":9,"@babel/runtime/helpers/interopRequireDefault":36}],30:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.filterNonNumber=filterNonNumber;exports.deepMerge=deepMerge;exports.mulAdd=mulAdd;exports.mergeSameStackData=mergeSameStackData;exports.getTwoPointDistance=getTwoPointDistance;exports.getLinearGradientColor=getLinearGradientColor;exports.getPolylineLength=getPolylineLength;exports.getPointToLineDistance=getPointToLineDistance;exports.initNeedSeries=initNeedSeries;exports.radianToAngle=radianToAngle;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _util=require("@jiaminghi/c-render/lib/plugin/util");function filterNonNumber(array){return array.filter(function(n){return typeof n==="number"})}function deepMerge(target,merged){for(var key in merged){target[key]=target[key]&&(0,_typeof2["default"])(target[key])==="object"?deepMerge(target[key],merged[key]):target[key]=merged[key]}return target}function mulAdd(nums){nums=filterNonNumber(nums);return nums.reduce(function(all,num){return all+num},0)}function mergeSameStackData(item,series){var stack=item.stack;if(!stack)return(0,_toConsumableArray2["default"])(item.data);var stacks=series.filter(function(_ref){var s=_ref.stack;return s===stack});var index=stacks.findIndex(function(_ref2){var d=_ref2.data;return d===item.data});var datas=stacks.splice(0,index+1).map(function(_ref3){var data=_ref3.data;return data});var dataLength=datas[0].length;return new Array(dataLength).fill(0).map(function(foo,i){return mulAdd(datas.map(function(d){return d[i]}))})}function getTwoPointDistance(pointOne,pointTwo){var minusX=Math.abs(pointOne[0]-pointTwo[0]);var minusY=Math.abs(pointOne[1]-pointTwo[1]);return Math.sqrt(minusX*minusX+minusY*minusY)}function getLinearGradientColor(ctx,begin,end,color){if(!ctx||!begin||!end||!color.length)return;var colors=color;typeof colors==="string"&&(colors=[color,color]);var linearGradientColor=ctx.createLinearGradient.apply(ctx,(0,_toConsumableArray2["default"])(begin).concat((0,_toConsumableArray2["default"])(end)));var colorGap=1/(colors.length-1);colors.forEach(function(c,i){return linearGradientColor.addColorStop(colorGap*i,c)});return linearGradientColor}function getPolylineLength(points){var lineSegments=new Array(points.length-1).fill(0).map(function(foo,i){return[points[i],points[i+1]]});var lengths=lineSegments.map(function(item){return getTwoPointDistance.apply(void 0,(0,_toConsumableArray2["default"])(item))});return mulAdd(lengths)}function getPointToLineDistance(point,linePointOne,linePointTwo){var a=getTwoPointDistance(point,linePointOne);var b=getTwoPointDistance(point,linePointTwo);var c=getTwoPointDistance(linePointOne,linePointTwo);return.5*Math.sqrt((a+b+c)*(a+b-c)*(a+c-b)*(b+c-a))/c}function initNeedSeries(series,config,type){series=series.filter(function(_ref4){var st=_ref4.type;return st===type});series=series.map(function(item){return deepMerge((0,_util.deepClone)(config,true),item)});return series.filter(function(_ref5){var show=_ref5.show;return show})}function radianToAngle(radian){return radian/Math.PI*180}},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43,"@jiaminghi/c-render/lib/plugin/util":54}],31:[function(require,module,exports){function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}module.exports=_arrayWithHoles},{}],32:[function(require,module,exports){function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i1&&arguments[1]!==undefined?arguments[1]:5;var segmentsNum=bezierCurve.length-1;var startPoint=bezierCurve[0];var endPoint=bezierCurve[segmentsNum][2];var segments=bezierCurve.slice(1);var getSegmentTPointFuns=segments.map(function(seg,i){var beginPoint=i===0?startPoint:segments[i-1][2];return createGetBezierCurveTPointFun.apply(void 0,[beginPoint].concat((0,_toConsumableArray2["default"])(seg)))});var segmentPointsNum=new Array(segmentsNum).fill(defaultSegmentPointsNum);var segmentPoints=getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum);var result=calcUniformPointsByIteration(segmentPoints,getSegmentTPointFuns,segments,precision);result.segmentPoints.push(endPoint);return result}function createGetBezierCurveTPointFun(beginPoint,controlPoint1,controlPoint2,endPoint){return function(t){var tSubed1=1-t;var tSubed1Pow3=pow(tSubed1,3);var tSubed1Pow2=pow(tSubed1,2);var tPow3=pow(t,3);var tPow2=pow(t,2);return[beginPoint[0]*tSubed1Pow3+3*controlPoint1[0]*t*tSubed1Pow2+3*controlPoint2[0]*tPow2*tSubed1+endPoint[0]*tPow3,beginPoint[1]*tSubed1Pow3+3*controlPoint1[1]*t*tSubed1Pow2+3*controlPoint2[1]*tPow2*tSubed1+endPoint[1]*tPow3]}}function getTwoPointDistance(_ref,_ref2){var _ref3=(0,_slicedToArray2["default"])(_ref,2),ax=_ref3[0],ay=_ref3[1];var _ref4=(0,_slicedToArray2["default"])(_ref2,2),bx=_ref4[0],by=_ref4[1];return sqrt(pow(ax-bx,2)+pow(ay-by,2))}function getNumsSum(nums){return nums.reduce(function(sum,num){return sum+num},0)}function getSegmentPointsDistance(segmentPoints){return segmentPoints.map(function(points,i){return new Array(points.length-1).fill(0).map(function(temp,j){return getTwoPointDistance(points[j],points[j+1])})})}function getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum){return getSegmentTPointFuns.map(function(getSegmentTPointFun,i){var tGap=1/segmentPointsNum[i];return new Array(segmentPointsNum[i]).fill("").map(function(foo,j){return getSegmentTPointFun(j*tGap)})})}function getAllDeviations(segmentPointsDistance,avgLength){return segmentPointsDistance.map(function(seg){return seg.map(function(s){return abs(s-avgLength)})}).map(function(seg){return getNumsSum(seg)}).reduce(function(total,v){return total+v},0)}function calcUniformPointsByIteration(segmentPoints,getSegmentTPointFuns,segments,precision){var rounds=4;var cycles=1;var _loop=function _loop(){var totalPointsNum=segmentPoints.reduce(function(total,seg){return total+seg.length},0);segmentPoints.forEach(function(seg,i){return seg.push(segments[i][2])});var segmentPointsDistance=getSegmentPointsDistance(segmentPoints);var lineSegmentNum=segmentPointsDistance.reduce(function(total,seg){return total+seg.length},0);var segmentlength=segmentPointsDistance.map(function(seg){return getNumsSum(seg)});var totalLength=getNumsSum(segmentlength);var avgLength=totalLength/lineSegmentNum;var allDeviations=getAllDeviations(segmentPointsDistance,avgLength);if(allDeviations<=precision)return"break";totalPointsNum=ceil(avgLength/precision*totalPointsNum*1.1);var segmentPointsNum=segmentlength.map(function(length){return ceil(length/totalLength*totalPointsNum)});segmentPoints=getSegmentPointsByNum(getSegmentTPointFuns,segmentPointsNum);totalPointsNum=segmentPoints.reduce(function(total,seg){return total+seg.length},0);var segmentPointsForLength=JSON.parse(JSON.stringify(segmentPoints));segmentPointsForLength.forEach(function(seg,i){return seg.push(segments[i][2])});segmentPointsDistance=getSegmentPointsDistance(segmentPointsForLength);lineSegmentNum=segmentPointsDistance.reduce(function(total,seg){return total+seg.length},0);segmentlength=segmentPointsDistance.map(function(seg){return getNumsSum(seg)});totalLength=getNumsSum(segmentlength);avgLength=totalLength/lineSegmentNum;var stepSize=1/totalPointsNum/10;getSegmentTPointFuns.forEach(function(getSegmentTPointFun,i){var currentSegmentPointsNum=segmentPointsNum[i];var t=new Array(currentSegmentPointsNum).fill("").map(function(foo,j){return j/segmentPointsNum[i]});for(var r=0;r1)t[j]=1;if(t[j]<0)t[j]=0;segmentPoints[i][j]=getSegmentTPointFun(t[j])}}});rounds*=4;cycles++};do{var _ret=_loop();if(_ret==="break")break}while(rounds<=1025);segmentPoints=segmentPoints.reduce(function(all,seg){return all.concat(seg)},[]);return{segmentPoints:segmentPoints,cycles:cycles,rounds:rounds}}function bezierCurveToPolyline(bezierCurve){var precision=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(!bezierCurve){console.error("bezierCurveToPolyline: Missing parameters!");return false}if(!(bezierCurve instanceof Array)){console.error("bezierCurveToPolyline: Parameter bezierCurve must be an array!");return false}if(typeof precision!=="number"){console.error("bezierCurveToPolyline: Parameter precision must be a number!");return false}var _abstractBezierCurveT=abstractBezierCurveToPolyline(bezierCurve,precision),segmentPoints=_abstractBezierCurveT.segmentPoints;return segmentPoints}function getBezierCurveLength(bezierCurve){var precision=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(!bezierCurve){console.error("getBezierCurveLength: Missing parameters!");return false}if(!(bezierCurve instanceof Array)){console.error("getBezierCurveLength: Parameter bezierCurve must be an array!");return false}if(typeof precision!=="number"){console.error("getBezierCurveLength: Parameter precision must be a number!");return false}var _abstractBezierCurveT2=abstractBezierCurveToPolyline(bezierCurve,precision),segmentPoints=_abstractBezierCurveT2.segmentPoints;var pointsDistance=getSegmentPointsDistance([segmentPoints])[0];var length=getNumsSum(pointsDistance);return length}var _default=bezierCurveToPolyline;exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42}],46:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));function polylineToBezierCurve(polyline){var close=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var offsetA=arguments.length>2&&arguments[2]!==undefined?arguments[2]:.25;var offsetB=arguments.length>3&&arguments[3]!==undefined?arguments[3]:.25;if(!(polyline instanceof Array)){console.error("polylineToBezierCurve: Parameter polyline must be an array!");return false}if(polyline.length<=2){console.error("polylineToBezierCurve: Converting to a curve requires at least 3 points!");return false}var startPoint=polyline[0];var bezierCurveLineNum=polyline.length-1;var bezierCurvePoints=new Array(bezierCurveLineNum).fill(0).map(function(foo,i){return[].concat((0,_toConsumableArray2["default"])(getBezierCurveLineControlPoints(polyline,i,close,offsetA,offsetB)),[polyline[i+1]])});if(close)closeBezierCurve(bezierCurvePoints,startPoint);bezierCurvePoints.unshift(polyline[0]);return bezierCurvePoints}function getBezierCurveLineControlPoints(polyline,index){var close=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var offsetA=arguments.length>3&&arguments[3]!==undefined?arguments[3]:.25;var offsetB=arguments.length>4&&arguments[4]!==undefined?arguments[4]:.25;var pointNum=polyline.length;if(pointNum<3||index>=pointNum)return;var beforePointIndex=index-1;if(beforePointIndex<0)beforePointIndex=close?pointNum+beforePointIndex:0;var afterPointIndex=index+1;if(afterPointIndex>=pointNum)afterPointIndex=close?afterPointIndex-pointNum:pointNum-1;var afterNextPointIndex=index+2;if(afterNextPointIndex>=pointNum)afterNextPointIndex=close?afterNextPointIndex-pointNum:pointNum-1;var pointBefore=polyline[beforePointIndex];var pointMiddle=polyline[index];var pointAfter=polyline[afterPointIndex];var pointAfterNext=polyline[afterNextPointIndex];return[[pointMiddle[0]+offsetA*(pointAfter[0]-pointBefore[0]),pointMiddle[1]+offsetA*(pointAfter[1]-pointBefore[1])],[pointAfter[0]-offsetB*(pointAfterNext[0]-pointMiddle[0]),pointAfter[1]-offsetB*(pointAfterNext[1]-pointMiddle[1])]]}function closeBezierCurve(bezierCurve,startPoint){var firstSubCurve=bezierCurve[0];var lastSubCurve=bezierCurve.slice(-1)[0];bezierCurve.push([getSymmetryPoint(lastSubCurve[1],lastSubCurve[2]),getSymmetryPoint(firstSubCurve[0],startPoint),startPoint]);return bezierCurve}function getSymmetryPoint(point,centerPoint){var _point=(0,_slicedToArray2["default"])(point,2),px=_point[0],py=_point[1];var _centerPoint=(0,_slicedToArray2["default"])(centerPoint,2),cx=_centerPoint[0],cy=_centerPoint[1];var minusX=cx-px;var minusY=cy-py;return[cx+minusX,cy+minusY]}var _default=polylineToBezierCurve;exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42}],47:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"bezierCurveToPolyline",{enumerable:true,get:function get(){return _bezierCurveToPolyline.bezierCurveToPolyline}});Object.defineProperty(exports,"getBezierCurveLength",{enumerable:true,get:function get(){return _bezierCurveToPolyline.getBezierCurveLength}});Object.defineProperty(exports,"polylineToBezierCurve",{enumerable:true,get:function get(){return _polylineToBezierCurve["default"]}});exports["default"]=void 0;var _bezierCurveToPolyline=require("./core/bezierCurveToPolyline");var _polylineToBezierCurve=_interopRequireDefault(require("./core/polylineToBezierCurve"));var _default={bezierCurveToPolyline:_bezierCurveToPolyline.bezierCurveToPolyline,getBezierCurveLength:_bezierCurveToPolyline.getBezierCurveLength,polylineToBezierCurve:_polylineToBezierCurve["default"]};exports["default"]=_default},{"./core/bezierCurveToPolyline":45,"./core/polylineToBezierCurve":46,"@babel/runtime/helpers/interopRequireDefault":36}],48:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _color=_interopRequireDefault(require("@jiaminghi/color"));var _bezierCurve=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../plugin/util");var _graphs=_interopRequireDefault(require("../config/graphs"));var _graph=_interopRequireDefault(require("./graph.class"));function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable});keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i0&&arguments[0]!==undefined?arguments[0]:{};var name=config.name;if(!name){console.error("add Missing parameters!");return}var graphConfig=_graphs["default"].get(name);if(!graphConfig){console.warn("No corresponding graph configuration found!");return}var graph=new _graph["default"](graphConfig,config);if(!graph.validator(graph))return;graph.render=this;this.graphs.push(graph);this.sortGraphsByIndex();this.drawAllGraph();return graph};CRender.prototype.sortGraphsByIndex=function(){var graphs=this.graphs;graphs.sort(function(a,b){if(a.index>b.index)return 1;if(a.index===b.index)return 0;if(a.index1&&arguments[1]!==undefined?arguments[1]:undefined;if(!attrName||change===undefined)return false;var isObject=(0,_typeof2["default"])(this[attrName])==="object";if(isObject)change=(0,_util.deepClone)(change,true);var render=this.render;if(attrName==="style"){this.style.update(change)}else if(isObject){Object.assign(this[attrName],change)}else{this[attrName]=change}if(attrName==="index")render.sortGraphsByIndex();render.drawAllGraph()};Graph.prototype.animation=function(){var _ref2=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(attrName,change){var wait,changeRoot,changeKeys,beforeState,animationFrame,animationCurve,animationDelay,animationFrameState,render,_args2=arguments;return _regenerator["default"].wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:wait=_args2.length>2&&_args2[2]!==undefined?_args2[2]:false;if(!(attrName!=="shape"&&attrName!=="style")){_context2.next=4;break}console.error("Only supported shape and style animation!");return _context2.abrupt("return");case 4:change=(0,_util.deepClone)(change,true);if(attrName==="style")this.style.colorProcessor(change);changeRoot=this[attrName];changeKeys=Object.keys(change);beforeState={};changeKeys.forEach(function(key){return beforeState[key]=changeRoot[key]});animationFrame=this.animationFrame,animationCurve=this.animationCurve,animationDelay=this.animationDelay;animationFrameState=(0,_transition["default"])(animationCurve,beforeState,change,animationFrame,true);this.animationRoot.push(changeRoot);this.animationKeys.push(changeKeys);this.animationFrameState.push(animationFrameState);if(!wait){_context2.next=17;break}return _context2.abrupt("return");case 17:if(!(animationDelay>0)){_context2.next=20;break}_context2.next=20;return delay(animationDelay);case 20:render=this.render;return _context2.abrupt("return",new Promise(function(){var _ref3=(0,_asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(resolve){return _regenerator["default"].wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return render.launchAnimation();case 2:resolve();case 3:case"end":return _context.stop()}}},_callee)}));return function(_x3){return _ref3.apply(this,arguments)}}()));case 22:case"end":return _context2.stop()}}},_callee2,this)}));return function(_x,_x2){return _ref2.apply(this,arguments)}}();Graph.prototype.turnNextAnimationFrame=function(timeStamp){var animationDelay=this.animationDelay,animationRoot=this.animationRoot,animationKeys=this.animationKeys,animationFrameState=this.animationFrameState,animationPause=this.animationPause;if(animationPause)return;if(Date.now()-timeStamp1&&arguments[1]!==undefined?arguments[1]:false;var processor=reverse?_color.getColorFromRgbValue:_color.getRgbaValue;var colorProcessorKeys=["fill","stroke","shadowColor"];var allKeys=Object.keys(style);var colorKeys=allKeys.filter(function(key){return colorProcessorKeys.find(function(k){return k===key})});colorKeys.forEach(function(key){return style[key]=processor(style[key])});var gradientColor=style.gradientColor,colors=style.colors;if(gradientColor)style.gradientColor=gradientColor.map(function(c){return processor(c)});if(colors){var colorsKeys=Object.keys(colors);colorsKeys.forEach(function(key){return colors[key]=processor(colors[key])})}};Style.prototype.initStyle=function(ctx){initTransform(ctx,this);initGraphStyle(ctx,this);initGradient(ctx,this)};function initTransform(ctx,style){ctx.save();var graphCenter=style.graphCenter,rotate=style.rotate,scale=style.scale,translate=style.translate;if(!(graphCenter instanceof Array))return;ctx.translate.apply(ctx,(0,_toConsumableArray2["default"])(graphCenter));if(rotate)ctx.rotate(rotate*Math.PI/180);if(scale instanceof Array)ctx.scale.apply(ctx,(0,_toConsumableArray2["default"])(scale));if(translate)ctx.translate.apply(ctx,(0,_toConsumableArray2["default"])(translate));ctx.translate(-graphCenter[0],-graphCenter[1])}var autoSetStyleKeys=["lineCap","lineJoin","lineDashOffset","shadowOffsetX","shadowOffsetY","lineWidth","textAlign","textBaseline"];function initGraphStyle(ctx,style){var fill=style.fill,stroke=style.stroke,shadowColor=style.shadowColor,opacity=style.opacity;autoSetStyleKeys.forEach(function(key){if(key||typeof key==="number")ctx[key]=style[key]});fill=(0,_toConsumableArray2["default"])(fill);stroke=(0,_toConsumableArray2["default"])(stroke);shadowColor=(0,_toConsumableArray2["default"])(shadowColor);fill[3]*=opacity;stroke[3]*=opacity;shadowColor[3]*=opacity;ctx.fillStyle=(0,_color.getColorFromRgbValue)(fill);ctx.strokeStyle=(0,_color.getColorFromRgbValue)(stroke);ctx.shadowColor=(0,_color.getColorFromRgbValue)(shadowColor);var lineDash=style.lineDash,shadowBlur=style.shadowBlur;if(lineDash){lineDash=lineDash.map(function(v){return v>=0?v:0});ctx.setLineDash(lineDash)}if(typeof shadowBlur==="number")ctx.shadowBlur=shadowBlur>0?shadowBlur:.001;var fontStyle=style.fontStyle,fontVarient=style.fontVarient,fontWeight=style.fontWeight,fontSize=style.fontSize,fontFamily=style.fontFamily;ctx.font=fontStyle+" "+fontVarient+" "+fontWeight+" "+fontSize+"px"+" "+fontFamily}function initGradient(ctx,style){if(!gradientValidator(style))return;var gradientColor=style.gradientColor,gradientParams=style.gradientParams,gradientType=style.gradientType,gradientWith=style.gradientWith,gradientStops=style.gradientStops,opacity=style.opacity;gradientColor=gradientColor.map(function(color){var colorOpacity=color[3]*opacity;var clonedColor=(0,_toConsumableArray2["default"])(color);clonedColor[3]=colorOpacity;return clonedColor});gradientColor=gradientColor.map(function(c){return(0,_color.getColorFromRgbValue)(c)});if(gradientStops==="auto")gradientStops=getAutoColorStops(gradientColor);var gradient=ctx["create".concat(gradientType.slice(0,1).toUpperCase()+gradientType.slice(1),"Gradient")].apply(ctx,(0,_toConsumableArray2["default"])(gradientParams));gradientStops.forEach(function(stop,i){return gradient.addColorStop(stop,gradientColor[i])});ctx["".concat(gradientWith,"Style")]=gradient}function gradientValidator(style){var gradientColor=style.gradientColor,gradientParams=style.gradientParams,gradientType=style.gradientType,gradientWith=style.gradientWith,gradientStops=style.gradientStops;if(!gradientColor||!gradientParams)return false;if(gradientColor.length===1){console.warn("The gradient needs to provide at least two colors");return false}if(gradientType!=="linear"&&gradientType!=="radial"){console.warn("GradientType only supports linear or radial, current value is "+gradientType);return false}var gradientParamsLength=gradientParams.length;if(gradientType==="linear"&&gradientParamsLength!==4||gradientType==="radial"&&gradientParamsLength!==6){console.warn("The expected length of gradientParams is "+(gradientType==="linear"?"4":"6"));return false}if(gradientWith!=="fill"&&gradientWith!=="stroke"){console.warn("GradientWith only supports fill or stroke, current value is "+gradientWith);return false}if(gradientStops!=="auto"&&!(gradientStops instanceof Array)){console.warn("gradientStops only supports 'auto' or Number Array ([0, .5, 1]), current value is "+gradientStops);return false}return true}function getAutoColorStops(color){var stopGap=1/(color.length-1);return color.map(function(foo,i){return stopGap*i})}Style.prototype.restoreTransform=function(ctx){ctx.restore()};Style.prototype.update=function(change){this.colorProcessor(change);Object.assign(this,change)};Style.prototype.getStyle=function(){var clonedStyle=(0,_util.deepClone)(this,true);this.colorProcessor(clonedStyle,true);return clonedStyle}},{"../plugin/util":54,"@babel/runtime/helpers/classCallCheck":34,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/color":56}],51:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.extendNewGraph=extendNewGraph;exports["default"]=exports.text=exports.bezierCurve=exports.smoothline=exports.polyline=exports.regPolygon=exports.sector=exports.arc=exports.ring=exports.rect=exports.ellipse=exports.circle=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _bezierCurve2=_interopRequireDefault(require("@jiaminghi/bezier-curve"));var _util=require("../plugin/util");var _canvas=require("../plugin/canvas");var polylineToBezierCurve=_bezierCurve2["default"].polylineToBezierCurve,bezierCurveToPolyline=_bezierCurve2["default"].bezierCurveToPolyline;var circle={shape:{rx:0,ry:0,r:0},validator:function validator(_ref){var shape=_ref.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;if(typeof rx!=="number"||typeof ry!=="number"||typeof r!=="number"){console.error("Circle shape configuration is abnormal!");return false}return true},draw:function draw(_ref2,_ref3){var ctx=_ref2.ctx;var shape=_ref3.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r;ctx.arc(rx,ry,r>0?r:.01,0,Math.PI*2);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref4){var shape=_ref4.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;return(0,_util.checkPointIsInCircle)(position,rx,ry,r)},setGraphCenter:function setGraphCenter(e,_ref5){var shape=_ref5.shape,style=_ref5.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref6,_ref7){var movementX=_ref6.movementX,movementY=_ref6.movementY;var shape=_ref7.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.circle=circle;var ellipse={shape:{rx:0,ry:0,hr:0,vr:0},validator:function validator(_ref8){var shape=_ref8.shape;var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;if(typeof rx!=="number"||typeof ry!=="number"||typeof hr!=="number"||typeof vr!=="number"){console.error("Ellipse shape configuration is abnormal!");return false}return true},draw:function draw(_ref9,_ref10){var ctx=_ref9.ctx;var shape=_ref10.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;ctx.ellipse(rx,ry,hr>0?hr:.01,vr>0?vr:.01,0,0,Math.PI*2);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref11){var shape=_ref11.shape;var rx=shape.rx,ry=shape.ry,hr=shape.hr,vr=shape.vr;var a=Math.max(hr,vr);var b=Math.min(hr,vr);var c=Math.sqrt(a*a-b*b);var leftFocusPoint=[rx-c,ry];var rightFocusPoint=[rx+c,ry];var distance=(0,_util.getTwoPointDistance)(position,leftFocusPoint)+(0,_util.getTwoPointDistance)(position,rightFocusPoint);return distance<=2*a},setGraphCenter:function setGraphCenter(e,_ref12){var shape=_ref12.shape,style=_ref12.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref13,_ref14){var movementX=_ref13.movementX,movementY=_ref13.movementY;var shape=_ref14.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.ellipse=ellipse;var rect={shape:{x:0,y:0,w:0,h:0},validator:function validator(_ref15){var shape=_ref15.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;if(typeof x!=="number"||typeof y!=="number"||typeof w!=="number"||typeof h!=="number"){console.error("Rect shape configuration is abnormal!");return false}return true},draw:function draw(_ref16,_ref17){var ctx=_ref16.ctx;var shape=_ref17.shape;ctx.beginPath();var x=shape.x,y=shape.y,w=shape.w,h=shape.h;ctx.rect(x,y,w,h);ctx.fill();ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref18){var shape=_ref18.shape;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;return(0,_util.checkPointIsInRect)(position,x,y,w,h)},setGraphCenter:function setGraphCenter(e,_ref19){var shape=_ref19.shape,style=_ref19.style;var x=shape.x,y=shape.y,w=shape.w,h=shape.h;style.graphCenter=[x+w/2,y+h/2]},move:function move(_ref20,_ref21){var movementX=_ref20.movementX,movementY=_ref20.movementY;var shape=_ref21.shape;this.attr("shape",{x:shape.x+movementX,y:shape.y+movementY})}};exports.rect=rect;var ring={shape:{rx:0,ry:0,r:0},validator:function validator(_ref22){var shape=_ref22.shape;var rx=shape.rx,ry=shape.ry,r=shape.r;if(typeof rx!=="number"||typeof ry!=="number"||typeof r!=="number"){console.error("Ring shape configuration is abnormal!");return false}return true},draw:function draw(_ref23,_ref24){var ctx=_ref23.ctx;var shape=_ref24.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r;ctx.arc(rx,ry,r>0?r:.01,0,Math.PI*2);ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref25){var shape=_ref25.shape,style=_ref25.style;var rx=shape.rx,ry=shape.ry,r=shape.r;var lineWidth=style.lineWidth;var halfLineWidth=lineWidth/2;var minDistance=r-halfLineWidth;var maxDistance=r+halfLineWidth;var distance=(0,_util.getTwoPointDistance)(position,[rx,ry]);return distance>=minDistance&&distance<=maxDistance},setGraphCenter:function setGraphCenter(e,_ref26){var shape=_ref26.shape,style=_ref26.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref27,_ref28){var movementX=_ref27.movementX,movementY=_ref27.movementY;var shape=_ref28.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.ring=ring;var arc={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref29){var shape=_ref29.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Arc shape configuration is abnormal!");return false}return true},draw:function draw(_ref30,_ref31){var ctx=_ref30.ctx;var shape=_ref31.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;ctx.arc(rx,ry,r>0?r:.001,startAngle,endAngle,!clockWise);ctx.stroke();ctx.closePath()},hoverCheck:function hoverCheck(position,_ref32){var shape=_ref32.shape,style=_ref32.style;var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;var lineWidth=style.lineWidth;var halfLineWidth=lineWidth/2;var insideRadius=r-halfLineWidth;var outsideRadius=r+halfLineWidth;return!(0,_util.checkPointIsInSector)(position,rx,ry,insideRadius,startAngle,endAngle,clockWise)&&(0,_util.checkPointIsInSector)(position,rx,ry,outsideRadius,startAngle,endAngle,clockWise)},setGraphCenter:function setGraphCenter(e,_ref33){var shape=_ref33.shape,style=_ref33.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref34,_ref35){var movementX=_ref34.movementX,movementY=_ref34.movementY;var shape=_ref35.shape;this.attr("shape",{rx:shape.rx+movementX,ry:shape.ry+movementY})}};exports.arc=arc;var sector={shape:{rx:0,ry:0,r:0,startAngle:0,endAngle:0,clockWise:true},validator:function validator(_ref36){var shape=_ref36.shape;var keys=["rx","ry","r","startAngle","endAngle"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("Sector shape configuration is abnormal!");return false}return true},draw:function draw(_ref37,_ref38){var ctx=_ref37.ctx;var shape=_ref38.shape;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;ctx.arc(rx,ry,r>0?r:.01,startAngle,endAngle,!clockWise);ctx.lineTo(rx,ry);ctx.closePath();ctx.stroke();ctx.fill()},hoverCheck:function hoverCheck(position,_ref39){var shape=_ref39.shape;var rx=shape.rx,ry=shape.ry,r=shape.r,startAngle=shape.startAngle,endAngle=shape.endAngle,clockWise=shape.clockWise;return(0,_util.checkPointIsInSector)(position,rx,ry,r,startAngle,endAngle,clockWise)},setGraphCenter:function setGraphCenter(e,_ref40){var shape=_ref40.shape,style=_ref40.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref41,_ref42){var movementX=_ref41.movementX,movementY=_ref41.movementY;var shape=_ref42.shape;var rx=shape.rx,ry=shape.ry;this.attr("shape",{rx:rx+movementX,ry:ry+movementY})}};exports.sector=sector;var regPolygon={shape:{rx:0,ry:0,r:0,side:0},validator:function validator(_ref43){var shape=_ref43.shape;var side=shape.side;var keys=["rx","ry","r","side"];if(keys.find(function(key){return typeof shape[key]!=="number"})){console.error("RegPolygon shape configuration is abnormal!");return false}if(side<3){console.error("RegPolygon at least trigon!");return false}return true},draw:function draw(_ref44,_ref45){var ctx=_ref44.ctx;var shape=_ref45.shape,cache=_ref45.cache;ctx.beginPath();var rx=shape.rx,ry=shape.ry,r=shape.r,side=shape.side;if(!cache.points||cache.rx!==rx||cache.ry!==ry||cache.r!==r||cache.side!==side){var _points=(0,_util.getRegularPolygonPoints)(rx,ry,r,side);Object.assign(cache,{points:_points,rx:rx,ry:ry,r:r,side:side})}var points=cache.points;(0,_canvas.drawPolylinePath)(ctx,points);ctx.closePath();ctx.stroke();ctx.fill()},hoverCheck:function hoverCheck(position,_ref46){var cache=_ref46.cache;var points=cache.points;return(0,_util.checkPointIsInPolygon)(position,points)},setGraphCenter:function setGraphCenter(e,_ref47){var shape=_ref47.shape,style=_ref47.style;var rx=shape.rx,ry=shape.ry;style.graphCenter=[rx,ry]},move:function move(_ref48,_ref49){var movementX=_ref48.movementX,movementY=_ref48.movementY;var shape=_ref49.shape,cache=_ref49.cache;var rx=shape.rx,ry=shape.ry;cache.rx+=movementX;cache.ry+=movementY;this.attr("shape",{rx:rx+movementX,ry:ry+movementY});cache.points=cache.points.map(function(_ref50){var _ref51=(0,_slicedToArray2["default"])(_ref50,2),x=_ref51[0],y=_ref51[1];return[x+movementX,y+movementY]})}};exports.regPolygon=regPolygon;var polyline={shape:{points:[],close:false},validator:function validator(_ref52){var shape=_ref52.shape;var points=shape.points;if(!(points instanceof Array)){console.error("Polyline points should be an array!");return false}return true},draw:function draw(_ref53,_ref54){var ctx=_ref53.ctx;var shape=_ref54.shape,lineWidth=_ref54.style.lineWidth;ctx.beginPath();var points=shape.points,close=shape.close;if(lineWidth===1)points=(0,_util.eliminateBlur)(points);(0,_canvas.drawPolylinePath)(ctx,points);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref55){var shape=_ref55.shape,style=_ref55.style;var points=shape.points,close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,points)}else{return(0,_util.checkPointIsNearPolyline)(position,points,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref56){var shape=_ref56.shape,style=_ref56.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref57,_ref58){var movementX=_ref57.movementX,movementY=_ref57.movementY;var shape=_ref58.shape;var points=shape.points;var moveAfterPoints=points.map(function(_ref59){var _ref60=(0,_slicedToArray2["default"])(_ref59,2),x=_ref60[0],y=_ref60[1];return[x+movementX,y+movementY]});this.attr("shape",{points:moveAfterPoints})}};exports.polyline=polyline;var smoothline={shape:{points:[],close:false},validator:function validator(_ref61){var shape=_ref61.shape;var points=shape.points;if(!(points instanceof Array)){console.error("Smoothline points should be an array!");return false}return true},draw:function draw(_ref62,_ref63){var ctx=_ref62.ctx;var shape=_ref63.shape,cache=_ref63.cache;var points=shape.points,close=shape.close;if(!cache.points||cache.points.toString()!==points.toString()){var _bezierCurve=polylineToBezierCurve(points,close);var hoverPoints=bezierCurveToPolyline(_bezierCurve);Object.assign(cache,{points:(0,_util.deepClone)(points,true),bezierCurve:_bezierCurve,hoverPoints:hoverPoints})}var bezierCurve=cache.bezierCurve;ctx.beginPath();(0,_canvas.drawBezierCurvePath)(ctx,bezierCurve.slice(1),bezierCurve[0]);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref64){var cache=_ref64.cache,shape=_ref64.shape,style=_ref64.style;var hoverPoints=cache.hoverPoints;var close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,hoverPoints)}else{return(0,_util.checkPointIsNearPolyline)(position,hoverPoints,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref65){var shape=_ref65.shape,style=_ref65.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref66,_ref67){var movementX=_ref66.movementX,movementY=_ref66.movementY;var shape=_ref67.shape,cache=_ref67.cache;var points=shape.points;var moveAfterPoints=points.map(function(_ref68){var _ref69=(0,_slicedToArray2["default"])(_ref68,2),x=_ref69[0],y=_ref69[1];return[x+movementX,y+movementY]});cache.points=moveAfterPoints;var _cache$bezierCurve$=(0,_slicedToArray2["default"])(cache.bezierCurve[0],2),fx=_cache$bezierCurve$[0],fy=_cache$bezierCurve$[1];var curves=cache.bezierCurve.slice(1);cache.bezierCurve=[[fx+movementX,fy+movementY]].concat((0,_toConsumableArray2["default"])(curves.map(function(curve){return curve.map(function(_ref70){var _ref71=(0,_slicedToArray2["default"])(_ref70,2),x=_ref71[0],y=_ref71[1];return[x+movementX,y+movementY]})})));cache.hoverPoints=cache.hoverPoints.map(function(_ref72){var _ref73=(0,_slicedToArray2["default"])(_ref72,2),x=_ref73[0],y=_ref73[1];return[x+movementX,y+movementY]});this.attr("shape",{points:moveAfterPoints})}};exports.smoothline=smoothline;var bezierCurve={shape:{points:[],close:false},validator:function validator(_ref74){var shape=_ref74.shape;var points=shape.points;if(!(points instanceof Array)){console.error("BezierCurve points should be an array!");return false}return true},draw:function draw(_ref75,_ref76){var ctx=_ref75.ctx;var shape=_ref76.shape,cache=_ref76.cache;var points=shape.points,close=shape.close;if(!cache.points||cache.points.toString()!==points.toString()){var hoverPoints=bezierCurveToPolyline(points,20);Object.assign(cache,{points:(0,_util.deepClone)(points,true),hoverPoints:hoverPoints})}ctx.beginPath();(0,_canvas.drawBezierCurvePath)(ctx,points.slice(1),points[0]);if(close){ctx.closePath();ctx.fill();ctx.stroke()}else{ctx.stroke()}},hoverCheck:function hoverCheck(position,_ref77){var cache=_ref77.cache,shape=_ref77.shape,style=_ref77.style;var hoverPoints=cache.hoverPoints;var close=shape.close;var lineWidth=style.lineWidth;if(close){return(0,_util.checkPointIsInPolygon)(position,hoverPoints)}else{return(0,_util.checkPointIsNearPolyline)(position,hoverPoints,lineWidth)}},setGraphCenter:function setGraphCenter(e,_ref78){var shape=_ref78.shape,style=_ref78.style;var points=shape.points;style.graphCenter=points[0]},move:function move(_ref79,_ref80){var movementX=_ref79.movementX,movementY=_ref79.movementY;var shape=_ref80.shape,cache=_ref80.cache;var points=shape.points;var _points$=(0,_slicedToArray2["default"])(points[0],2),fx=_points$[0],fy=_points$[1];var curves=points.slice(1);var bezierCurve=[[fx+movementX,fy+movementY]].concat((0,_toConsumableArray2["default"])(curves.map(function(curve){return curve.map(function(_ref81){var _ref82=(0,_slicedToArray2["default"])(_ref81,2),x=_ref82[0],y=_ref82[1];return[x+movementX,y+movementY]})})));cache.points=bezierCurve;cache.hoverPoints=cache.hoverPoints.map(function(_ref83){var _ref84=(0,_slicedToArray2["default"])(_ref83,2),x=_ref84[0],y=_ref84[1];return[x+movementX,y+movementY]});this.attr("shape",{points:bezierCurve})}};exports.bezierCurve=bezierCurve;var text={shape:{content:"",position:[],maxWidth:undefined,rowGap:0},validator:function validator(_ref85){var shape=_ref85.shape;var content=shape.content,position=shape.position,rowGap=shape.rowGap;if(typeof content!=="string"){console.error("Text content should be a string!");return false}if(!(position instanceof Array)){console.error("Text position should be an array!");return false}if(typeof rowGap!=="number"){console.error("Text rowGap should be a number!");return false}return true},draw:function draw(_ref86,_ref87){var ctx=_ref86.ctx;var shape=_ref87.shape;var content=shape.content,position=shape.position,maxWidth=shape.maxWidth,rowGap=shape.rowGap;var textBaseline=ctx.textBaseline,font=ctx.font;var fontSize=parseInt(font.replace(/\D/g,""));var _position=position,_position2=(0,_slicedToArray2["default"])(_position,2),x=_position2[0],y=_position2[1];content=content.split("\n");var rowNum=content.length;var lineHeight=fontSize+rowGap;var allHeight=rowNum*lineHeight-rowGap;var offset=0;if(textBaseline==="middle"){offset=allHeight/2;y+=fontSize/2}if(textBaseline==="bottom"){offset=allHeight;y+=fontSize}position=new Array(rowNum).fill(0).map(function(foo,i){return[x,y+i*lineHeight-offset]});ctx.beginPath();content.forEach(function(text,i){ctx.fillText.apply(ctx,[text].concat((0,_toConsumableArray2["default"])(position[i]),[maxWidth]));ctx.strokeText.apply(ctx,[text].concat((0,_toConsumableArray2["default"])(position[i]),[maxWidth]))});ctx.closePath()},hoverCheck:function hoverCheck(position,_ref88){var shape=_ref88.shape,style=_ref88.style;return false},setGraphCenter:function setGraphCenter(e,_ref89){var shape=_ref89.shape,style=_ref89.style;var position=shape.position;style.graphCenter=(0,_toConsumableArray2["default"])(position)},move:function move(_ref90,_ref91){var movementX=_ref90.movementX,movementY=_ref90.movementY;var shape=_ref91.shape;var _shape$position=(0,_slicedToArray2["default"])(shape.position,2),x=_shape$position[0],y=_shape$position[1];this.attr("shape",{position:[x+movementX,y+movementY]})}};exports.text=text;var graphs=new Map([["circle",circle],["ellipse",ellipse],["rect",rect],["ring",ring],["arc",arc],["sector",sector],["regPolygon",regPolygon],["polyline",polyline],["smoothline",smoothline],["bezierCurve",bezierCurve],["text",text]]);var _default=graphs;exports["default"]=_default;function extendNewGraph(name,config){if(!name||!config){console.error("ExtendNewGraph Missing Parameters!");return}if(!config.shape){console.error("Required attribute of shape to extendNewGraph!");return}if(!config.validator){console.error("Required function of validator to extendNewGraph!");return}if(!config.draw){console.error("Required function of draw to extendNewGraph!");return}graphs.set(name,config)}},{"../plugin/canvas":53,"../plugin/util":54,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@jiaminghi/bezier-curve":47}],52:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"CRender",{enumerable:true,get:function get(){return _crender["default"]}});Object.defineProperty(exports,"extendNewGraph",{enumerable:true,get:function get(){return _graphs.extendNewGraph}});exports["default"]=void 0;var _crender=_interopRequireDefault(require("./class/crender.class"));var _graphs=require("./config/graphs");var _default=_crender["default"];exports["default"]=_default},{"./class/crender.class":48,"./config/graphs":51,"@babel/runtime/helpers/interopRequireDefault":36}],53:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.drawPolylinePath=drawPolylinePath;exports.drawBezierCurvePath=drawBezierCurvePath;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));function drawPolylinePath(ctx,points){var beginPath=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var closePath=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(!ctx||points.length<2)return false;if(beginPath)ctx.beginPath();points.forEach(function(point,i){return point&&(i===0?ctx.moveTo.apply(ctx,(0,_toConsumableArray2["default"])(point)):ctx.lineTo.apply(ctx,(0,_toConsumableArray2["default"])(point)))});if(closePath)ctx.closePath()}function drawBezierCurvePath(ctx,points){var moveTo=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var beginPath=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var closePath=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(!ctx||!points)return false;if(beginPath)ctx.beginPath();if(moveTo)ctx.moveTo.apply(ctx,(0,_toConsumableArray2["default"])(moveTo));points.forEach(function(item){return item&&ctx.bezierCurveTo.apply(ctx,(0,_toConsumableArray2["default"])(item[0]).concat((0,_toConsumableArray2["default"])(item[1]),(0,_toConsumableArray2["default"])(item[2])))});if(closePath)ctx.closePath()}var _default={drawPolylinePath:drawPolylinePath,drawBezierCurvePath:drawBezierCurvePath};exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42}],54:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.deepClone=deepClone;exports.eliminateBlur=eliminateBlur;exports.checkPointIsInCircle=checkPointIsInCircle;exports.getTwoPointDistance=getTwoPointDistance;exports.checkPointIsInPolygon=checkPointIsInPolygon;exports.checkPointIsInSector=checkPointIsInSector;exports.checkPointIsNearPolyline=checkPointIsNearPolyline;exports.checkPointIsInRect=checkPointIsInRect;exports.getRotatePointPos=getRotatePointPos;exports.getScalePointPos=getScalePointPos;exports.getTranslatePointPos=getTranslatePointPos;exports.getDistanceBetweenPointAndLine=getDistanceBetweenPointAndLine;exports.getCircleRadianPoint=getCircleRadianPoint;exports.getRegularPolygonPoints=getRegularPolygonPoints;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var abs=Math.abs,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,max=Math.max,min=Math.min,PI=Math.PI;function deepClone(object){var recursion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(!object)return object;var parse=JSON.parse,stringify=JSON.stringify;if(!recursion)return parse(stringify(object));var clonedObj=object instanceof Array?[]:{};if(object&&(0,_typeof2["default"])(object)==="object"){for(var key in object){if(object.hasOwnProperty(key)){if(object[key]&&(0,_typeof2["default"])(object[key])==="object"){clonedObj[key]=deepClone(object[key],true)}else{clonedObj[key]=object[key]}}}}return clonedObj}function eliminateBlur(points){return points.map(function(_ref){var _ref2=(0,_slicedToArray2["default"])(_ref,2),x=_ref2[0],y=_ref2[1];return[parseInt(x)+.5,parseInt(y)+.5]})}function checkPointIsInCircle(point,rx,ry,r){return getTwoPointDistance(point,[rx,ry])<=r}function getTwoPointDistance(_ref3,_ref4){var _ref5=(0,_slicedToArray2["default"])(_ref3,2),xa=_ref5[0],ya=_ref5[1];var _ref6=(0,_slicedToArray2["default"])(_ref4,2),xb=_ref6[0],yb=_ref6[1];var minusX=abs(xa-xb);var minusY=abs(ya-yb);return sqrt(minusX*minusX+minusY*minusY)}function checkPointIsInPolygon(point,polygon){var counter=0;var _point=(0,_slicedToArray2["default"])(point,2),x=_point[0],y=_point[1];var pointNum=polygon.length;for(var i=1,p1=polygon[0];i<=pointNum;i++){var p2=polygon[i%pointNum];if(x>min(p1[0],p2[0])&&x<=max(p1[0],p2[0])){if(y<=max(p1[1],p2[1])){if(p1[0]!==p2[0]){var xinters=(x-p1[0])*(p2[1]-p1[1])/(p2[0]-p1[0])+p1[1];if(p1[1]===p2[1]||y<=xinters){counter++}}}}p1=p2}return counter%2===1}function checkPointIsInSector(point,rx,ry,r,startAngle,endAngle,clockWise){if(!point)return false;if(getTwoPointDistance(point,[rx,ry])>r)return false;if(!clockWise){var _deepClone=deepClone([endAngle,startAngle]);var _deepClone2=(0,_slicedToArray2["default"])(_deepClone,2);startAngle=_deepClone2[0];endAngle=_deepClone2[1]}var reverseBE=startAngle>endAngle;if(reverseBE){var _ref7=[endAngle,startAngle];startAngle=_ref7[0];endAngle=_ref7[1]}var minus=endAngle-startAngle;if(minus>=PI*2)return true;var _point2=(0,_slicedToArray2["default"])(point,2),x=_point2[0],y=_point2[1];var _getCircleRadianPoint=getCircleRadianPoint(rx,ry,r,startAngle),_getCircleRadianPoint2=(0,_slicedToArray2["default"])(_getCircleRadianPoint,2),bx=_getCircleRadianPoint2[0],by=_getCircleRadianPoint2[1];var _getCircleRadianPoint3=getCircleRadianPoint(rx,ry,r,endAngle),_getCircleRadianPoint4=(0,_slicedToArray2["default"])(_getCircleRadianPoint3,2),ex=_getCircleRadianPoint4[0],ey=_getCircleRadianPoint4[1];var vPoint=[x-rx,y-ry];var vBArm=[bx-rx,by-ry];var vEArm=[ex-rx,ey-ry];var reverse=minus>PI;if(reverse){var _deepClone3=deepClone([vEArm,vBArm]);var _deepClone4=(0,_slicedToArray2["default"])(_deepClone3,2);vBArm=_deepClone4[0];vEArm=_deepClone4[1]}var inSector=isClockWise(vBArm,vPoint)&&!isClockWise(vEArm,vPoint);if(reverse)inSector=!inSector;if(reverseBE)inSector=!inSector;return inSector}function isClockWise(vArm,vPoint){var _vArm=(0,_slicedToArray2["default"])(vArm,2),ax=_vArm[0],ay=_vArm[1];var _vPoint=(0,_slicedToArray2["default"])(vPoint,2),px=_vPoint[0],py=_vPoint[1];return-ay*px+ax*py>0}function checkPointIsNearPolyline(point,polyline,lineWidth){var halfLineWidth=lineWidth/2;var moveUpPolyline=polyline.map(function(_ref8){var _ref9=(0,_slicedToArray2["default"])(_ref8,2),x=_ref9[0],y=_ref9[1];return[x,y-halfLineWidth]});var moveDownPolyline=polyline.map(function(_ref10){var _ref11=(0,_slicedToArray2["default"])(_ref10,2),x=_ref11[0],y=_ref11[1];return[x,y+halfLineWidth]});var polygon=[].concat((0,_toConsumableArray2["default"])(moveUpPolyline),(0,_toConsumableArray2["default"])(moveDownPolyline.reverse()));return checkPointIsInPolygon(point,polygon)}function checkPointIsInRect(_ref12,x,y,width,height){var _ref13=(0,_slicedToArray2["default"])(_ref12,2),px=_ref13[0],py=_ref13[1];if(pxx+width)return false;if(py>y+height)return false;return true}function getRotatePointPos(){var rotate=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var point=arguments.length>1?arguments[1]:undefined;var origin=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[0,0];if(!point)return false;if(rotate%360===0)return point;var _point3=(0,_slicedToArray2["default"])(point,2),x=_point3[0],y=_point3[1];var _origin=(0,_slicedToArray2["default"])(origin,2),ox=_origin[0],oy=_origin[1];rotate*=PI/180;return[(x-ox)*cos(rotate)-(y-oy)*sin(rotate)+ox,(x-ox)*sin(rotate)+(y-oy)*cos(rotate)+oy]}function getScalePointPos(){var scale=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[1,1];var point=arguments.length>1?arguments[1]:undefined;var origin=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[0,0];if(!point)return false;if(scale===1)return point;var _point4=(0,_slicedToArray2["default"])(point,2),x=_point4[0],y=_point4[1];var _origin2=(0,_slicedToArray2["default"])(origin,2),ox=_origin2[0],oy=_origin2[1];var _scale=(0,_slicedToArray2["default"])(scale,2),xs=_scale[0],ys=_scale[1];var relativePosX=x-ox;var relativePosY=y-oy;return[relativePosX*xs+ox,relativePosY*ys+oy]}function getTranslatePointPos(translate,point){if(!translate||!point)return false;var _point5=(0,_slicedToArray2["default"])(point,2),x=_point5[0],y=_point5[1];var _translate=(0,_slicedToArray2["default"])(translate,2),tx=_translate[0],ty=_translate[1];return[x+tx,y+ty]}function getDistanceBetweenPointAndLine(point,lineBegin,lineEnd){if(!point||!lineBegin||!lineEnd)return false;var _point6=(0,_slicedToArray2["default"])(point,2),x=_point6[0],y=_point6[1];var _lineBegin=(0,_slicedToArray2["default"])(lineBegin,2),x1=_lineBegin[0],y1=_lineBegin[1];var _lineEnd=(0,_slicedToArray2["default"])(lineEnd,2),x2=_lineEnd[0],y2=_lineEnd[1];var a=y2-y1;var b=x1-x2;var c=y1*(x2-x1)-x1*(y2-y1);var molecule=abs(a*x+b*y+c);var denominator=sqrt(a*a+b*b);return molecule/denominator}function getCircleRadianPoint(x,y,radius,radian){return[x+cos(radian)*radius,y+sin(radian)*radius]}function getRegularPolygonPoints(rx,ry,r,side){var minus=arguments.length>4&&arguments[4]!==undefined?arguments[4]:PI*-.5;var radianGap=PI*2/side;var radians=new Array(side).fill("").map(function(t,i){return i*radianGap+minus});return radians.map(function(radian){return getCircleRadianPoint(rx,ry,r,radian)})}var _default={deepClone:deepClone,eliminateBlur:eliminateBlur,checkPointIsInCircle:checkPointIsInCircle,checkPointIsInPolygon:checkPointIsInPolygon,checkPointIsInSector:checkPointIsInSector,checkPointIsNearPolyline:checkPointIsNearPolyline,getTwoPointDistance:getTwoPointDistance,getRotatePointPos:getRotatePointPos,getScalePointPos:getScalePointPos,getTranslatePointPos:getTranslatePointPos,getCircleRadianPoint:getCircleRadianPoint,getRegularPolygonPoints:getRegularPolygonPoints,getDistanceBetweenPointAndLine:getDistanceBetweenPointAndLine};exports["default"]=_default},{"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/slicedToArray":41,"@babel/runtime/helpers/toConsumableArray":42,"@babel/runtime/helpers/typeof":43}],55:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;var _default=new Map([["transparent","rgba(0,0,0,0)"],["black","#000000"],["silver","#C0C0C0"],["gray","#808080"],["white","#FFFFFF"],["maroon","#800000"],["red","#FF0000"],["purple","#800080"],["fuchsia","#FF00FF"],["green","#008000"],["lime","#00FF00"],["olive","#808000"],["yellow","#FFFF00"],["navy","#000080"],["blue","#0000FF"],["teal","#008080"],["aqua","#00FFFF"],["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["blanchedalmond","#ffebcd"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["oldlace","#fdf5e6"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["whitesmoke","#f5f5f5"],["yellowgreen","#9acd32"]]);exports["default"]=_default},{}],56:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.getRgbValue=getRgbValue;exports.getRgbaValue=getRgbaValue;exports.getOpacity=getOpacity;exports.toRgb=toRgb;exports.toHex=toHex;exports.getColorFromRgbValue=getColorFromRgbValue;exports.darken=darken;exports.lighten=lighten;exports.fade=fade;exports["default"]=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _keywords=_interopRequireDefault(require("./config/keywords"));var hexReg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;var rgbReg=/^(rgb|rgba|RGB|RGBA)/;var rgbaReg=/^(rgba|RGBA)/;function validator(color){var isHex=hexReg.test(color);var isRgb=rgbReg.test(color);if(isHex||isRgb)return color;color=getColorByKeyword(color);if(!color){console.error("Color: Invalid color!");return false}return color}function getColorByKeyword(keyword){if(!keyword){console.error("getColorByKeywords: Missing parameters!");return false}if(!_keywords["default"].has(keyword))return false;return _keywords["default"].get(keyword)}function getRgbValue(color){if(!color){console.error("getRgbValue: Missing parameters!");return false}color=validator(color);if(!color)return false;var isHex=hexReg.test(color);var isRgb=rgbReg.test(color);var lowerColor=color.toLowerCase();if(isHex)return getRgbValueFromHex(lowerColor);if(isRgb)return getRgbValueFromRgb(lowerColor)}function getRgbValueFromHex(color){color=color.replace("#","");if(color.length===3)color=Array.from(color).map(function(hexNum){return hexNum+hexNum}).join("");color=color.split("");return new Array(3).fill(0).map(function(t,i){return parseInt("0x".concat(color[i*2]).concat(color[i*2+1]))})}function getRgbValueFromRgb(color){return color.replace(/rgb\(|rgba\(|\)/g,"").split(",").slice(0,3).map(function(n){return parseInt(n)})}function getRgbaValue(color){if(!color){console.error("getRgbaValue: Missing parameters!");return false}var colorValue=getRgbValue(color);if(!colorValue)return false;colorValue.push(getOpacity(color));return colorValue}function getOpacity(color){if(!color){console.error("getOpacity: Missing parameters!");return false}color=validator(color);if(!color)return false;var isRgba=rgbaReg.test(color);if(!isRgba)return 1;color=color.toLowerCase();return Number(color.split(",").slice(-1)[0].replace(/[)|\s]/g,""))}function toRgb(color,opacity){if(!color){console.error("toRgb: Missing parameters!");return false}var rgbValue=getRgbValue(color);if(!rgbValue)return false;var addOpacity=typeof opacity==="number";if(addOpacity)return"rgba("+rgbValue.join(",")+",".concat(opacity,")");return"rgb("+rgbValue.join(",")+")"}function toHex(color){if(!color){console.error("toHex: Missing parameters!");return false}if(hexReg.test(color))return color;color=getRgbValue(color);if(!color)return false;return"#"+color.map(function(n){return Number(n).toString(16)}).map(function(n){return n==="0"?"00":n}).join("")}function getColorFromRgbValue(value){if(!value){console.error("getColorFromRgbValue: Missing parameters!");return false}var valueLength=value.length;if(valueLength!==3&&valueLength!==4){console.error("getColorFromRgbValue: Value is illegal!");return false}var color=valueLength===3?"rgb(":"rgba(";color+=value.join(",")+")";return color}function darken(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!color){console.error("darken: Missing parameters!");return false}var rgbaValue=getRgbaValue(color);if(!rgbaValue)return false;rgbaValue=rgbaValue.map(function(v,i){return i===3?v:v-Math.ceil(2.55*percent)}).map(function(v){return v<0?0:v});return getColorFromRgbValue(rgbaValue)}function lighten(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!color){console.error("lighten: Missing parameters!");return false}var rgbaValue=getRgbaValue(color);if(!rgbaValue)return false;rgbaValue=rgbaValue.map(function(v,i){return i===3?v:v+Math.ceil(2.55*percent)}).map(function(v){return v>255?255:v});return getColorFromRgbValue(rgbaValue)}function fade(color){var percent=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;if(!color){console.error("fade: Missing parameters!");return false}var rgbValue=getRgbValue(color);if(!rgbValue)return false;var rgbaValue=[].concat((0,_toConsumableArray2["default"])(rgbValue),[percent/100]);return getColorFromRgbValue(rgbaValue)}var _default={fade:fade,toHex:toHex,toRgb:toRgb,darken:darken,lighten:lighten,getOpacity:getOpacity,getRgbValue:getRgbValue,getRgbaValue:getRgbaValue,getColorFromRgbValue:getColorFromRgbValue};exports["default"]=_default},{"./config/keywords":55,"@babel/runtime/helpers/interopRequireDefault":36,"@babel/runtime/helpers/toConsumableArray":42}],57:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=exports.easeInOutBounce=exports.easeOutBounce=exports.easeInBounce=exports.easeInOutElastic=exports.easeOutElastic=exports.easeInElastic=exports.easeInOutBack=exports.easeOutBack=exports.easeInBack=exports.easeInOutQuint=exports.easeOutQuint=exports.easeInQuint=exports.easeInOutQuart=exports.easeOutQuart=exports.easeInQuart=exports.easeInOutCubic=exports.easeOutCubic=exports.easeInCubic=exports.easeInOutQuad=exports.easeOutQuad=exports.easeInQuad=exports.easeInOutSine=exports.easeOutSine=exports.easeInSine=exports.linear=void 0;var linear=[[[0,1],"",[.33,.67]],[[1,0],[.67,.33]]];exports.linear=linear;var easeInSine=[[[0,1]],[[.538,.564],[.169,.912],[.88,.196]],[[1,0]]];exports.easeInSine=easeInSine;var easeOutSine=[[[0,1]],[[.444,.448],[.169,.736],[.718,.16]],[[1,0]]];exports.easeOutSine=easeOutSine;var easeInOutSine=[[[0,1]],[[.5,.5],[.2,1],[.8,0]],[[1,0]]];exports.easeInOutSine=easeInOutSine;var easeInQuad=[[[0,1]],[[.55,.584],[.231,.904],[.868,.264]],[[1,0]]];exports.easeInQuad=easeInQuad;var easeOutQuad=[[[0,1]],[[.413,.428],[.065,.816],[.76,.04]],[[1,0]]];exports.easeOutQuad=easeOutQuad;var easeInOutQuad=[[[0,1]],[[.5,.5],[.3,.9],[.7,.1]],[[1,0]]];exports.easeInOutQuad=easeInOutQuad;var easeInCubic=[[[0,1]],[[.679,.688],[.366,.992],[.992,.384]],[[1,0]]];exports.easeInCubic=easeInCubic;var easeOutCubic=[[[0,1]],[[.321,.312],[.008,.616],[.634,.008]],[[1,0]]];exports.easeOutCubic=easeOutCubic;var easeInOutCubic=[[[0,1]],[[.5,.5],[.3,1],[.7,0]],[[1,0]]];exports.easeInOutCubic=easeInOutCubic;var easeInQuart=[[[0,1]],[[.812,.74],[.611,.988],[1.013,.492]],[[1,0]]];exports.easeInQuart=easeInQuart;var easeOutQuart=[[[0,1]],[[.152,.244],[.001,.448],[.285,-.02]],[[1,0]]];exports.easeOutQuart=easeOutQuart;var easeInOutQuart=[[[0,1]],[[.5,.5],[.4,1],[.6,0]],[[1,0]]];exports.easeInOutQuart=easeInOutQuart;var easeInQuint=[[[0,1]],[[.857,.856],[.714,1],[1,.712]],[[1,0]]];exports.easeInQuint=easeInQuint;var easeOutQuint=[[[0,1]],[[.108,.2],[.001,.4],[.214,-.012]],[[1,0]]];exports.easeOutQuint=easeOutQuint;var easeInOutQuint=[[[0,1]],[[.5,.5],[.5,1],[.5,0]],[[1,0]]];exports.easeInOutQuint=easeInOutQuint;var easeInBack=[[[0,1]],[[.667,.896],[.38,1.184],[.955,.616]],[[1,0]]];exports.easeInBack=easeInBack;var easeOutBack=[[[0,1]],[[.335,.028],[.061,.22],[.631,-.18]],[[1,0]]];exports.easeOutBack=easeOutBack;var easeInOutBack=[[[0,1]],[[.5,.5],[.4,1.4],[.6,-.4]],[[1,0]]];exports.easeInOutBack=easeInOutBack;var easeInElastic=[[[0,1]],[[.474,.964],[.382,.988],[.557,.952]],[[.619,1.076],[.565,1.088],[.669,1.08]],[[.77,.916],[.712,.924],[.847,.904]],[[.911,1.304],[.872,1.316],[.961,1.34]],[[1,0]]];exports.easeInElastic=easeInElastic;var easeOutElastic=[[[0,1]],[[.073,-.32],[.034,-.328],[.104,-.344]],[[.191,.092],[.11,.06],[.256,.08]],[[.31,-.076],[.26,-.068],[.357,-.076]],[[.432,.032],[.362,.028],[.683,-.004]],[[1,0]]];exports.easeOutElastic=easeOutElastic;var easeInOutElastic=[[[0,1]],[[.21,.94],[.167,.884],[.252,.98]],[[.299,1.104],[.256,1.092],[.347,1.108]],[[.5,.496],[.451,.672],[.548,.324]],[[.696,-.108],[.652,-.112],[.741,-.124]],[[.805,.064],[.756,.012],[.866,.096]],[[1,0]]];exports.easeInOutElastic=easeInOutElastic;var easeInBounce=[[[0,1]],[[.148,1],[.075,.868],[.193,.848]],[[.326,1],[.276,.836],[.405,.712]],[[.6,1],[.511,.708],[.671,.348]],[[1,0]]];exports.easeInBounce=easeInBounce;var easeOutBounce=[[[0,1]],[[.357,.004],[.27,.592],[.376,.252]],[[.604,-.004],[.548,.312],[.669,.184]],[[.82,0],[.749,.184],[.905,.132]],[[1,0]]];exports.easeOutBounce=easeOutBounce;var easeInOutBounce=[[[0,1]],[[.102,1],[.05,.864],[.117,.86]],[[.216,.996],[.208,.844],[.227,.808]],[[.347,.996],[.343,.8],[.48,.292]],[[.635,.004],[.511,.676],[.656,.208]],[[.787,0],[.76,.2],[.795,.144]],[[.905,-.004],[.899,.164],[.944,.144]],[[1,0]]];exports.easeInOutBounce=easeInOutBounce;var _default=new Map([["linear",linear],["easeInSine",easeInSine],["easeOutSine",easeOutSine],["easeInOutSine",easeInOutSine],["easeInQuad",easeInQuad],["easeOutQuad",easeOutQuad],["easeInOutQuad",easeInOutQuad],["easeInCubic",easeInCubic],["easeOutCubic",easeOutCubic],["easeInOutCubic",easeInOutCubic],["easeInQuart",easeInQuart],["easeOutQuart",easeOutQuart],["easeInOutQuart",easeInOutQuart],["easeInQuint",easeInQuint],["easeOutQuint",easeOutQuint],["easeInOutQuint",easeInOutQuint],["easeInBack",easeInBack],["easeOutBack",easeOutBack],["easeInOutBack",easeInOutBack],["easeInElastic",easeInElastic],["easeOutElastic",easeOutElastic],["easeInOutElastic",easeInOutElastic],["easeInBounce",easeInBounce],["easeOutBounce",easeOutBounce],["easeInOutBounce",easeInOutBounce]]);exports["default"]=_default},{}],58:[function(require,module,exports){"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.transition=transition;exports.injectNewCurve=injectNewCurve;exports["default"]=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof"));var _curves=_interopRequireDefault(require("./config/curves"));var defaultTransitionBC="linear";function transition(tBC){var startState=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var endState=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var frameNum=arguments.length>3&&arguments[3]!==undefined?arguments[3]:30;var deep=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;if(!checkParams.apply(void 0,arguments))return false;try{var bezierCurve=getBezierCurve(tBC);var frameStateProgress=getFrameStateProgress(bezierCurve,frameNum);if(!deep||typeof endState==="number")return getTransitionState(startState,endState,frameStateProgress);return recursionTransitionState(startState,endState,frameStateProgress)}catch(_unused){console.warn("Transition parameter may be abnormal!");return[endState]}}function checkParams(tBC){var startState=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var endState=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var frameNum=arguments.length>3&&arguments[3]!==undefined?arguments[3]:30;if(!tBC||startState===false||endState===false||!frameNum){console.error("transition: Missing Parameters!");return false}if((0,_typeof2["default"])(startState)!==(0,_typeof2["default"])(endState)){console.error("transition: Inconsistent Status Types!");return false}var stateType=(0,_typeof2["default"])(endState);if(stateType==="string"||stateType==="boolean"||!tBC.length){console.error("transition: Unsupported Data Type of State!");return false}if(!_curves["default"].has(tBC)&&!(tBC instanceof Array)){console.warn("transition: Transition curve not found, default curve will be used!")}return true}function getBezierCurve(tBC){var bezierCurve="";if(_curves["default"].has(tBC)){bezierCurve=_curves["default"].get(tBC)}else if(tBC instanceof Array){bezierCurve=tBC}else{bezierCurve=_curves["default"].get(defaultTransitionBC)}return bezierCurve}function getFrameStateProgress(bezierCurve,frameNum){var tMinus=1/(frameNum-1);var tState=new Array(frameNum).fill(0).map(function(t,i){return i*tMinus});var frameState=tState.map(function(t){return getFrameStateFromT(bezierCurve,t)});return frameState}function getFrameStateFromT(bezierCurve,t){var tBezierCurvePoint=getBezierCurvePointFromT(bezierCurve,t);var bezierCurvePointT=getBezierCurvePointTFromReT(tBezierCurvePoint,t);return getBezierCurveTState(tBezierCurvePoint,bezierCurvePointT)}function getBezierCurvePointFromT(bezierCurve,t){var lastIndex=bezierCurve.length-1;var begin="",end="";bezierCurve.findIndex(function(item,i){if(i===lastIndex)return;begin=item;end=bezierCurve[i+1];var currentMainPointX=begin[0][0];var nextMainPointX=end[0][0];return t>=currentMainPointX&&t=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){this.complete(entry.completion,entry.afterLoc);resetTryEntry(entry);return ContinueSentinel}}},catch:function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};if(this.method==="next"){this.arg=undefined}return ContinueSentinel}};return exports}(typeof module==="object"?module.exports:{});try{regeneratorRuntime=runtime}catch(accidentalStrictMode){Function("r","regeneratorRuntime = r")(runtime)}},{}]},{},[1]); \ No newline at end of file diff --git a/lib/class/charts.class.js b/lib/class/charts.class.js index fceed8f..5ea0d6f 100644 --- a/lib/class/charts.class.js +++ b/lib/class/charts.class.js @@ -1,28 +1,16 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.object.assign"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/web.dom-collections.iterator"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); + +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); + require("../extend/index"); var _cRender = _interopRequireDefault(require("@jiaminghi/c-render")); @@ -31,14 +19,8 @@ var _util = require("@jiaminghi/c-render/lib/plugin/util"); var _core = require("../core"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - var Charts = function Charts(dom) { - _classCallCheck(this, Charts); + (0, _classCallCheck2["default"])(this, Charts); if (!dom) { console.error('Charts Missing parameters!'); @@ -69,7 +51,7 @@ var Charts = function Charts(dom) { exports["default"] = Charts; Charts.prototype.setOption = function (option) { - if (!option || _typeof(option) !== 'object') { + if (!option || (0, _typeof2["default"])(option) !== 'object') { console.error('setOption Missing parameters!'); return false; } diff --git a/lib/class/updater.class.js b/lib/class/updater.class.js index 0f14f2f..d7a11ce 100644 --- a/lib/class/updater.class.js +++ b/lib/class/updater.class.js @@ -1,44 +1,6 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.array.splice"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.object.assign"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true @@ -46,21 +8,14 @@ Object.defineProperty(exports, "__esModule", { exports.doUpdate = doUpdate; exports.Updater = void 0; -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var Updater = function Updater(config, series) { - _classCallCheck(this, Updater); - + (0, _classCallCheck2["default"])(this, Updater); var chart = config.chart, key = config.key, getGraphConfig = config.getGraphConfig; @@ -84,9 +39,7 @@ Updater.prototype.update = function (series) { beforeUpdate = this.beforeUpdate; delRedundanceGraph(this, series); if (!series.length) return; - - var beforeUpdateType = _typeof(beforeUpdate); - + var beforeUpdateType = (0, _typeof2["default"])(beforeUpdate); series.forEach(function (seriesItem, i) { if (beforeUpdateType === 'function') beforeUpdate(graphs, seriesItem, i, _this); var cache = graphs[i]; @@ -138,7 +91,7 @@ function balanceGraphsNum(graphs, graphConfig, render) { var needAddGraphs = new Array(needAddGraphNum).fill(0).map(function (foo) { return render.clone(lastCacheGraph); }); - graphs.push.apply(graphs, _toConsumableArray(needAddGraphs)); + graphs.push.apply(graphs, (0, _toConsumableArray2["default"])(needAddGraphs)); } else if (needGraphNum < cacheGraphNum) { var needDelCache = graphs.splice(needGraphNum); needDelCache.forEach(function (g) { diff --git a/lib/config/axis.js b/lib/config/axis.js index c25b381..3229c9c 100644 --- a/lib/config/axis.js +++ b/lib/config/axis.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/bar.js b/lib/config/bar.js index f4cecd6..05e76e3 100644 --- a/lib/config/bar.js +++ b/lib/config/bar.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/color.js b/lib/config/color.js index 6c2b30d..4f0ca51 100644 --- a/lib/config/color.js +++ b/lib/config/color.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/gauge.js b/lib/config/gauge.js index 3417cbc..ecc107e 100644 --- a/lib/config/gauge.js +++ b/lib/config/gauge.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/grid.js b/lib/config/grid.js index edb920e..4818029 100644 --- a/lib/config/grid.js +++ b/lib/config/grid.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/index.js b/lib/config/index.js index 0bcfb1c..02cf42c 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -1,13 +1,5 @@ "use strict"; -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/web.dom-collections.iterator"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/legend.js b/lib/config/legend.js index 5d19aa5..b014c4b 100644 --- a/lib/config/legend.js +++ b/lib/config/legend.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/line.js b/lib/config/line.js index b8e9227..5b189c8 100644 --- a/lib/config/line.js +++ b/lib/config/line.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/pie.js b/lib/config/pie.js index d543cc9..227c25c 100644 --- a/lib/config/pie.js +++ b/lib/config/pie.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/radar.js b/lib/config/radar.js index 39b9ac4..22d13cf 100644 --- a/lib/config/radar.js +++ b/lib/config/radar.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/radarAxis.js b/lib/config/radarAxis.js index ee672c0..83cd0fb 100644 --- a/lib/config/radarAxis.js +++ b/lib/config/radarAxis.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/config/title.js b/lib/config/title.js index d73f8b8..f3c80b1 100644 --- a/lib/config/title.js +++ b/lib/config/title.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/core/axis.js b/lib/core/axis.js index fcd22e8..3afffdc 100644 --- a/lib/core/axis.js +++ b/lib/core/axis.js @@ -1,103 +1,31 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.index-of"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.array.splice"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.function.name"); - -require("core-js/modules/es.number.to-fixed"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-float"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.regexp.exec"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/es.string.replace"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.axis = axis; -var _updater = require("../class/updater.class"); - -var _config = require("../config"); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); -var _util = require("../util"); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); -var _util2 = require("@jiaminghi/c-render/lib/plugin/util"); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } +var _updater = require("../class/updater.class"); -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } +var _config = require("../config"); -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +var _util = require("../util"); -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var axisConfig = { xAxisConfig: _config.xAxisConfig, @@ -171,7 +99,7 @@ function getAllAxis(xAxis, yAxis) { if (xAxis instanceof Array) { var _allXAxis; - (_allXAxis = allXAxis).push.apply(_allXAxis, _toConsumableArray(xAxis)); + (_allXAxis = allXAxis).push.apply(_allXAxis, (0, _toConsumableArray2["default"])(xAxis)); } else { allXAxis.push(xAxis); } @@ -179,7 +107,7 @@ function getAllAxis(xAxis, yAxis) { if (yAxis instanceof Array) { var _allYAxis; - (_allYAxis = allYAxis).push.apply(_allYAxis, _toConsumableArray(yAxis)); + (_allYAxis = allYAxis).push.apply(_allYAxis, (0, _toConsumableArray2["default"])(yAxis)); } else { allYAxis.push(yAxis); } @@ -198,7 +126,7 @@ function getAllAxis(xAxis, yAxis) { axis: 'y' }); }); - return [].concat(_toConsumableArray(allXAxis), _toConsumableArray(allYAxis)); + return [].concat((0, _toConsumableArray2["default"])(allXAxis), (0, _toConsumableArray2["default"])(allYAxis)); } function mergeDefaultAxisConfig(allAxis) { @@ -216,7 +144,7 @@ function mergeDefaultAxisConfig(allAxis) { yAxis = yAxis.map(function (axis) { return (0, _util.deepMerge)((0, _util2.deepClone)(_config.yAxisConfig), axis); }); - return [].concat(_toConsumableArray(xAxis), _toConsumableArray(yAxis)); + return [].concat((0, _toConsumableArray2["default"])(xAxis), (0, _toConsumableArray2["default"])(yAxis)); } function mergeDefaultBoundaryGap(allAxis) { @@ -236,7 +164,7 @@ function mergeDefaultBoundaryGap(allAxis) { if (typeof axis.boundaryGap === 'boolean') return; axis.boundaryGap = true; }); - return [].concat(_toConsumableArray(valueAxis), _toConsumableArray(labelAxis)); + return [].concat((0, _toConsumableArray2["default"])(valueAxis), (0, _toConsumableArray2["default"])(labelAxis)); } function calcAxisLabelData(allAxis, series) { @@ -250,7 +178,7 @@ function calcAxisLabelData(allAxis, series) { }); valueAxis = calcValueAxisLabelData(valueAxis, series); labelAxis = calcLabelAxisLabelData(labelAxis); - return [].concat(_toConsumableArray(valueAxis), _toConsumableArray(labelAxis)); + return [].concat((0, _toConsumableArray2["default"])(valueAxis), (0, _toConsumableArray2["default"])(labelAxis)); } function calcValueAxisLabelData(valueAxis, series) { @@ -258,7 +186,7 @@ function calcValueAxisLabelData(valueAxis, series) { var minMaxValue = getValueAxisMaxMinValue(axis, series); var _getTrueMinMax = getTrueMinMax(axis, minMaxValue), - _getTrueMinMax2 = _slicedToArray(_getTrueMinMax, 2), + _getTrueMinMax2 = (0, _slicedToArray2["default"])(_getTrueMinMax, 2), min = _getTrueMinMax2[0], max = _getTrueMinMax2[1]; @@ -307,13 +235,13 @@ function getValueAxisMaxMinValue(axis, series) { function getSeriesMinMaxValue(series) { if (!series) return; - var minValue = min.apply(void 0, _toConsumableArray(series.map(function (_ref9) { + var minValue = min.apply(void 0, (0, _toConsumableArray2["default"])(series.map(function (_ref9) { var data = _ref9.data; - return min.apply(void 0, _toConsumableArray((0, _util.filterNonNumber)(data))); + return min.apply(void 0, (0, _toConsumableArray2["default"])((0, _util.filterNonNumber)(data))); }))); - var maxValue = max.apply(void 0, _toConsumableArray(series.map(function (_ref10) { + var maxValue = max.apply(void 0, (0, _toConsumableArray2["default"])(series.map(function (_ref10) { var data = _ref10.data; - return max.apply(void 0, _toConsumableArray((0, _util.filterNonNumber)(data))); + return max.apply(void 0, (0, _toConsumableArray2["default"])((0, _util.filterNonNumber)(data))); }))); return [minValue, maxValue]; } @@ -332,12 +260,12 @@ function getTrueMinMax(_ref11, _ref12) { max = _ref11.max, axis = _ref11.axis; - var _ref13 = _slicedToArray(_ref12, 2), + var _ref13 = (0, _slicedToArray2["default"])(_ref12, 2), minValue = _ref13[0], maxValue = _ref13[1]; - var minType = _typeof(min), - maxType = _typeof(max); + var minType = (0, _typeof2["default"])(min), + maxType = (0, _typeof2["default"])(max); if (!testMinMaxType(min)) { min = axisConfig[axis + 'AxisConfig'].min; @@ -376,8 +304,7 @@ function getValueLever(value) { } function testMinMaxType(val) { - var valType = _typeof(val); - + var valType = (0, _typeof2["default"])(val); var isValidString = valType === 'string' && /^\d+%$/.test(val); var isValidNumber = valType === 'number'; return isValidString || isValidNumber; @@ -397,7 +324,7 @@ function getValueAxisLabelFromZero(min, max, interval) { positive.push(currentPositive += interval); } while (currentPositive < max); - return [].concat(_toConsumableArray(negative.reverse()), [0], _toConsumableArray(positive)); + return [].concat((0, _toConsumableArray2["default"])(negative.reverse()), [0], (0, _toConsumableArray2["default"])(positive)); } function getValueAxisLabelFromMin(min, max, interval) { @@ -476,7 +403,7 @@ function setAxisPosition(allAxis) { yAxis[1].position = yAxis[0].position === 'left' ? 'right' : 'left'; } - return [].concat(_toConsumableArray(xAxis), _toConsumableArray(yAxis)); + return [].concat((0, _toConsumableArray2["default"])(xAxis), (0, _toConsumableArray2["default"])(yAxis)); } function calcAxisLinePosition(allAxis, chart) { @@ -516,11 +443,11 @@ function calcAxisTickPosition(allAxis, chart) { if (typeof boundaryGap !== 'boolean') boundaryGap = axisConfig[axis + 'AxisConfig'].boundaryGap; var labelNum = label.length; - var _linePosition = _slicedToArray(linePosition, 2), - _linePosition$ = _slicedToArray(_linePosition[0], 2), + var _linePosition = (0, _slicedToArray2["default"])(linePosition, 2), + _linePosition$ = (0, _slicedToArray2["default"])(_linePosition[0], 2), startX = _linePosition$[0], startY = _linePosition$[1], - _linePosition$2 = _slicedToArray(_linePosition[1], 2), + _linePosition$2 = (0, _slicedToArray2["default"])(_linePosition[1], 2), endX = _linePosition$2[0], endY = _linePosition$2[1]; @@ -556,7 +483,7 @@ function getTickLinePosition(axisType, boundaryGap, position, tickPosition, gap) index = axisType === 'x' ? 0 : 1; plus = gap / 2; tickLinePosition.forEach(function (_ref16) { - var _ref17 = _slicedToArray(_ref16, 2), + var _ref17 = (0, _slicedToArray2["default"])(_ref16, 2), lineStart = _ref17[0], lineEnd = _ref17[1]; @@ -573,13 +500,12 @@ function calcAxisNamePosition(allAxis, chart) { position = axisItem.position, linePosition = axisItem.linePosition; - var _linePosition2 = _slicedToArray(linePosition, 2), + var _linePosition2 = (0, _slicedToArray2["default"])(linePosition, 2), lineStart = _linePosition2[0], lineEnd = _linePosition2[1]; - var namePosition = _toConsumableArray(lineStart); - - if (nameLocation === 'end') namePosition = _toConsumableArray(lineEnd); + var namePosition = (0, _toConsumableArray2["default"])(lineStart); + if (nameLocation === 'end') namePosition = (0, _toConsumableArray2["default"])(lineEnd); if (nameLocation === 'center') { namePosition[0] = (lineStart[0] + lineEnd[0]) / 2; @@ -617,13 +543,12 @@ function calcSplitLinePosition(allAxis, chart) { if (position === 'top' || position === 'bottom') plus = h; if (position === 'right' || position === 'bottom') plus *= -1; var splitLinePosition = tickLinePosition.map(function (_ref18) { - var _ref19 = _slicedToArray(_ref18, 1), + var _ref19 = (0, _slicedToArray2["default"])(_ref18, 1), startPoint = _ref19[0]; - var endPoint = _toConsumableArray(startPoint); - + var endPoint = (0, _toConsumableArray2["default"])(startPoint); endPoint[index] += plus; - return [_toConsumableArray(startPoint), endPoint]; + return [(0, _toConsumableArray2["default"])(startPoint), endPoint]; }); if (!boundaryGap) splitLinePosition.shift(); return _objectSpread({}, axisItem, { diff --git a/lib/core/bar.js b/lib/core/bar.js index ca76f26..8680ec5 100644 --- a/lib/core/bar.js +++ b/lib/core/bar.js @@ -1,72 +1,20 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.find"); - -require("core-js/modules/es.array.find-index"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.array.splice"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.function.name"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.regexp.exec"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.set"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/es.string.replace"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +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"); @@ -75,29 +23,9 @@ var _util = require("@jiaminghi/c-render/lib/plugin/util"); var _util2 = require("../util"); -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function bar(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -214,7 +142,7 @@ function groupBarByLabelAxis(bars) { index = _ref5$labelAxis.index; return axis + index; }); - labelAxis = _toConsumableArray(new Set(labelAxis)); + labelAxis = (0, _toConsumableArray2["default"])(new Set(labelAxis)); return labelAxis.map(function (axisIndex) { return bars.filter(function (_ref6) { var _ref6$labelAxis = _ref6.labelAxis, @@ -231,15 +159,14 @@ function getBarStack(bars) { var stack = _ref7.stack; if (stack) stacks.push(stack); }); - return _toConsumableArray(new Set(stacks)); + return (0, _toConsumableArray2["default"])(new Set(stacks)); } function setBarNum(bars) { - var barNum = _toConsumableArray(new Set(bars.map(function (_ref8) { + 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; }); @@ -277,7 +204,7 @@ function setBarWidthAndGap(bars) { } var _widthAndGap = widthAndGap, - _widthAndGap2 = _slicedToArray(_widthAndGap, 2), + _widthAndGap2 = (0, _slicedToArray2["default"])(_widthAndGap, 2), width = _widthAndGap2[0], gap = _widthAndGap2[1]; @@ -555,7 +482,7 @@ function getLeftEchelonShape(barItem, i) { barWidth = barItem.barWidth, echelonOffset = barItem.echelonOffset; - var _barValueAxisPos$i = _slicedToArray(barValueAxisPos[i], 2), + var _barValueAxisPos$i = (0, _slicedToArray2["default"])(barValueAxisPos[i], 2), start = _barValueAxisPos$i[0], end = _barValueAxisPos$i[1]; @@ -590,7 +517,7 @@ function getRightEchelonShape(barItem, i) { barWidth = barItem.barWidth, echelonOffset = barItem.echelonOffset; - var _barValueAxisPos$i2 = _slicedToArray(barValueAxisPos[i], 2), + var _barValueAxisPos$i2 = (0, _slicedToArray2["default"])(barValueAxisPos[i], 2), start = _barValueAxisPos$i2[0], end = _barValueAxisPos$i2[1]; @@ -624,7 +551,7 @@ function getNormalBarShape(barItem, i) { barLabelAxisPos = barItem.barLabelAxisPos, barWidth = barItem.barWidth; - var _barValueAxisPos$i3 = _slicedToArray(barValueAxisPos[i], 2), + var _barValueAxisPos$i3 = (0, _slicedToArray2["default"])(barValueAxisPos[i], 2), start = _barValueAxisPos$i3[0], end = _barValueAxisPos$i3[1]; @@ -671,14 +598,14 @@ function getGradientParams(barItem, i) { linePosition = _barItem$valueAxis.linePosition, axis = _barItem$valueAxis.axis; - var _barValueAxisPos$i4 = _slicedToArray(barValueAxisPos[i], 2), + var _barValueAxisPos$i4 = (0, _slicedToArray2["default"])(barValueAxisPos[i], 2), start = _barValueAxisPos$i4[0], end = _barValueAxisPos$i4[1]; var labelAxisPos = barLabelAxisPos[i]; var value = data[i]; - var _linePosition = _slicedToArray(linePosition, 2), + var _linePosition = (0, _slicedToArray2["default"])(linePosition, 2), lineStart = _linePosition[0], lineEnd = _linePosition[1]; @@ -815,9 +742,7 @@ function getFormatterLabels(barItem) { return d.toString(); }); if (!formatter) return data; - - var type = _typeof(formatter); - + var type = (0, _typeof2["default"])(formatter); if (type === 'string') return data.map(function (d) { return formatter.replace('{value}', d); }); @@ -838,7 +763,7 @@ function getLabelsPosition(barItem) { offset = label.offset; var axis = barItem.valueAxis.axis; return barValueAxisPos.map(function (_ref10, i) { - var _ref11 = _slicedToArray(_ref10, 2), + var _ref11 = (0, _slicedToArray2["default"])(_ref10, 2), start = _ref11[0], end = _ref11[1]; @@ -859,11 +784,11 @@ function getLabelsPosition(barItem) { } function getOffsetedPoint(_ref12, _ref13) { - var _ref14 = _slicedToArray(_ref12, 2), + var _ref14 = (0, _slicedToArray2["default"])(_ref12, 2), x = _ref14[0], y = _ref14[1]; - var _ref15 = _slicedToArray(_ref13, 2), + var _ref15 = (0, _slicedToArray2["default"])(_ref13, 2), ox = _ref15[0], oy = _ref15[1]; diff --git a/lib/core/gauge.js b/lib/core/gauge.js index de0b544..e906af4 100644 --- a/lib/core/gauge.js +++ b/lib/core/gauge.js @@ -1,66 +1,20 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.array.splice"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.function.name"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.regexp.exec"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/es.string.replace"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.gauge = gauge; +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 _gauge = require("../config/gauge"); @@ -73,27 +27,7 @@ var _color = require("@jiaminghi/color"); 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function gauge(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -167,7 +101,7 @@ function calcGaugesCenter(gauges, chart) { function calcGaugesRadius(gauges, chart) { var area = chart.render.area; - var maxRadius = Math.min.apply(Math, _toConsumableArray(area)) / 2; + var maxRadius = Math.min.apply(Math, (0, _toConsumableArray2["default"])(area)) / 2; gauges.forEach(function (gaugeItem) { var radius = gaugeItem.radius; @@ -182,7 +116,7 @@ function calcGaugesRadius(gauges, chart) { function calcGaugesDataRadiusAndLineWidth(gauges, chart) { var area = chart.render.area; - var maxRadius = Math.min.apply(Math, _toConsumableArray(area)) / 2; + var maxRadius = Math.min.apply(Math, (0, _toConsumableArray2["default"])(area)) / 2; gauges.forEach(function (gaugeItem) { var radius = gaugeItem.radius, data = gaugeItem.data, @@ -258,7 +192,7 @@ function calcGaugesAxisTickPosition(gauges, chart) { if (i === splitNum - 1) angle -= offset; gaugeItem.tickAngles[i] = angle; gaugeItem.tickInnerRadius[i] = innerRadius; - return [_util.getCircleRadianPoint.apply(void 0, _toConsumableArray(center).concat([outerRadius, angle])), _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(center).concat([innerRadius, angle]))]; + 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; @@ -271,10 +205,10 @@ function calcGaugesLabelPositionAndAlign(gauges, chart) { tickAngles = gaugeItem.tickAngles, labelGap = gaugeItem.axisLabel.labelGap; var position = tickAngles.map(function (angle, i) { - return _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(center).concat([tickInnerRadius[i] - labelGap, tickAngles[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 = _slicedToArray(_ref, 2), + var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), x = _ref2[0], y = _ref2[1]; @@ -301,9 +235,7 @@ function calcGaugesLabelData(gauges, chart) { var value = new Array(splitNum).fill(0).map(function (foo, i) { return parseInt(min + valueGap * i); }); - - var formatterType = _typeof(formatter); - + var formatterType = (0, _typeof2["default"])(formatter); data = (0, _util2.deepMerge)(value, data).map(function (v, i) { var label = v; @@ -341,9 +273,9 @@ function calcGaugesDetailsPosition(gauges, chart) { if (position === 'center') { point = center; } else if (position === 'start') { - point = _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(center).concat([radius, startAngle])); + point = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(center).concat([radius, startAngle])); } else if (position === 'end') { - point = _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(center).concat([radius, endAngle])); + point = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(center).concat([radius, endAngle])); } return getOffsetedPoint(point, offset); @@ -358,9 +290,7 @@ function calcGaugesDetailsContent(gauges, chart) { var data = gaugeItem.data, details = gaugeItem.details; var formatter = details.formatter; - - var formatterType = _typeof(formatter); - + var formatterType = (0, _typeof2["default"])(formatter); var contents = data.map(function (dataItem) { var content = dataItem.value; @@ -378,11 +308,11 @@ function calcGaugesDetailsContent(gauges, chart) { } function getOffsetedPoint(_ref4, _ref5) { - var _ref6 = _slicedToArray(_ref4, 2), + var _ref6 = (0, _slicedToArray2["default"])(_ref4, 2), x = _ref6[0], y = _ref6[1]; - var _ref7 = _slicedToArray(_ref5, 2), + var _ref7 = (0, _slicedToArray2["default"])(_ref5, 2), ox = _ref7[0], oy = _ref7[1]; @@ -573,8 +503,8 @@ function beforeChangeArc(graph, config) { graphGradient.splice(needNum); } else { var last = graphGradient.slice(-1)[0]; - graphGradient.push.apply(graphGradient, _toConsumableArray(new Array(needNum - cacheNum).fill(0).map(function (foo) { - return _toConsumableArray(last); + graphGradient.push.apply(graphGradient, (0, _toConsumableArray2["default"])(new Array(needNum - cacheNum).fill(0).map(function (foo) { + return (0, _toConsumableArray2["default"])(last); }))); } } @@ -626,7 +556,7 @@ function getPointerStyle(gaugeItem) { } function getPointerPoints(_ref8) { - var _ref9 = _slicedToArray(_ref8, 2), + var _ref9 = (0, _slicedToArray2["default"])(_ref8, 2), x = _ref9[0], y = _ref9[1]; diff --git a/lib/core/grid.js b/lib/core/grid.js index aaa582a..c99509e 100644 --- a/lib/core/grid.js +++ b/lib/core/grid.js @@ -1,44 +1,16 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +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"); @@ -47,19 +19,9 @@ var _config = require("../config"); var _util2 = require("../util"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function grid(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -91,7 +53,7 @@ function getGridConfig(gridItem, updater) { } function getGridShape(gridItem, updater) { - var _updater$chart$render = _slicedToArray(updater.chart.render.area, 2), + var _updater$chart$render = (0, _slicedToArray2["default"])(updater.chart.render.area, 2), w = _updater$chart$render[0], h = _updater$chart$render[1]; diff --git a/lib/core/index.js b/lib/core/index.js index dd97889..98ea69c 100644 --- a/lib/core/index.js +++ b/lib/core/index.js @@ -1,7 +1,5 @@ "use strict"; -require("core-js/modules/es.object.define-property"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/core/legend.js b/lib/core/legend.js index 1d5771e..f991a08 100644 --- a/lib/core/legend.js +++ b/lib/core/legend.js @@ -1,50 +1,18 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.find"); - -require("core-js/modules/es.array.find-index"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.function.name"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +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"); @@ -53,18 +21,6 @@ var _config = require("../config"); var _util2 = require("../util"); -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - function legend(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var legend = option.legend; @@ -97,7 +53,7 @@ function legend(chart) { function initLegendData(legend) { var data = legend.data; legend.data = data.map(function (item) { - var itemType = _typeof(item); + var itemType = (0, _typeof2["default"])(item); if (itemType === 'string') { return { @@ -283,11 +239,11 @@ function getHorizontalYOffset(legend, chart) { } function mergeOffset(_ref4, _ref5) { - var _ref6 = _slicedToArray(_ref4, 2), + var _ref6 = (0, _slicedToArray2["default"])(_ref4, 2), x = _ref6[0], y = _ref6[1]; - var _ref7 = _slicedToArray(_ref5, 2), + var _ref7 = (0, _slicedToArray2["default"])(_ref5, 2), ox = _ref7[0], oy = _ref7[1]; @@ -296,7 +252,7 @@ function mergeOffset(_ref4, _ref5) { function calcVerticalPosition(legend, chart) { var _getVerticalXOffset = getVerticalXOffset(legend, chart), - _getVerticalXOffset2 = _slicedToArray(_getVerticalXOffset, 2), + _getVerticalXOffset2 = (0, _slicedToArray2["default"])(_getVerticalXOffset, 2), isRight = _getVerticalXOffset2[0], xOffset = _getVerticalXOffset2[1]; @@ -378,7 +334,7 @@ function getIconConfig(legendItem, updater) { animationFrame = legendItem.animationFrame, rLevel = legendItem.rLevel; return data.map(function (item, i) { - return _defineProperty({ + return (0, _defineProperty2["default"])({ name: item.icon === 'line' ? 'lineIcon' : 'rect', index: rLevel, visible: legendItem.show, @@ -397,7 +353,7 @@ function getIconShape(legendItem, i) { iconWidth = legendItem.iconWidth, iconHeight = legendItem.iconHeight; - var _data$i$iconPosition = _slicedToArray(data[i].iconPosition, 2), + var _data$i$iconPosition = (0, _slicedToArray2["default"])(data[i].iconPosition, 2), x = _data$i$iconPosition[0], y = _data$i$iconPosition[1]; @@ -471,7 +427,7 @@ function getTextHoverRect(legendItem, i) { var _legendItem$data$i3 = legendItem.data[i], status = _legendItem$data$i3.status, - _legendItem$data$i3$t = _slicedToArray(_legendItem$data$i3.textPosition, 2), + _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; diff --git a/lib/core/line.js b/lib/core/line.js index de2a020..0846fe4 100644 --- a/lib/core/line.js +++ b/lib/core/line.js @@ -1,99 +1,31 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.find"); - -require("core-js/modules/es.array.find-index"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.array.splice"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.function.name"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.regexp.exec"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/es.string.replace"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.line = line; -var _updater = require("../class/updater.class"); - -var _config = require("../config"); - -var _bezierCurve = _interopRequireDefault(require("@jiaminghi/bezier-curve")); - -var _util = require("../util"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } +var _updater = require("../class/updater.class"); -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } +var _config = require("../config"); -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } +var _bezierCurve = _interopRequireDefault(require("@jiaminghi/bezier-curve")); -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } +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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var polylineToBezierCurve = _bezierCurve["default"].polylineToBezierCurve, getBezierCurveLength = _bezierCurve["default"].getBezierCurveLength; @@ -296,8 +228,8 @@ function getGradientParams(lineItem) { var mainPos = linePosition.map(function (p) { return p[changeIndex]; }); - var maxPos = Math.max.apply(Math, _toConsumableArray(mainPos)); - var minPos = Math.min.apply(Math, _toConsumableArray(mainPos)); + 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; @@ -315,15 +247,12 @@ function lineAreaDrawed(_ref5, _ref6) { var points = shape.points; var changeIndex = lineFillBottomPos.changeIndex, changeValue = lineFillBottomPos.changeValue; - - var linePoint1 = _toConsumableArray(points[points.length - 1]); - - var linePoint2 = _toConsumableArray(points[0]); - + 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, _toConsumableArray(linePoint1)); - ctx.lineTo.apply(ctx, _toConsumableArray(linePoint2)); + ctx.lineTo.apply(ctx, (0, _toConsumableArray2["default"])(linePoint1)); + ctx.lineTo.apply(ctx, (0, _toConsumableArray2["default"])(linePoint2)); ctx.closePath(); ctx.fill(); } @@ -361,9 +290,9 @@ function beforeChangeLineAndArea(graph, config) { if (pointsNum > graphPointsNum) { var lastPoint = graphPoints.slice(-1)[0]; var newAddPoints = new Array(pointsNum - graphPointsNum).fill(0).map(function (foo) { - return _toConsumableArray(lastPoint); + return (0, _toConsumableArray2["default"])(lastPoint); }); - graphPoints.push.apply(graphPoints, _toConsumableArray(newAddPoints)); + graphPoints.push.apply(graphPoints, (0, _toConsumableArray2["default"])(newAddPoints)); } else if (pointsNum < graphPointsNum) { graphPoints.splice(pointsNum); } @@ -415,7 +344,7 @@ function getStartLineConfig(lineItem) { if (lineDash) { realLineDash = [0, 0]; } else { - realLineDash = _toConsumableArray(realLineDash).reverse(); + realLineDash = (0, _toConsumableArray2["default"])(realLineDash).reverse(); } config.style.lineDash = realLineDash; @@ -445,7 +374,7 @@ function getPointShapes(lineItem) { var linePosition = lineItem.linePosition, radius = lineItem.linePoint.radius; return linePosition.map(function (_ref7) { - var _ref8 = _slicedToArray(_ref7, 2), + var _ref8 = (0, _slicedToArray2["default"])(_ref7, 2), rx = _ref8[0], ry = _ref8[1]; @@ -513,13 +442,12 @@ function getLabelPosition(lineItem) { changeValue = lineFillBottomPos.changeValue; return linePosition.map(function (pos) { if (position === 'bottom') { - pos = _toConsumableArray(pos); + pos = (0, _toConsumableArray2["default"])(pos); pos[changeIndex] = changeValue; } if (position === 'center') { - var bottom = _toConsumableArray(pos); - + var bottom = (0, _toConsumableArray2["default"])(pos); bottom[changeIndex] = changeValue; pos = getCenterLabelPoint(pos, bottom); } @@ -529,11 +457,11 @@ function getLabelPosition(lineItem) { } function getOffsetedPoint(_ref9, _ref10) { - var _ref11 = _slicedToArray(_ref9, 2), + var _ref11 = (0, _slicedToArray2["default"])(_ref9, 2), x = _ref11[0], y = _ref11[1]; - var _ref12 = _slicedToArray(_ref10, 2), + var _ref12 = (0, _slicedToArray2["default"])(_ref10, 2), ox = _ref12[0], oy = _ref12[1]; @@ -541,11 +469,11 @@ function getOffsetedPoint(_ref9, _ref10) { } function getCenterLabelPoint(_ref13, _ref14) { - var _ref15 = _slicedToArray(_ref13, 2), + var _ref15 = (0, _slicedToArray2["default"])(_ref13, 2), ax = _ref15[0], ay = _ref15[1]; - var _ref16 = _slicedToArray(_ref14, 2), + var _ref16 = (0, _slicedToArray2["default"])(_ref14, 2), bx = _ref16[0], by = _ref16[1]; @@ -561,9 +489,7 @@ function formatterLabel(lineItem) { return d.toString(); }); if (!formatter) return data; - - var type = _typeof(formatter); - + var type = (0, _typeof2["default"])(formatter); if (type === 'string') return data.map(function (d) { return formatter.replace('{value}', d); }); diff --git a/lib/core/mergeColor.js b/lib/core/mergeColor.js index 74be4ec..fd27403 100644 --- a/lib/core/mergeColor.js +++ b/lib/core/mergeColor.js @@ -1,13 +1,5 @@ "use strict"; -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/web.dom-collections.for-each"); - Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/core/pie.js b/lib/core/pie.js index d334d71..90ff560 100644 --- a/lib/core/pie.js +++ b/lib/core/pie.js @@ -1,70 +1,20 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.reduce"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.array.sort"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.function.name"); - -require("core-js/modules/es.number.to-fixed"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-float"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.regexp.exec"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/es.string.replace"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +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"); @@ -75,27 +25,7 @@ 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function pie(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -154,7 +84,7 @@ function calcPiesCenter(pies, chart) { } function calcPiesRadius(pies, chart) { - var maxRadius = Math.min.apply(Math, _toConsumableArray(chart.render.area)) / 2; + var maxRadius = Math.min.apply(Math, (0, _toConsumableArray2["default"])(chart.render.area)) / 2; pies.forEach(function (pie) { var radius = pie.radius, data = pie.data; @@ -189,9 +119,7 @@ function calcRosePiesRadius(pies, chart) { data = pie.data, roseSort = pie.roseSort; var roseIncrement = getRoseIncrement(pie); - - var dataCopy = _toConsumableArray(data); - + var dataCopy = (0, _toConsumableArray2["default"])(data); data = sortData(data); data.forEach(function (item, i) { item.radius[1] = radius[1] - roseIncrement * i; @@ -227,10 +155,10 @@ function getRoseIncrement(pie) { var data = pie.data; var allRadius = data.reduce(function (all, _ref4) { var radius = _ref4.radius; - return [].concat(_toConsumableArray(all), _toConsumableArray(radius)); + return [].concat((0, _toConsumableArray2["default"])(all), (0, _toConsumableArray2["default"])(radius)); }, []); - var minRadius = Math.min.apply(Math, _toConsumableArray(allRadius)); - var maxRadius = Math.max.apply(Math, _toConsumableArray(allRadius)); + var minRadius = Math.min.apply(Math, (0, _toConsumableArray2["default"])(allRadius)); + var maxRadius = Math.max.apply(Math, (0, _toConsumableArray2["default"])(allRadius)); return (maxRadius - minRadius) * 0.6 / (data.length - 1 || 1); } @@ -268,7 +196,7 @@ function calcPiesAngle(pies) { data = pie.data; data.forEach(function (item, i) { var _getDataAngle = getDataAngle(data, i), - _getDataAngle2 = _slicedToArray(_getDataAngle, 2), + _getDataAngle2 = (0, _slicedToArray2["default"])(_getDataAngle, 2), startAngle = _getDataAngle2[0], endAngle = _getDataAngle2[1]; @@ -306,13 +234,13 @@ function getPieInsideLabelPos(pieItem, dataItem) { var startAngle = dataItem.startAngle, endAngle = dataItem.endAngle, - _dataItem$radius = _slicedToArray(dataItem.radius, 2), + _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, _toConsumableArray(center).concat([radius, angle])); + return _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(center).concat([radius, angle])); } function calcPiesEdgeCenterPos(pies) { @@ -325,7 +253,7 @@ function calcPiesEdgeCenterPos(pies) { radius = item.radius; var centerAngle = (startAngle + endAngle) / 2; - var pos = _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(center).concat([radius[1], centerAngle])); + var pos = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(center).concat([radius[1], centerAngle])); item.edgeCenterPos = pos; }); @@ -359,13 +287,13 @@ function getLabelLineBendRadius(pieItem) { function getPieMaxRadius(pieItem) { var data = pieItem.data; var radius = data.map(function (_ref8) { - var _ref8$radius = _slicedToArray(_ref8.radius, 2), + var _ref8$radius = (0, _slicedToArray2["default"])(_ref8.radius, 2), foo = _ref8$radius[0], r = _ref8$radius[1]; return r; }); - return Math.max.apply(Math, _toConsumableArray(radius)); + return Math.max.apply(Math, (0, _toConsumableArray2["default"])(radius)); } function getLeftOrRightPieDataItems(pieItem) { @@ -383,11 +311,11 @@ function getLeftOrRightPieDataItems(pieItem) { function sortPiesFromTopToBottom(dataItem) { dataItem.sort(function (_ref10, _ref11) { - var _ref10$edgeCenterPos = _slicedToArray(_ref10.edgeCenterPos, 2), + var _ref10$edgeCenterPos = (0, _slicedToArray2["default"])(_ref10.edgeCenterPos, 2), t = _ref10$edgeCenterPos[0], ay = _ref10$edgeCenterPos[1]; - var _ref11$edgeCenterPos = _slicedToArray(_ref11.edgeCenterPos, 2), + var _ref11$edgeCenterPos = (0, _slicedToArray2["default"])(_ref11.edgeCenterPos, 2), tt = _ref11$edgeCenterPos[0], by = _ref11$edgeCenterPos[1]; @@ -410,10 +338,9 @@ function addLabelLineAndAlign(dataItem, pieItem) { var labelLineEndLength = outsideLabel.labelLineEndLength; var angle = (startAngle + endAngle) / 2; - var bendPoint = _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(center).concat([radius, angle])); - - var endPoint = _toConsumableArray(bendPoint); + 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); @@ -508,9 +435,7 @@ function getInsideLabelShape(pieItem, i) { data = pieItem.data; var formatter = insideLabel.formatter; var dataItem = data[i]; - - var formatterType = _typeof(formatter); - + var formatterType = (0, _typeof2["default"])(formatter); var label = ''; if (formatterType === 'string') { @@ -616,9 +541,7 @@ function getOutsideLabelShape(pieItem, i) { name = _data$i.name, percent = _data$i.percent, value = _data$i.value; - - var formatterType = _typeof(formatter); - + var formatterType = (0, _typeof2["default"])(formatter); var label = ''; if (formatterType === 'string') { diff --git a/lib/core/radar.js b/lib/core/radar.js index c0f62a3..fb22139 100644 --- a/lib/core/radar.js +++ b/lib/core/radar.js @@ -1,62 +1,20 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.slice"); - -require("core-js/modules/es.array.splice"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.regexp.exec"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/es.string.replace"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +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"); @@ -69,27 +27,7 @@ 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function radar(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -141,7 +79,7 @@ function calcRadarPosition(radars, chart) { if (typeof v !== 'number') v = min; var dataRadius = (v - min) / (max - min) * radius; radarItem.dataRadius[i] = dataRadius; - return _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(centerPos).concat([dataRadius, axisLineAngles[i]])); + return _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([dataRadius, axisLineAngles[i]])); }); }); return radars; @@ -157,7 +95,7 @@ function calcRadarLabelPosition(radars, chart) { label = radarItem.label; var labelGap = label.labelGap; radarItem.labelPosition = dataRadius.map(function (r, i) { - return _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(centerPos).concat([r + labelGap, axisLineAngles[i]])); + return _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([r + labelGap, axisLineAngles[i]])); }); }); return radars; @@ -167,14 +105,14 @@ function calcRadarLabelAlign(radars, chart) { var radarAxis = chart.radarAxis; if (!radarAxis) return []; - var _radarAxis$centerPos = _slicedToArray(radarAxis.centerPos, 2), + 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 = _slicedToArray(_ref2, 2), + var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2), lx = _ref3[0], ly = _ref3[1]; @@ -209,7 +147,7 @@ function getStartRadarConfig(radarItem, updater) { var config = getRadarConfig(radarItem)[0]; var pointNum = config.shape.points.length; var points = new Array(pointNum).fill(0).map(function (foo) { - return _toConsumableArray(centerPos); + return (0, _toConsumableArray2["default"])(centerPos); }); config.shape.points = points; return [config]; @@ -244,9 +182,9 @@ function beforeChangeRadar(graph, _ref4) { if (pointsNum > graphPointsNum) { var lastPoint = graphPoints.slice(-1)[0]; var newAddPoints = new Array(pointsNum - graphPointsNum).fill(0).map(function (foo) { - return _toConsumableArray(lastPoint); + return (0, _toConsumableArray2["default"])(lastPoint); }); - graphPoints.push.apply(graphPoints, _toConsumableArray(newAddPoints)); + graphPoints.push.apply(graphPoints, (0, _toConsumableArray2["default"])(newAddPoints)); } else if (pointsNum < graphPointsNum) { graphPoints.splice(pointsNum); } @@ -325,9 +263,7 @@ function getLabelShape(radarItem, i) { formatter = label.formatter; var position = mergePointOffset(labelPosition[i], offset); var labelText = data[i] ? data[i].toString() : '0'; - - var formatterType = _typeof(formatter); - + var formatterType = (0, _typeof2["default"])(formatter); if (formatterType === 'string') labelText = formatter.replace('{value}', labelText); if (formatterType === 'function') labelText = formatter(labelText); return { @@ -337,11 +273,11 @@ function getLabelShape(radarItem, i) { } function mergePointOffset(_ref5, _ref6) { - var _ref7 = _slicedToArray(_ref5, 2), + var _ref7 = (0, _slicedToArray2["default"])(_ref5, 2), x = _ref7[0], y = _ref7[1]; - var _ref8 = _slicedToArray(_ref6, 2), + var _ref8 = (0, _slicedToArray2["default"])(_ref6, 2), ox = _ref8[0], oy = _ref8[1]; diff --git a/lib/core/radarAxis.js b/lib/core/radarAxis.js index 68a3a6b..575934f 100644 --- a/lib/core/radarAxis.js +++ b/lib/core/radarAxis.js @@ -1,58 +1,18 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.function.name"); - -require("core-js/modules/es.object.define-properties"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.get-own-property-descriptor"); - -require("core-js/modules/es.object.get-own-property-descriptors"); - -require("core-js/modules/es.object.keys"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.radarAxis = radarAxis; +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 _index = require("../config/index"); @@ -61,27 +21,9 @@ var _util = require("@jiaminghi/c-render/lib/plugin/util"); var _util2 = require("../util"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - 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; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function radarAxis(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; @@ -149,7 +91,7 @@ function calcRadarAxisRingRadius(radarAxis, chart) { var area = chart.render.area; var splitNum = radarAxis.splitNum, radius = radarAxis.radius; - var maxRadius = Math.min.apply(Math, _toConsumableArray(area)) / 2; + 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) { @@ -172,7 +114,7 @@ function calcRadarAxisLinePosition(radarAxis) { }); radarAxis.axisLineAngles = angles; radarAxis.axisLinePosition = angles.map(function (g) { - return _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(centerPos).concat([radius, g])); + return _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([radius, g])); }); return radarAxis; } @@ -193,7 +135,7 @@ function calcRadarAxisLabelPosition(radarAxis) { axisLabel = radarAxis.axisLabel; radius += axisLabel.labelGap; radarAxis.axisLabelPosition = axisLineAngles.map(function (angle) { - return _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(centerPos).concat([radius, angle])); + return _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([radius, angle])); }); return radarAxis; } @@ -247,9 +189,9 @@ function getSplitAreaStyle(radarAxis, i) { var lineWidth = ringRadius[0] - 0; if (polygon) { - var point1 = _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(centerPos).concat([ringRadius[0], axisLineAngles[0]])); + var point1 = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([ringRadius[0], axisLineAngles[0]])); - var point2 = _util.getCircleRadianPoint.apply(void 0, _toConsumableArray(centerPos).concat([ringRadius[0], axisLineAngles[1]])); + var point2 = _util.getCircleRadianPoint.apply(void 0, (0, _toConsumableArray2["default"])(centerPos).concat([ringRadius[0], axisLineAngles[1]])); lineWidth = (0, _util2.getPointToLineDistance)(centerPos, point1, point2); } @@ -422,7 +364,7 @@ function getAxisLableShape(radarAxis, i) { function getAxisLableStyle(radarAxis, i) { var axisLabel = radarAxis.axisLabel, - _radarAxis$centerPos = _slicedToArray(radarAxis.centerPos, 2), + _radarAxis$centerPos = (0, _slicedToArray2["default"])(radarAxis.centerPos, 2), x = _radarAxis$centerPos[0], y = _radarAxis$centerPos[1], axisLabelPosition = radarAxis.axisLabelPosition; @@ -430,7 +372,7 @@ function getAxisLableStyle(radarAxis, i) { var color = axisLabel.color, style = axisLabel.style; - var _axisLabelPosition$i = _slicedToArray(axisLabelPosition[i], 2), + var _axisLabelPosition$i = (0, _slicedToArray2["default"])(axisLabelPosition[i], 2), labelXpos = _axisLabelPosition$i[0], labelYPos = _axisLabelPosition$i[1]; diff --git a/lib/core/title.js b/lib/core/title.js index 87ee03d..dfd6bf4 100644 --- a/lib/core/title.js +++ b/lib/core/title.js @@ -1,28 +1,14 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/web.dom-collections.iterator"); +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"); @@ -31,14 +17,6 @@ var _config = require("../config"); var _util2 = require("../util"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - function title(chart) { var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var title = []; @@ -80,7 +58,7 @@ function getTitleShape(titleItem, updater) { y = _updater$chart$gridAr.y, w = _updater$chart$gridAr.w; - var _offset = _slicedToArray(offset, 2), + var _offset = (0, _slicedToArray2["default"])(offset, 2), ox = _offset[0], oy = _offset[1]; diff --git a/lib/extend/index.js b/lib/extend/index.js index 4ed3743..53e985c 100644 --- a/lib/extend/index.js +++ b/lib/extend/index.js @@ -1,46 +1,8 @@ "use strict"; -require("core-js/modules/es.symbol"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.find"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.number.to-fixed"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.parse-int"); - -require("core-js/modules/es.regexp.exec"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/es.string.split"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); var _cRender = require("@jiaminghi/c-render"); @@ -50,14 +12,6 @@ var _color = require("@jiaminghi/color"); var _index = require("../util/index"); -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } - -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - var pie = { shape: { rx: 0, @@ -101,9 +55,9 @@ var pie = { var connectPoint2 = (0, _util.getCircleRadianPoint)(rx, ry, ir, startAngle).map(function (p) { return parseInt(p) + 0.5; }); - ctx.lineTo.apply(ctx, _toConsumableArray(connectPoint1)); + ctx.lineTo.apply(ctx, (0, _toConsumableArray2["default"])(connectPoint1)); ctx.arc(rx, ry, or > 0 ? or : 0, endAngle, startAngle, clockWise); - ctx.lineTo.apply(ctx, _toConsumableArray(connectPoint2)); + ctx.lineTo.apply(ctx, (0, _toConsumableArray2["default"])(connectPoint2)); ctx.closePath(); ctx.stroke(); ctx.fill(); @@ -217,8 +171,8 @@ var numberText = { textString += t + (currentNumber || ''); }); ctx.closePath(); - ctx.strokeText.apply(ctx, [textString].concat(_toConsumableArray(position))); - ctx.fillText.apply(ctx, [textString].concat(_toConsumableArray(position))); + ctx.strokeText.apply(ctx, [textString].concat((0, _toConsumableArray2["default"])(position))); + ctx.fillText.apply(ctx, [textString].concat((0, _toConsumableArray2["default"])(position))); } }; var lineIcon = { diff --git a/lib/index.js b/lib/index.js index 664f236..dd747d3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,6 +1,6 @@ "use strict"; -require("core-js/modules/es.object.define-property"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true @@ -13,13 +13,9 @@ Object.defineProperty(exports, "changeDefaultConfig", { }); exports["default"] = void 0; -require("regenerator-runtime/runtime"); - var _charts = _interopRequireDefault(require("./class/charts.class")); var _config = require("./config"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var _default = _charts["default"]; exports["default"] = _default; \ No newline at end of file diff --git a/lib/util/index.js b/lib/util/index.js index a1216a2..f633116 100644 --- a/lib/util/index.js +++ b/lib/util/index.js @@ -1,46 +1,6 @@ "use strict"; -require("core-js/modules/es.symbol"); - -require("core-js/modules/es.symbol.description"); - -require("core-js/modules/es.symbol.iterator"); - -require("core-js/modules/es.array.concat"); - -require("core-js/modules/es.array.fill"); - -require("core-js/modules/es.array.filter"); - -require("core-js/modules/es.array.find-index"); - -require("core-js/modules/es.array.for-each"); - -require("core-js/modules/es.array.from"); - -require("core-js/modules/es.array.is-array"); - -require("core-js/modules/es.array.iterator"); - -require("core-js/modules/es.array.map"); - -require("core-js/modules/es.array.reduce"); - -require("core-js/modules/es.array.splice"); - -require("core-js/modules/es.date.to-string"); - -require("core-js/modules/es.object.define-property"); - -require("core-js/modules/es.object.to-string"); - -require("core-js/modules/es.regexp.to-string"); - -require("core-js/modules/es.string.iterator"); - -require("core-js/modules/web.dom-collections.for-each"); - -require("core-js/modules/web.dom-collections.iterator"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true @@ -56,17 +16,11 @@ exports.getPointToLineDistance = getPointToLineDistance; exports.initNeedSeries = initNeedSeries; exports.radianToAngle = radianToAngle; -var _util = require("@jiaminghi/c-render/lib/plugin/util"); - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); -function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } - -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +var _util = require("@jiaminghi/c-render/lib/plugin/util"); function filterNonNumber(array) { return array.filter(function (n) { @@ -76,7 +30,7 @@ function filterNonNumber(array) { function deepMerge(target, merged) { for (var key in merged) { - target[key] = target[key] && _typeof(target[key]) === 'object' ? deepMerge(target[key], merged[key]) : target[key] = merged[key]; + target[key] = target[key] && (0, _typeof2["default"])(target[key]) === 'object' ? deepMerge(target[key], merged[key]) : target[key] = merged[key]; } return target; @@ -91,7 +45,7 @@ function mulAdd(nums) { function mergeSameStackData(item, series) { var stack = item.stack; - if (!stack) return _toConsumableArray(item.data); + if (!stack) return (0, _toConsumableArray2["default"])(item.data); var stacks = series.filter(function (_ref) { var s = _ref.stack; return s === stack; @@ -122,7 +76,7 @@ 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, _toConsumableArray(begin).concat(_toConsumableArray(end))); + 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); @@ -135,7 +89,7 @@ function getPolylineLength(points) { return [points[i], points[i + 1]]; }); var lengths = lineSegments.map(function (item) { - return getTwoPointDistance.apply(void 0, _toConsumableArray(item)); + return getTwoPointDistance.apply(void 0, (0, _toConsumableArray2["default"])(item)); }); return mulAdd(lengths); }