pissang commented on a change in pull request #10766: pie/funnel legend can use 
visualMap color.
URL: 
https://github.com/apache/incubator-echarts/pull/10766#discussion_r339565977
 
 

 ##########
 File path: src/component/legend/LegendView.js
 ##########
 @@ -191,10 +191,15 @@ export default echarts.extendComponentView({
                     }
 
                     if (seriesModel.legendDataProvider) {
-                        var data = seriesModel.legendDataProvider();
+                        // pie/funnel legend can use visualMap color.
+                                               var data = 
seriesModel.getData();
                         var idx = data.indexOfName(name);
                         if (idx < 0) {
-                            return;
+                                                       var rawData = 
seriesModel.legendDataProvider();
+                            idx = rawData.indexOfName(name);
+                            if (idx < 0) {
+                                return;
+                            }
                         }
 
 Review comment:
   I think this extra performance cost is acceptable in the `legend` scene. 
Which data amount is usually small.
   
   Or we can provide more API to cache the index outside. Like
   ```js
   var index = provider.indexOfName(name);
   var color = provider.getVisual(index, 'color');
   var borderColor = provider.getVisual(index, 'borderColor'); 
   ```
   But this will also add more conventions between `legend` and `series`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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