From 5316d9ad0b617bc57dc33fefbaa1d3c8eee148e9 Mon Sep 17 00:00:00 2001 From: kener Date: Thu, 24 Apr 2014 17:47:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E9=87=8D=E6=9E=84=20chrod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chart/chord.js | 501 ++++++++++++++++++++++----------------------- 1 file changed, 249 insertions(+), 252 deletions(-) diff --git a/src/chart/chord.js b/src/chart/chord.js index 5998121a6..82cb41c40 100644 --- a/src/chart/chord.js +++ b/src/chart/chord.js @@ -26,129 +26,102 @@ define(function (require) { var _devicePixelRatio = window.devicePixelRatio || 1; function Chord(ecTheme, messageCenter, zr, option, component) { - var self = this; - ComponentBase.call(this, ecTheme, zr, option); CalculableBase.call(this); - var legend; - var getColor; - var isSelected; - - var series; - this.type = ecConfig.CHART_TYPE_CHORD; - - var _zlevelBase = self.getZlevelBase(); - - var chordSerieSample; - // Config - var chordSeries = []; - var groups; - var startAngle; - var clockWise; - var innerRadius; - var outerRadius; - var padding; - var sortGroups; - var sortSubGroups; - var center; - var showScale; - var showScaleText; - - var strokeFix = 0; - // Adjacency matrix - var dataMat; - - var sectorShapes = []; - var chordShapes = []; - - var scaleLineLength = 4; - var scaleUnitAngle = 4; - - function _buildShape() { - self.selectedMap = {}; - chordSeries = []; - chordSerieSample = null; + this.init(option, component); + } + + Chord.prototype = { + type : ecConfig.CHART_TYPE_CHORD, + /** + * 绘制图形 + */ + _buildShape : function () { + var series = this.series; + this.selectedMap = {}; + this.chordSeries = []; + this.chordSerieSample = null; var matrix = []; var serieNumber = 0; for (var i = 0, l = series.length; i < l; i++) { - if (series[i].type === self.type) { + if (series[i].type === this.type) { // Use the config of first chord serie - if (!chordSerieSample) { - chordSerieSample = series[i]; - self.reformOption(chordSerieSample); + if (!this.chordSerieSample) { + this.chordSerieSample = series[i]; + this.reformOption(this.chordSerieSample); } - var _isSelected = isSelected(series[i].name); + var _isSelected = this.isSelected(series[i].name); // Filter by selected serie - self.selectedMap[series[i].name] = _isSelected; + this.selectedMap[series[i].name] = _isSelected; if (!_isSelected) { continue; } - chordSeries.push(series[i]); - self.buildMark( + this.chordSeries.push(series[i]); + this.buildMark( series[i], i, - component + this.component ); matrix.push(series[i].matrix); serieNumber++; } } - if (!chordSerieSample) { + if (!this.chordSerieSample) { return; } - if (!chordSeries.length) { + if (!this.chordSeries.length) { return; } - var zrWidth = zr.getWidth(); - var zrHeight = zr.getHeight(); + var zrWidth = this.zr.getWidth(); + var zrHeight = this.zr.getHeight(); var zrSize = Math.min(zrWidth, zrHeight); - groups = chordSerieSample.data; - startAngle = chordSerieSample.startAngle; + this.groups = this.chordSerieSample.data; + this.startAngle = this.chordSerieSample.startAngle; // Constrain to [0, 360] - startAngle = startAngle % 360; - if (startAngle < 0) { - startAngle = startAngle + 360; + this.startAngle = this.startAngle % 360; + if (this.startAngle < 0) { + this.startAngle = this.startAngle + 360; } - clockWise = chordSerieSample.clockWise; - innerRadius = self.parsePercent( - chordSerieSample.radius[0], + this.clockWise = this.chordSerieSample.clockWise; + this.innerRadius = this.parsePercent( + this.chordSerieSample.radius[0], zrSize / 2 ); - outerRadius = self.parsePercent( - chordSerieSample.radius[1], + this.outerRadius = this.parsePercent( + this.chordSerieSample.radius[1], zrSize / 2 ); - padding = chordSerieSample.padding; - sortGroups = chordSerieSample.sort; - sortSubGroups = chordSerieSample.sortSub; - showScale = chordSerieSample.showScale; - showScaleText = chordSerieSample.showScaleText; - center = [ - self.parsePercent(chordSerieSample.center[0], zrWidth), - self.parsePercent(chordSerieSample.center[1], zrHeight) + this.padding = this.chordSerieSample.padding; + this.sortGroups = this.chordSerieSample.sort; + this.sortSubGroups = this.chordSerieSample.sortSub; + this.showScale = this.chordSerieSample.showScale; + this.showScaleText = this.chordSerieSample.showScaleText; + this.center = [ + this.parsePercent(this.chordSerieSample.center[0], zrWidth), + this.parsePercent(this.chordSerieSample.center[1], zrHeight) ]; var fixSize = - chordSerieSample.itemStyle.normal.chordStyle.lineStyle.width - - chordSerieSample.itemStyle.normal.lineStyle.width; - strokeFix = - (fixSize / _devicePixelRatio) / innerRadius / Math.PI * 180; + this.chordSerieSample.itemStyle.normal.chordStyle.lineStyle.width - + this.chordSerieSample.itemStyle.normal.lineStyle.width; + this.strokeFix = + (fixSize / _devicePixelRatio) / this.innerRadius / Math.PI * 180; - dataMat = new NDArray(matrix); - dataMat = dataMat._transposelike([1, 2, 0]); + this.dataMat = new NDArray(matrix); + this.dataMat = this.dataMat._transposelike([1, 2, 0]); // Filter the data by selected legend - var res = _filterData(dataMat, groups); - dataMat = res[0]; - groups = res[1]; + var res = this._filterData(this.dataMat, this.groups); + this.dataMat = res[0]; + this.groups = res[1]; // Check if data is valid - var shape = dataMat.shape(); - if (shape[0] !== shape[1] || shape[0] !== groups.length) { + var shape = this.dataMat.shape(); + if (shape[0] !== shape[1] || shape[0] !== this.groups.length) { throw new Error('Data not valid'); } if (shape[0] === 0 || shape[2] === 0) { @@ -157,41 +130,41 @@ define(function (require) { // Down to 2 dimension // More convenient for angle calculating and sort - dataMat.reshape(shape[0], shape[1] * shape[2]); + this.dataMat.reshape(shape[0], shape[1] * shape[2]); // Processing data - var sumOut = dataMat.sum(1); + var sumOut = this.dataMat.sum(1); var percents = sumOut.mul(1 / sumOut.sum()); var groupNumber = shape[0]; var subGroupNumber = shape[1] * shape[2]; - var groupAngles = percents.mul(360 - padding * groupNumber); - var subGroupAngles = dataMat.div( - dataMat.sum(1).reshape(groupNumber, 1) + var groupAngles = percents.mul(360 - this.padding * groupNumber); + var subGroupAngles = this.dataMat.div( + this.dataMat.sum(1).reshape(groupNumber, 1) ); subGroupAngles = subGroupAngles.mul( - groupAngles.sub(strokeFix * 2).reshape(groupNumber, 1) + groupAngles.sub(this.strokeFix * 2).reshape(groupNumber, 1) ); - switch (sortGroups) { + switch (this.sortGroups) { case 'ascending': case 'descending': var groupIndices = groupAngles - .argsort(0, sortGroups); - groupAngles['sort'](0, sortGroups); - sumOut['sort'](0, sortGroups); + .argsort(0, this.sortGroups); + groupAngles['sort'](0, this.sortGroups); + sumOut['sort'](0, this.sortGroups); break; default: var groupIndices = NDArray.range(shape[0]); } - switch (sortSubGroups) { + switch (this.sortSubGroups) { case 'ascending': case 'descending': var subGroupIndices = subGroupAngles - .argsort(1, sortSubGroups); - subGroupAngles['sort'](1, sortSubGroups); + .argsort(1, this.sortSubGroups); + subGroupAngles['sort'](1, this.sortSubGroups); break; default: var subGroupIndices = NDArray @@ -221,7 +194,7 @@ define(function (require) { sectorAngles[sortedIdx] = [start, end]; // Sub Group - var subStart = start + strokeFix; + var subStart = start + this.strokeFix; var subEnd = subStart; for (var j = 0; j < subGroupNumber; j++) { subEnd = subStart + subGroupAnglesArr[sortedIdx][j]; @@ -232,40 +205,40 @@ define(function (require) { subStart = subEnd; } - start = end + padding; + start = end + this.padding; } // reset data - chordShapes = new NDArray(groupNumber, groupNumber, serieNumber) + this.chordShapes = new NDArray(groupNumber, groupNumber, serieNumber) .toArray(); - sectorShapes = []; + this.sectorShapes = []; - _buildSectors(sectorAngles, values); + this._buildSectors(sectorAngles, values); chordAngles = new NDArray(chordAngles).reshape( groupNumber, groupNumber, serieNumber, 2 ).toArray(); - _buildChords(chordAngles, dataMat.reshape(shape).toArray()); + this._buildChords(chordAngles, this.dataMat.reshape(shape).toArray()); - var res = normalizeValue(values); - if (showScale) { - _buildScales( + var res = this.normalizeValue(values); + if (this.showScale) { + this._buildScales( res[0], res[1], sectorAngles, - new NDArray(res[0]).sum() / (360 - padding * groupNumber) + new NDArray(res[0]).sum() / (360 - this.padding * groupNumber) ); } - } + }, - function _filterData (dataMat, groups) { + _filterData : function (dataMat, groups) { var indices = []; var groupsFilted = []; // Filter by selected group for (var i = 0; i < groups.length; i++) { var name = groups[i].name; - self.selectedMap[name] = isSelected(name); - if (!self.selectedMap[name]) { + this.selectedMap[name] = this.isSelected(name); + if (!this.selectedMap[name]) { indices.push(i); } else { groupsFilted.push(groups[i]); @@ -298,21 +271,22 @@ define(function (require) { } return [dataMat, groupsFilted2]; - } + }, - function _buildSectors(angles, data) { - var len = groups.length; - var len2 = chordSeries.length; + _buildSectors : function (angles, data) { + var len = this.groups.length; + var len2 = this.chordSeries.length; var timeout; - var showLabel = self.query( - chordSerieSample, 'itemStyle.normal.label.show' + var showLabel = this.query( + this.chordSerieSample, 'itemStyle.normal.label.show' ); - var labelColor = self.query( - chordSerieSample, 'itemStyle.normal.label.color' + var labelColor = this.query( + this.chordSerieSample, 'itemStyle.normal.label.color' ); + var self = this; function createMouseOver(idx) { return function () { if (timeout) { @@ -320,26 +294,26 @@ define(function (require) { } timeout = setTimeout(function (){ for (var i = 0; i < len; i++) { - sectorShapes[i].style.opacity + self.sectorShapes[i].style.opacity = i === idx ? 1 : 0.1; - zr.modShape( - sectorShapes[i].id, - sectorShapes[i] + self.zr.modShape( + self.sectorShapes[i].id, + self.sectorShapes[i] ); for (var j = 0; j < len; j++) { for (var k = 0; k < len2; k++) { - var chordShape = chordShapes[i][j][k]; + var chordShape = self.chordShapes[i][j][k]; if (chordShape) { chordShape.style.opacity = (i === idx || j === idx) ? 0.5 : 0.03; - zr.modShape(chordShape.id, chordShape); + self.zr.modShape(chordShape.id, chordShape); } } } } - zr.refresh(); + self.zr.refresh(); }, 50); }; } @@ -351,64 +325,61 @@ define(function (require) { } timeout = setTimeout(function (){ for (var i = 0; i < len; i++) { - sectorShapes[i].style.opacity = 1.0; - zr.modShape(sectorShapes[i].id, sectorShapes[i]); + self.sectorShapes[i].style.opacity = 1.0; + self.zr.modShape(self.sectorShapes[i].id, self.sectorShapes[i]); for (var j = 0; j < len; j++) { for (var k = 0; k < len2; k++) { - var chordShape = chordShapes[i][j][k]; + var chordShape = self.chordShapes[i][j][k]; if (chordShape) { chordShape.style.opacity = 0.5; - zr.modShape(chordShape.id, chordShape); + self.zr.modShape(chordShape.id, chordShape); } } } } - zr.refresh(); + self.zr.refresh(); }, 50); }; } for (var i = 0; i < len; i++) { - - var group = groups[i]; + var group = this.groups[i]; var angle = angles[i]; - var _start = (clockWise ? (360 - angle[1]) : angle[0]) - + startAngle; - var _end = (clockWise ? (360 - angle[0]) : angle[1]) - + startAngle; + var _start = (this.clockWise ? (360 - angle[1]) : angle[0]) + this.startAngle; + var _end = (this.clockWise ? (360 - angle[0]) : angle[1]) + this.startAngle; var sector = { - zlevel : _zlevelBase, + zlevel : this._zlevelBase, style : { - x : center[0], - y : center[1], - r0 : innerRadius, - r : outerRadius, + x : this.center[0], + y : this.center[1], + r0 : this.innerRadius, + r : this.outerRadius, startAngle : _start, endAngle : _end, brushType : 'fill', opacity: 1, - color : getColor(group.name) + color : this.getColor(group.name) }, highlightStyle : { brushType : 'fill' } }; - sector.style.lineWidth = self.deepQuery( - [group, chordSerieSample], + sector.style.lineWidth = this.deepQuery( + [group, this.chordSerieSample], 'itemStyle.normal.lineStyle.width' ); - sector.highlightStyle.lineWidth = self.deepQuery( - [group, chordSerieSample], + sector.highlightStyle.lineWidth = this.deepQuery( + [group, this.chordSerieSample], 'itemStyle.emphasis.lineStyle.width' ); - sector.style.strokeColor = self.deepQuery( - [group, chordSerieSample], + sector.style.strokeColor = this.deepQuery( + [group, this.chordSerieSample], 'itemStyle.normal.lineStyle.color' ); - sector.highlightStyle.strokeColor = self.deepQuery( - [group, chordSerieSample], + sector.highlightStyle.strokeColor = this.deepQuery( + [group, this.chordSerieSample], 'itemStyle.emphasis.lineStyle.color' ); if (sector.style.lineWidth > 0) { @@ -419,7 +390,7 @@ define(function (require) { } ecData.pack( sector, - chordSeries[0], + this.chordSeries[0], 0, data[i], 0, group.name @@ -432,12 +403,12 @@ define(function (require) { halfAngle = halfAngle * Math.PI / 180; var v = [Math.cos(halfAngle), -Math.sin(halfAngle)]; - var distance = showScaleText ? 45 : 20; - var start = vec2.scale([], v, outerRadius + distance); - vec2.add(start, start, center); + var distance = this.showScaleText ? 45 : 20; + var start = vec2.scale([], v, this.outerRadius + distance); + vec2.add(start, start, this.center); var labelShape = { - zlevel : _zlevelBase - 1, + zlevel : this._zlevelBase - 1, hoverable : false, style : { x : start[0], @@ -447,30 +418,30 @@ define(function (require) { color : labelColor } }; - labelShape.style.textColor = self.deepQuery( - [group, chordSerieSample], + labelShape.style.textColor = this.deepQuery( + [group, this.chordSerieSample], 'itemStyle.normal.label.textStyle.color' ) || '#fff'; - labelShape.style.textFont = self.getFont(self.deepQuery( - [group, chordSerieSample], + labelShape.style.textFont = this.getFont(this.deepQuery( + [group, this.chordSerieSample], 'itemStyle.normal.label.textStyle' )); labelShape = new TextShape(labelShape) - self.shapeList.push(labelShape); - zr.addShape(labelShape); + this.shapeList.push(labelShape); + this.zr.addShape(labelShape); } sector.onmouseover = createMouseOver(i); sector.onmouseout = createMouseOut(); sector = new SectorShape(sector); - self.shapeList.push(sector); - sectorShapes.push(sector); - zr.addShape(sector); + this.shapeList.push(sector); + this.sectorShapes.push(sector); + this.zr.addShape(sector); } - } + }, - function _buildChords(angles, dataArr) { + _buildChords : function (angles, dataArr) { var len = angles.length; if (!len) { return; @@ -478,14 +449,14 @@ define(function (require) { var len2 = angles[0][0].length; var chordLineStyle - = chordSerieSample.itemStyle.normal.chordStyle.lineStyle; + = this.chordSerieSample.itemStyle.normal.chordStyle.lineStyle; var chordLineStyleEmphsis - = chordSerieSample.itemStyle.emphasis.chordStyle.lineStyle; + = this.chordSerieSample.itemStyle.emphasis.chordStyle.lineStyle; for (var i = 0; i < len; i++) { for (var j = 0; j < len; j++) { for (var k = 0; k < len2; k++) { - if (chordShapes[j][i][k]) { + if (this.chordShapes[j][i][k]) { continue; } @@ -497,33 +468,33 @@ define(function (require) { if (angleIJ0 - angleJI1 === 0 || angleJI0 - angleJI1 === 0) { - chordShapes[i][j][k] = null; + this.chordShapes[i][j][k] = null; continue; } var color; if (len2 === 1) { if (angleIJ1 - angleIJ0 <= angleJI1 - angleJI0) { - color = getColor(groups[i].name); + color = this.getColor(this.groups[i].name); } else { - color = getColor(groups[j].name); + color = this.getColor(this.groups[j].name); } } else { - color = getColor(chordSeries[k].name); + color = this.getColor(this.chordSeries[k].name); } - var s0 = !clockWise ? (360 - angleIJ1) : angleIJ0; - var s1 = !clockWise ? (360 - angleIJ0) : angleIJ1; - var t0 = !clockWise ? (360 - angleJI1) : angleJI0; - var t1 = !clockWise ? (360 - angleJI0) : angleJI1; + var s0 = !this.clockWise ? (360 - angleIJ1) : angleIJ0; + var s1 = !this.clockWise ? (360 - angleIJ0) : angleIJ1; + var t0 = !this.clockWise ? (360 - angleJI1) : angleJI0; + var t1 = !this.clockWise ? (360 - angleJI0) : angleJI1; var chord = { - zlevel : _zlevelBase, + zlevel : this._zlevelBase, style : { - center : center, - r : innerRadius, - source0 : s0 - startAngle, - source1 : s1 - startAngle, - target0 : t0 - startAngle, - target1 : t1 - startAngle, + center : this.center, + r : this.innerRadius, + source0 : s0 - this.startAngle, + source1 : s1 - this.startAngle, + target0 : t0 - this.startAngle, + target1 : t1 - this.startAngle, brushType : 'both', opacity : 0.5, color : color, @@ -539,24 +510,24 @@ define(function (require) { ecData.pack( chord, - chordSeries[k], + this.chordSeries[k], k, dataArr[i][j][k], 0, - groups[i].name, - groups[j].name, + this.groups[i].name, + this.groups[j].name, dataArr[j][i][k] ); chord = new ChordShape(chord); - chordShapes[i][j][k] = chord; - self.shapeList.push(chord); - zr.addShape(chord); + this.chordShapes[i][j][k] = chord; + this.shapeList.push(chord); + this.zr.addShape(chord); } } } - } + }, - function _buildScales( + _buildScales : function ( values, unitPostfix, angles, @@ -568,18 +539,18 @@ define(function (require) { var scaleAngle = subStartAngle; while (scaleAngle < subEndAngle) { - var thelta = ((clockWise ? (360 - scaleAngle) : scaleAngle) - + startAngle) / 180 * Math.PI; + var thelta = ((this.clockWise ? (360 - scaleAngle) : scaleAngle) + + this.startAngle) / 180 * Math.PI; var v = [ Math.cos(thelta), -Math.sin(thelta) ]; - var start = vec2.scale([], v, outerRadius + 1); - vec2.add(start, start, center); - var end = vec2.scale([], v, outerRadius + scaleLineLength); - vec2.add(end, end, center); + var start = vec2.scale([], v, this.outerRadius + 1); + vec2.add(start, start, this.center); + var end = vec2.scale([], v, this.outerRadius + this.scaleLineLength); + vec2.add(end, end, this.center); var scaleShape = { - zlevel : _zlevelBase - 1, + zlevel : this._zlevelBase - 1, hoverable : false, style : { xStart : start[0], @@ -593,37 +564,37 @@ define(function (require) { }; scaleShape = new LineShape(scaleShape); - self.shapeList.push(scaleShape); - zr.addShape(scaleShape); + this.shapeList.push(scaleShape); + this.zr.addShape(scaleShape); - scaleAngle += scaleUnitAngle; + scaleAngle += this.scaleUnitAngle; } - if (!showScaleText) { + if (!this.showScaleText) { continue; } var scaleTextAngle = subStartAngle; - var step = unitValue * 5 * scaleUnitAngle; + var step = unitValue * 5 * this.scaleUnitAngle; var scaleValues = NDArray.range(0, values[i], step).toArray(); while (scaleTextAngle < subEndAngle) { - var thelta = clockWise + var thelta = this.clockWise ? (360 - scaleTextAngle) : scaleTextAngle; - thelta = (thelta + startAngle) % 360; + thelta = (thelta + this.startAngle) % 360; var isRightSide = thelta <= 90 || thelta >= 270; var textShape = { - zlevel : _zlevelBase - 1, + zlevel : this._zlevelBase - 1, hoverable : false, style : { x : isRightSide - ? outerRadius + scaleLineLength + 4 - : -outerRadius - scaleLineLength - 4, + ? this.outerRadius + this.scaleLineLength + 4 + : -this.outerRadius - this.scaleLineLength - 4, y : 0, text : Math.round(scaleValues.shift()*10)/10 + unitPostfix, textAlign : isRightSide ? 'left' : 'right' }, - position : center.slice(), + position : this.center.slice(), rotation : isRightSide ? [thelta / 180 * Math.PI, 0, 0] : [ @@ -633,14 +604,14 @@ define(function (require) { }; textShape = new TextShape(textShape); - self.shapeList.push(textShape); - zr.addShape(textShape); - scaleTextAngle += scaleUnitAngle * 5; + this.shapeList.push(textShape); + this.zr.addShape(textShape); + scaleTextAngle += this.scaleUnitAngle * 5; } } - } + }, - function normalizeValue(values) { + normalizeValue : function (values) { var result = []; var max = new NDArray(values).max(); var unitPostfix, unitScale; @@ -662,32 +633,64 @@ define(function (require) { result[i] = values[i] * unitScale; } return [result, unitPostfix]; - } + }, - function init(newOption, newComponent) { - component = newComponent; - refresh(newOption); - } + init : function (newOption, newComponent) { + this.component = newComponent; + + this.refresh(newOption); + }, - function refresh(newOption) { + refresh : function (newOption) { if (newOption) { - option = newOption; - series = option.series; + this.option = newOption; + this.series = newOption.series; } - self.clear(); - legend = component.legend; - if (legend) { - getColor = function(param) { - return legend.getColor(param); + + /* + this.legend; + this.getColor; + this.isSelected; + this.chordSerieSample; + */ + // Config + this.chordSeries = []; + /* + this.groups; + this.startAngle; + this.clockWise; + this.innerRadius; + this.outerRadius; + this.padding; + this.sortGroups; + this.sortSubGroups; + this.center; + this.showScale; + this.showScaleText; + this.dataMat; + */ + this.strokeFix = 0; + // Adjacency matrix + this.sectorShapes = []; + this.chordShapes = []; + + this.scaleLineLength = 4; + this.scaleUnitAngle = 4; + + this.clear(); + this.legend = this.component.legend; + if (this.legend) { + this.getColor = function(param) { + return this.legend.getColor(param); }; - isSelected = function(param) { - return legend.isSelected(param); + this.isSelected = function(param) { + return this.legend.isSelected(param); }; } else { var colorIndices = {}; var colorMap = {}; var count = 0; - getColor = function (key) { + this.getColor = function (key) { if (colorMap[key]) { return colorMap[key]; } @@ -695,22 +698,22 @@ define(function (require) { colorIndices[key] = count++; } // key is serie name - for (var i = 0; i < chordSeries.length; i++) { - if (chordSeries[i].name === key) { - colorMap[key] = self.query( - chordSeries[i], + for (var i = 0; i < this.chordSeries.length; i++) { + if (this.chordSeries[i].name === key) { + colorMap[key] = this.query( + this.chordSeries[i], 'itemStyle.normal.color' ); break; } } if (!colorMap[key]) { - var len = groups.length; + var len = this.groups.length; // key is group name for (var i = 0; i < len; i++) { - if (groups[i].name === key) { - colorMap[key] = self.query( - groups[i], + if (this.groups[i].name === key) { + colorMap[key] = this.query( + this.groups[i], 'itemStyle.normal.color' ); break; @@ -718,36 +721,30 @@ define(function (require) { } } if (!colorMap[key]) { - colorMap[key] = zr.getColor(colorIndices[key]); + colorMap[key] = this.zr.getColor(colorIndices[key]); } return colorMap[key]; }; - isSelected = function () { + this.isSelected = function () { return true; }; } - _buildShape(); - } + this._buildShape(); + }, - function reformOption(opt) { + reformOption : function (opt) { var _merge = zrUtil.merge; opt = _merge( opt || {}, - ecConfig.chord + this.ecTheme.chord ); opt.itemStyle.normal.label.textStyle = _merge( opt.itemStyle.normal.label.textStyle || {}, - ecConfig.textStyle + this.ecTheme.textStyle ); } - - self.init = init; - self.refresh = refresh; - self.reformOption = reformOption; - - init(option, component); - } + }; zrUtil.inherits(Chord, CalculableBase); zrUtil.inherits(Chord, ComponentBase); -- GitLab