Vvvickie commented on a change in pull request #9171: fix #8009 & #5969, symbol 
symbolSize and opacity setting for category itemStyle in graph
URL: https://github.com/apache/incubator-echarts/pull/9171#discussion_r229864673
 
 

 ##########
 File path: src/chart/graph/categoryVisual.js
 ##########
 @@ -31,30 +31,53 @@ 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 opacity = itemModel.get('itemStyle.opacity') || 1;
+            categoriesData.setItemVisual(idx, 'opacity', opacity);
+
+            var symbolStyleList = ['symbolSize', 'symbolKeepAspect'];
+            for (var i = 0; i < symbolStyleList.length; i++) {
+                var symbolStyleItem = itemModel.getShallow(symbolStyleList[i], 
true);
+                if (symbolStyleItem != null) {
+                    categoriesData.setItemVisual(idx, symbolStyleList[i], 
symbolStyleItem);
+                }
+            }
+
         });
 
         // Assign category color to visual
         if (categoriesData.count()) {
             data.each(function (idx) {
+                var itemModel = categoriesData.getItemModel(idx);
+                var symbol = itemModel.getShallow('symbol', true);
+                if (symbol) {
+                    data.setItemVisual(idx, 'symbol', symbol);
+                }
+
                 var model = data.getItemModel(idx);
                 var category = model.getShallow('category');
                 if (category != null) {
                     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', 'symbolSize', 
'symbolKeepAspect'];
+
+                    for (var i = 0; i < itemStyleList.length; i++) {
+                        if (!data.getItemVisual(idx, itemStyleList[i], true)) {
+                            data.setItemVisual(
+                                idx, itemStyleList[i],
+                                categoriesData.getItemVisual(category, 
itemStyleList[i])
+                            );
+                        }
                     }
 
 Review comment:
   Ummm, I am confused about this. Where is color retrieved? 
   The opacity and symbolSize also work currently...What's wrong? O.O

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to