You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2019/10/28 07:52:58 UTC

[GitHub] [incubator-echarts] pissang commented on a change in pull request #11485: Fix #10910

pissang commented on a change in pull request #11485: Fix #10910
URL: https://github.com/apache/incubator-echarts/pull/11485#discussion_r339430717
 
 

 ##########
 File path: src/chart/line/LineView.js
 ##########
 @@ -453,6 +453,12 @@ export default ChartView.extend({
         }
 
         var visualColor = getVisualGradient(data, coordSys) || data.getVisual('color');
+        if (typeof visualColor === 'function') {
+            var color = visualColor;
+            data.each(function (idx) {
+                visualColor = color(seriesModel.getDataParams(idx));
+            });
 
 Review comment:
   We don't have to iterate all the data to get a color here.
   
   I think there are two solutions: 
   
   + use the first or last data for this callback and get one color value.
   + Or pick some of the data and get a gradient color.
   
   From my perspective, gradient color is better, but the main concern is SVG or Canvas may have an issue with too many color stops on the gradient. About this, perhaps we can pick at most 10 of the data to get the gradient.
   
   BTW: Personally I prefer using `colorCallback` over `color` on the variable name because it's more specific.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org