You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2019/08/19 05:20:45 UTC

[incubator-echarts] branch release updated (3567c14 -> 020e4e0)

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a change to branch release
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.


    from 3567c14  Support click and tooltip in bar large mode. Fix #10699
     new 952b196  tweak the hover style save logic.
     new ca0ed02  Enhance the approach of interpretation of textPosition 'inside' for some custom shape like 'pin'.
     new 020e4e0  rename from "interpret" to "calculate"

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/util/graphic.js  | 94 +++++++++++++++++++++++++---------------------------
 src/util/symbol.js   | 17 +++++-----
 test/hoverStyle.html | 58 ++++++++++++++++++++++++++++++++
 test/tree-basic.html | 25 +++++++-------
 4 files changed, 125 insertions(+), 69 deletions(-)


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


[incubator-echarts] 03/03: rename from "interpret" to "calculate"

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch release
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 020e4e0505a5247580bc8b59428107de0a3a57c4
Author: sushuang <su...@gmail.com>
AuthorDate: Fri Aug 16 15:26:08 2019 +0800

    rename from "interpret" to "calculate"
---
 src/util/symbol.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/util/symbol.js b/src/util/symbol.js
index 7d0c8e0..135d893 100644
--- a/src/util/symbol.js
+++ b/src/util/symbol.js
@@ -22,7 +22,7 @@
 import * as zrUtil from 'zrender/src/core/util';
 import * as graphic from './graphic';
 import BoundingRect from 'zrender/src/core/BoundingRect';
