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 2020/06/24 00:28:53 UTC

[GitHub] [incubator-echarts] susiwen8 commented on a change in pull request #12550: feat(dataZoom): custom brush style in toolbox.feature.dataZoom

susiwen8 commented on a change in pull request #12550:
URL: https://github.com/apache/incubator-echarts/pull/12550#discussion_r444579008



##########
File path: src/component/toolbox/feature/DataZoom.js
##########
@@ -236,16 +240,30 @@ function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) {
             zoomActive
             ? {
                 brushType: 'auto',
-                brushStyle: {
-                    // FIXME user customized?
-                    lineWidth: 0,
-                    fill: 'rgba(0,0,0,0.2)'
-                }
+                brushStyle: mapBrushStyle(featureModel.option.brushStyle)
             }
             : false
         );
 }
 
+function mapBrushStyle(brushStyle) {
+    var properties = [
+        ['fill', 'color'],
+        ['lineWidth', 'borderWidth'],
+        ['stroke', 'borderColor'],
+        ['opacity', 'opacity']
+    ];
+    var style = {};
+    for (var i = 0; i < properties.length; i++) {
+        var propName = properties[i][1];
+        var val = brushStyle[propName];
+        if (val != null) {
+            style[properties[i][0]] = val;
+        }
+    }
+    return style;

Review comment:
       @chfw ECharts do not allow ES6 and ES5 syntax.

##########
File path: src/component/toolbox/feature/DataZoom.js
##########
@@ -236,16 +240,30 @@ function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) {
             zoomActive
             ? {
                 brushType: 'auto',
-                brushStyle: {
-                    // FIXME user customized?
-                    lineWidth: 0,
-                    fill: 'rgba(0,0,0,0.2)'
-                }
+                brushStyle: mapBrushStyle(featureModel.option.brushStyle)
             }
             : false
         );
 }
 
+function mapBrushStyle(brushStyle) {
+    var properties = [
+        ['fill', 'color'],
+        ['lineWidth', 'borderWidth'],
+        ['stroke', 'borderColor'],
+        ['opacity', 'opacity']
+    ];
+    var style = {};
+    for (var i = 0; i < properties.length; i++) {
+        var propName = properties[i][1];
+        var val = brushStyle[propName];
+        if (val != null) {
+            style[properties[i][0]] = val;
+        }
+    }
+    return style;

Review comment:
       @chfw ECharts do not allow ES6 and ES5 syntax.
   https://echarts.apache.org/zh/coding-standard.html#compatibility




----------------------------------------------------------------
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



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