Skip to content

Commit

Permalink
Merge pull request #9171 from Vvvickie/master
Browse files Browse the repository at this point in the history
fix #8009 & #5969, symbol symbolSize and opacity setting for category itemStyle in graph
  • Loading branch information
100pah authored Nov 4, 2018
2 parents 5a3a3d2 + 2c2d8ef commit 93f5aac
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/chart/graph/categoryVisual.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@ export default function (ecModel) {
var name = categoriesData.getName(idx);
// Add prefix to avoid conflict with Object.prototype.
categoryNameIdxMap['ec-' + name] = idx;

var itemModel = categoriesData.getItemModel(idx);

var color = itemModel.get('itemStyle.color')
|| seriesModel.getColorFromPalette(name, paletteScope);
categoriesData.setItemVisual(idx, 'color', color);

var itemStyleList = ['opacity', 'symbol', 'symbolSize', 'symbolKeepAspect'];
for (var i = 0; i < itemStyleList.length; i++) {
var itemStyle = itemModel.getShallow(itemStyleList[i], true);
if (itemStyle != null) {
categoriesData.setItemVisual(idx, itemStyleList[i], itemStyle);
}
}
});

// Assign category color to visual
Expand All @@ -47,14 +55,19 @@ export default function (ecModel) {
if (typeof category === 'string') {
category = categoryNameIdxMap['ec-' + category];
}
if (!data.getItemVisual(idx, 'color', true)) {
data.setItemVisual(
idx, 'color',
categoriesData.getItemVisual(category, 'color')
);

var itemStyleList = ['color', 'opacity', 'symbol', 'symbolSize', 'symbolKeepAspect'];

for (var i = 0; i < itemStyleList.length; i++) {
if (data.getItemVisual(idx, itemStyleList[i], true) == null) {
data.setItemVisual(
idx, itemStyleList[i],
categoriesData.getItemVisual(category, itemStyleList[i])
);
}
}
}
});
}
});
}
}

0 comments on commit 93f5aac

Please sign in to comment.