-import {interpretTextPosition} from 'zrender/src/contain/text';
+import {calculateTextPosition} from 'zrender/src/contain/text';
 
 /**
  * Triangle shape
@@ -270,8 +270,8 @@ var SymbolClz = graphic.extendShape({
         height: 0
     },
 
-    interpretTextPosition(out, style, rect) {
-        var res = interpretTextPosition(out, style, rect);
+    calculateTextPosition(out, style, rect) {
+        var res = calculateTextPosition(out, style, rect);
         var shape = this.shape;
         if (shape && shape.symbolType === 'pin' && style.textPosition === 'inside') {
             res.y = rect.y + rect.height * 0.4;


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


[incubator-echarts] 01/03: tweak the hover style save logic.

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch release
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 952b196cfc7ef07941b3eb15af9f6704ea64a4d2
Author: sushuang <su...@gmail.com>
AuthorDate: Thu Aug 15 16:45:31 2019 +0800

    tweak the hover style save logic.
---
 src/util/graphic.js  | 94 +++++++++++++++++++++++++---------------------------
 test/tree-basic.html | 25 +++++++-------
 2 files changed, 59 insertions(+), 60 deletions(-)

diff --git a/src/util/graphic.js b/src/util/graphic.js
index 8795440..9552e2f 100644
--- a/src/util/graphic.js
+++ b/src/util/graphic.js
@@ -51,6 +51,13 @@ var EMPTY_OBJ = {};
 
 export var Z2_EMPHASIS_LIFT = 1;
 
+// key: label model property nane, value: style property name.
+export var CACHED_LABEL_STYLE_PROPERTIES = {
+    color: 'textFill',
+    textBorderColor: 'textStroke',
+    textBorderWidth: 'textStrokeWidth'
+};
+
 var EMPHASIS = 'emphasis';
 var NORMAL = 'normal';
 
@@ -921,13 +928,6 @@ function getAutoColor(color, opt) {
     return color !== 'auto' ? color : (opt && opt.autoColor) ? opt.autoColor : null;
 }
 
-// key: label model property nane, value: style property name.
-export var CACHED_LABEL_STYLE_PROPERTIES = {
-    color: 'textFill',
-    textBorderColor: 'textStroke',
-    textBorderWidth: 'textStrokeWidth'
-};
-
 /**
  * Give some default value to the input `textStyle` object, based on the current settings
  * in this `textStyle` object.
@@ -946,52 +946,49 @@ export var CACHED_LABEL_STYLE_PROPERTIES = {
  * does, `rollbackDefaultTextStyle` is not needed to be called).
  */
 function applyDefaultTextStyle(textStyle) {
-    var opt = textStyle.insideRollbackOpt;
-
-    // Only `insideRollbackOpt` created (in `setTextStyleCommon`),
-    // applyDefaultTextStyle works.
-    if (!opt || textStyle.textFill != null) {
-        return;
-    }
-
-    var useInsideStyle = opt.useInsideStyle;
     var textPosition = textStyle.textPosition;
+    var opt = textStyle.insideRollbackOpt;
     var insideRollback;
-    var autoColor = opt.autoColor;
-
-    if (useInsideStyle !== false
-        && (useInsideStyle === true
-            || (opt.isRectText
-                && textPosition
-                // textPosition can be [10, 30]
-                && typeof textPosition === 'string'
-                && textPosition.indexOf('inside') >= 0
-            )
-        )
-    ) {
-        // If intend to cache more properties here, modify the
-        // `CACHED_LABEL_STYLE_PROPERTIES`.
-        insideRollback = {
-            textFill: null,
-            textStroke: textStyle.textStroke,
-            textStrokeWidth: textStyle.textStrokeWidth
-        };
-        textStyle.textFill = '#fff';
-        // Consider text with #fff overflow its container.
-        if (textStyle.textStroke == null) {
-            textStyle.textStroke = autoColor;
-            textStyle.textStrokeWidth == null && (textStyle.textStrokeWidth = 2);
+
+    if (opt) {
+        var autoColor = opt.autoColor;
+        var isRectText = opt.isRectText;
+        var useInsideStyle = opt.useInsideStyle;
+
+        var useInsideStyleCache = useInsideStyle !== false
+            && (useInsideStyle === true
+                || (isRectText
+                    && textPosition
+                    // textPosition can be [10, 30]
+                    && typeof textPosition === 'string'
+                    && textPosition.indexOf('inside') >= 0
+                )
+            );
+        var useAutoColorCache = !useInsideStyleCache && autoColor != null;
+
+        // All of the props declared in `CACHED_LABEL_STYLE_PROPERTIES` are to be cached.
+        if (useInsideStyleCache || useAutoColorCache) {
+            insideRollback = {
+                textFill: textStyle.textFill,
+                textStroke: textStyle.textStroke,
+                textStrokeWidth: textStyle.textStrokeWidth
+            };
+        }
+        if (useInsideStyleCache) {
+            textStyle.textFill = '#fff';
+            // Consider text with #fff overflow its container.
+            if (textStyle.textStroke == null) {
+                textStyle.textStroke = autoColor;
+                textStyle.textStrokeWidth == null && (textStyle.textStrokeWidth = 2);
+            }
+        }
+        if (useAutoColorCache) {
+            textStyle.textFill = autoColor;
         }
-    }
-    else if (autoColor != null) {
-        insideRollback = {textFill: null};
-        textStyle.textFill = autoColor;
     }
 
-    // Always set `insideRollback`, for clearing previous.
-    if (insideRollback) {
-        textStyle.insideRollback = insideRollback;
-    }
+    // Always set `insideRollback`, so that the previous one can be cleared.
+    textStyle.insideRollback = insideRollback;
 }
 
 /**
@@ -1007,6 +1004,7 @@ function applyDefaultTextStyle(textStyle) {
 function rollbackDefaultTextStyle(style) {
     var insideRollback = style.insideRollback;
     if (insideRollback) {
+        // Reset all of the props in `CACHED_LABEL_STYLE_PROPERTIES`.
         style.textFill = insideRollback.textFill;
         style.textStroke = insideRollback.textStroke;
         style.textStrokeWidth = insideRollback.textStrokeWidth;
diff --git a/test/tree-basic.html b/test/tree-basic.html
index 63e47c3..06cf6ee 100644
--- a/test/tree-basic.html
+++ b/test/tree-basic.html
@@ -68,7 +68,8 @@ under the License.
                                 {
                                     type: 'tree',
                                     id: '3',
-                                    
+                                    roam: true,
+
                                     data: [data],
 
                                     top: '1%',
@@ -101,17 +102,17 @@ under the License.
                             ]
                         });
 
-                        setTimeout(function() {
-                            var newData = echarts.util.clone(data);
-                            newData.children.splice(0, 1);
-                            chart.setOption({
-                                series: [{
-                                    type: 'tree',
-                                    id: '3',
-                                    data: [newData]
-                                }]
-                            }, false);
-                        }, 1000);
+                        // setTimeout(function() {
+                        //     var newData = echarts.util.clone(data);
+                        //     newData.children.splice(0, 1);
+                        //     chart.setOption({
+                        //         series: [{
+                        //             type: 'tree',
+                        //             id: '3',
+                        //             data: [newData]
+                        //         }]
+                        //     }, false);
+                        // }, 1000);
 
                     });
                 });


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


[incubator-echarts] 02/03: Enhance the approach of interpretation of textPosition 'inside' for some custom shape like 'pin'.

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch release
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit ca0ed029803a086de5af31c3fb1812b3f94acaf6
Author: sushuang <su...@gmail.com>
AuthorDate: Thu Aug 15 16:46:18 2019 +0800

    Enhance the approach of interpretation of textPosition 'inside' for some custom shape like 'pin'.
---
 src/util/symbol.js   | 17 ++++++++-------
 test/hoverStyle.html | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/src/util/symbol.js b/src/util/symbol.js
index 0df28c2..7d0c8e0 100644
--- a/src/util/symbol.js
+++ b/src/util/symbol.js
@@ -22,6 +22,7 @@
 import * as zrUtil from 'zrender/src/core/util';
 import * as graphic from './graphic';
 import BoundingRect from 'zrender/src/core/BoundingRect';
+import {interpretTextPosition} from 'zrender/src/contain/text';
 
 /**
  * Triangle shape
@@ -269,21 +270,19 @@ var SymbolClz = graphic.extendShape({
         height: 0
     },
 
-    beforeBrush: function () {
-        var style = this.style;
+    interpretTextPosition(out, style, rect) {
+        var res = interpretTextPosition(out, style, rect);
         var shape = this.shape;
-        // FIXME
-        if (shape.symbolType === 'pin' && style.textPosition === 'inside') {
-            style.textPosition = ['50%', '40%'];
-            style.textAlign = 'center';
-            style.textVerticalAlign = 'middle';
+        if (shape && shape.symbolType === 'pin' && style.textPosition === 'inside') {
+            res.y = rect.y + rect.height * 0.4;
         }
+        return res;
     },
 
     buildPath: function (ctx, shape, inBundle) {
         var symbolType = shape.symbolType;
-        var proxySymbol = symbolBuildProxies[symbolType];
-        if (shape.symbolType !== 'none') {
+        if (symbolType !== 'none') {
+            var proxySymbol = symbolBuildProxies[symbolType];
             if (!proxySymbol) {
                 // Default rect
                 symbolType = 'rect';
diff --git a/test/hoverStyle.html b/test/hoverStyle.html
index 807aa40..366e94c 100644
--- a/test/hoverStyle.html
+++ b/test/hoverStyle.html
@@ -54,6 +54,7 @@ under the License.
 
         <div id="info"></div>
 
+        <div id="maina1"></div>
         <div id="mainb1"></div>
         <div id="mainb2"></div>
         <div id="mainb3"></div>
@@ -151,6 +152,57 @@ under the License.
 
 
 
+        <script>
+
+
+            var option;
+
+            require([
+                'echarts'
+            ], function (echarts) {
+
+                var option = {
+                    hoverLayerThreshold: hoverLayerThreshold,
+                    xAxis: {
+                        axisLine: {show: false},
+                        axisTick: {show: false},
+                        splitLine: {show: false},
+                        axisLabel: {show: false}
+                    },
+                    yAxis: {
+                        axisLine: {show: false},
+                        axisTick: {show: false},
+                        splitLine: {show: false},
+                        axisLabel: {show: false}
+                    },
+                    series: {
+                        type: 'line',
+                        markPoint: {
+                            data: [{
+                                type: 'max',
+                                name: 'a'
+                            }]
+                        },
+                        data: [[12,34]]
+                    }
+                };
+
+                var chart = testHelper.create(echarts, 'maina1', {
+                    option: option,
+                    height: 150,
+                    title: [
+                        'Only a pin displayed',
+                        'The text of the "pin" should be **inside**',
+                        'Hover "pin", should be normal'
+                    ]
+                });
+            });
+        </script>
+
+
+
+
+
 
         <script>
             require(['echarts'], function (echarts) {
@@ -968,5 +1020,11 @@ under the License.
 
 
 
+
+
+
+
+
+
     </body>
 </html>
\ No newline at end of file


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