You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2020/11/10 08:13:02 UTC

[incubator-echarts] branch feat-decal created (now 6c304cd)

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

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


      at 6c304cd  fix(decal): keepAspectRatio was not working

This branch includes the following new commits:

     new 6c304cd  fix(decal): keepAspectRatio was not working

The 1 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.



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


[incubator-echarts] 01/01: fix(decal): keepAspectRatio was not working

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

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

commit 6c304cda418bcb1af915d068dcec12d6587a5cd0
Author: Ovilia <zw...@gmail.com>
AuthorDate: Tue Nov 10 16:12:14 2020 +0800

    fix(decal): keepAspectRatio was not working
---
 src/util/decal.ts |  5 ++--
 test/decal.html   | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 87 insertions(+), 4 deletions(-)

diff --git a/src/util/decal.ts b/src/util/decal.ts
index 44091b7..5d2d971 100644
--- a/src/util/decal.ts
+++ b/src/util/decal.ts
@@ -260,9 +260,10 @@ export function createOrUpdatePatternFromDecal(
                     x * scale,
                     y * scale,
                     width * scale,
-                    height * scale
+                    height * scale,
+                    decalOpt.color,
+                    decalOpt.symbolKeepAspect
                 );
-                symbol.style.fill = decalOpt.color;
                 if (isSVG) {
                     svgRoot.appendChild((zr.painter as SVGPainter).paintOne(symbol));
                 }
diff --git a/test/decal.html b/test/decal.html
index 0c7ab5b..290b8a5 100644
--- a/test/decal.html
+++ b/test/decal.html
@@ -111,6 +111,8 @@ under the License.
         <div id="main-treemap"></div>
         <div id="main-custom-series"></div>
 
+        <div id="main-fruit"></div>
+
 
 
         <script>
@@ -135,14 +137,18 @@ under the License.
                 }
                 else if (i === 1) {
                     s.itemStyle = {
-                        decal: 'none'
+                        decal: {
+                            symbol: 'none'
+                        }
                     };
                 }
                 else if (i === 2) {
                     s.data = [{
                         value: s.data[0],
                         itemStyle: {
-                            decal: 'none'
+                            decal: {
+                                symbol: 'none'
+                            }
                         }
                     }];
                 }
@@ -838,6 +844,82 @@ under the License.
 
 
 
+
+        <script>
+        require(['echarts'/*, 'map/js/china' */], function (echarts) {
+
+            var d = 30;
+            var path = [
+                'M12.815,443.027 C28.577,427.267 54.221,427.267 69.981,443.027 C85.736,458.781 85.735,484.423 69.983,500.182 C54.221,515.938 28.574,515.938 12.817,500.187 C-2.939,484.424 -2.94,458.782 12.815,443.027 Z M98.66,335.96 C114.421,351.721 114.421,377.366 98.659,393.127 C82.905,408.881 57.263,408.88 41.505,393.129 C25.75,377.366 25.75,351.719 41.501,335.962 C57.264,320.206 82.905,320.205 98.66,335.96 Z M119.871,414.332 C135.633,398.575 161.275,398.575 177.029,414.33 C192.79,430. [...]
+                'M251.78,126.4 C248.1,100.164 235.969,75.729 217.101,56.862 L210.997,50.758 C230.887,20.228 265.323,-1.42108547e-14 304.4,-1.42108547e-14 L384.733,-1.42108547e-14 C393.017,-1.42108547e-14 399.733,6.716 399.733,15 C399.733,76.426 349.76,126.4 288.333,126.4 L251.78,126.4 Z M174.675,99.289 L149.194,73.806 C143.336,67.948 143.336,58.451 149.194,52.593 C155.052,46.736 164.55,46.736 170.407,52.593 L195.888,78.075 C211.81,93.997 221.19,114.703 222.744,136.95 C217.759,138.31 212. [...]
+                'M267.157,227.326 C210.111,269.798 144.193,291.333 71.233,291.334 C49.528,291.334 31.362,306.781 27.153,327.26 C11.883,313.249 -1.13686838e-13,292.601 -1.13686838e-13,264.05 L-1.13686838e-13,256 C-1.13686838e-13,247.716 6.716,241 15,241 L97.486,241 C169.209,241 245.378,223.348 315.718,183.492 C302.506,197.829 286.38,213.014 267.157,227.326 Z M143.533,371.667 C118.72,371.667 98.533,391.854 98.532,416.667 C98.532,417.525 98.548,418.379 98.565,419.232 C73.198,403.981 56.233, [...]
+            ]
+            var option = {
+                series: [{
+                    type: 'pie',
+                    data: [{
+                        value: 100,
+                        name: 'Grapes'
+                    }, {
+                        value: 80,
+                        name: 'Apples'
+                    }, {
+                        value: 70,
+                        name: 'Bananas'
+                    }],
+                    label: {
+                        fontSize: 16
+                    },
+                    labelLine: {
+                        lineStyle: {
+                            width: 2
+                        }
+                    }
+                }],
+
+                aria: {
+                    decal: {
+                        show: true,
+                        decals: [{
+                            dashArrayX: [[d, d], [0, d, d, 0]],
+                            dashArrayY: [d, 0],
+                            symbol: 'path://' + path[0],
+                            symbolKeepAspect: true,
+                            symbolSize: 0.8
+                        }, {
+                            dashArrayX: [[d, d], [0, d, d, 0]],
+                            dashArrayY: [d, 0],
+                            symbol: 'path://' + path[1],
+                            symbolKeepAspect: true,
+                            symbolSize: 0.8
+                        }, {
+                            dashArrayX: [[d, d], [0, d, d, 0]],
+                            dashArrayY: [d, 0],
+                            symbol: 'path://' + path[2],
+                            symbolKeepAspect: true,
+                            symbolSize: 0.8
+                        }]
+                    }
+                },
+
+                color: ['#7862A5', '#DD5353', '#FDD344'],
+
+            };
+
+            var chart = testHelper.create(echarts, 'main-fruit', {
+                title: [
+                    'Symbols should keep aspect ratio'
+                ],
+                option: option
+                // height: 300,
+                // buttons: [{text: 'btn-txt', onclick: function () {}}],
+                // recordCanvas: true,
+            });
+        });
+        </script>
+
+
+
     </body>
 </html>
 


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