Skip to content

Commit

Permalink
chord : 没有legend情况下data和serie中itemStyle的获取
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Nov 5, 2013
1 parent 4d81aba commit 9d20a64
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions src/chart/chord.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,44 @@ define(function(require) {
getColor = legend.getColor;
isSelected = legend.isSelected;
} else {
var colorIndices = {};
var colorMap = {};
var count = 0;
getColor = function(name) {
if (colorMap[name] === undefined) {
colorMap[name] = count++;
getColor = function(key) {
if (colorMap[key]) {
return colorMap[key];
}
return zr.getColor(colorMap[name]);
if (colorIndices[key] === undefined) {
colorIndices[key] = count++;
}
// key is serie name
for (var i = 0; i < chordSeries.length; i++) {
if (chordSeries[i].name === key) {
colorMap[key] = self.deepQuery(
[chordSeries[i]],
'itemStyle.normal.color'
);
break;
}
}
if (!colorMap[key]) {
var len = groups.length;
// key is group name
for (var i = 0; i < len; i++) {
if (groups[i].name === key) {
colorMap[key] = self.deepQuery(
[groups[i]],
'itemStyle.normal.color'
);
break;
}
}
}
if (!colorMap[key]) {
colorMap[key] = zr.getColor(colorIndices[key]);
}

return colorMap[key];
};
isSelected = function() {
return true;
Expand Down

0 comments on commit 9d20a64

Please sign in to comment.