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 2022/01/07 07:00:21 UTC

[echarts] branch fix-16064 created (now 72f4c41)

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

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


      at 72f4c41  fix(visual): fix legend modify alpha on transparent color

This branch includes the following new commits:

     new 72f4c41  fix(visual): fix legend modify alpha on transparent color

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


[echarts] 01/01: fix(visual): fix legend modify alpha on transparent color

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

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

commit 72f4c419ae59e738740987b0d6affde96bca7f4b
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Jan 7 14:57:08 2022 +0800

    fix(visual): fix legend modify alpha on transparent color
---
 src/component/legend/LegendView.ts |   7 ++-
 test/pie-case.html                 | 106 +++++++++++++++++++++++++++++++++++++
 2 files changed, 109 insertions(+), 4 deletions(-)

diff --git a/src/component/legend/LegendView.ts b/src/component/legend/LegendView.ts
index 67e0145..69df982 100644
--- a/src/component/legend/LegendView.ts
+++ b/src/component/legend/LegendView.ts
@@ -46,8 +46,7 @@ import {
     SymbolOptionMixin
 } from '../../util/types';
 import Model from '../../model/Model';
-import {LineStyleProps, LINE_STYLE_KEY_MAP} from '../../model/mixin/lineStyle';
-import {ITEM_STYLE_KEY_MAP} from '../../model/mixin/itemStyle';
+import {LineStyleProps} from '../../model/mixin/lineStyle';
 import {createSymbol, ECSymbol} from '../../util/symbol';
 import SeriesModel from '../../model/Series';
 
@@ -244,7 +243,7 @@ class LegendView extends ComponentView {
 
                         const idx = provider.indexOfName(name);
 
-                        const style = provider.getItemVisual(idx, 'style') as PathStyleProps;
+                        let style = provider.getItemVisual(idx, 'style') as PathStyleProps;
                         const legendIcon = provider.getItemVisual(idx, 'legendIcon');
 
                         const colorArr = parse(style.fill as ColorString);
@@ -253,7 +252,7 @@ class LegendView extends ComponentView {
                         if (colorArr && colorArr[3] === 0) {
                             colorArr[3] = 0.2;
                             // TODO color is set to 0, 0, 0, 0. Should show correct RGBA
-                            style.fill = stringify(colorArr, 'rgba');
+                            style = zrUtil.extend(zrUtil.extend({}, style), { fill: stringify(colorArr, 'rgba') });
                         }
 
                         const itemGroup = this._createItem(
diff --git a/test/pie-case.html b/test/pie-case.html
new file mode 100644
index 0000000..045178c
--- /dev/null
+++ b/test/pie-case.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+<html>
+    <head>
+        <meta charset="utf-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1" />
+        <script src="lib/simpleRequire.js"></script>
+        <script src="lib/config.js"></script>
+        <script src="lib/jquery.min.js"></script>
+        <script src="lib/facePrint.js"></script>
+        <script src="lib/testHelper.js"></script>
+        <!-- <script src="ut/lib/canteen.js"></script> -->
+        <link rel="stylesheet" href="lib/reset.css" />
+    </head>
+    <body>
+        <style>
+        </style>
+
+
+
+        <div id="main0"></div>
+
+
+
+
+
+
+        <script>
+        require([
+            'echarts',
+            // 'map/js/china',
+            // './data/nutrients.json'
+        ], function (echarts) {
+            var option;
+
+            option = {
+                title: {
+                    text: 'Referer of a Website',
+                    subtext: 'Fake Data',
+                    left: 'center'
+                },
+                tooltip: {
+                    trigger: 'item'
+                },
+                legend: {
+                    orient: 'vertical',
+                    left: 'left'
+                },
+                series: [
+                    {
+                        name: 'Access From',
+                        type: 'pie',
+                        radius: '50%',
+                        data: [
+                            {
+                                value: 1048, name: 'Search Engine'
+                            },
+                            {
+                                value: 300, name: 'Direct'
+                            },
+                            {
+                                value: 1348,
+                                name: 'Placeholder',
+                                itemStyle: {
+                                    color: 'rgba(135,206,250,0)'
+                                }
+                            }
+                        ]
+                    }
+                ]
+            };
+
+
+            var chart = testHelper.create(echarts, 'main0', {
+                title: [
+                    'Placeholder with color(with alpha 0) should be totally hidden',
+                    'From https://github.com/apache/echarts/issues/16064'
+                ],
+                option: option
+            });
+        });
+        </script>
+
+
+    </body>
+</html>
+

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