100pah 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_r339562545
##########
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:
@pissang I used to consider this way. But this way make
`data.indexOfName(name)` execute twice if both retrieve `color` and
`borderColor`. `data.indexOfName(name)` cost `O(log(n))`. Is it OK. Or may be
cache can be used inside `data.indexOfName(name)` if performance needs to take
into account.
----------------------------------------------------------------
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]