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 2022/01/13 10:27:19 UTC
[GitHub] [echarts] sz-p opened a new issue #16367: [Bug] treemap borderColor 显示为 backgroundColor
sz-p opened a new issue #16367:
URL: https://github.com/apache/echarts/issues/16367
### Version
5.2.2
### Link to Minimal Reproduction
https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
### Steps to Reproduce
https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
### Current Behavior
颜色表现不正确。如示例所示,期望的颜色为 `color`配置项( `rgba(255,0, 0, 0.5)`) 实际表现为,`color` 与 `borderColor`的叠加
### Expected Behavior
颜色为`rgba(255,0, 0, 0.5)`
### Environment
```markdown
- OS:windows
- Browser:Chrome 96.0.4664.55
- Framework:Vue@2.x
```
### Any additional comments?
_No response_
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] echarts-bot[bot] commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1015026927
This issue is labeled with `difficulty: easy`.
@sz-p Would you like to debug it by yourself? This is a quicker way to get your problem fixed. Or you may wait for the community to fix.
Please have a look at [How to debug ECharts](https://github.com/apache/echarts/blob/master/CONTRIBUTING.md#how-to-debug-echarts) if you'd like to give a try. 🤓
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] Ayushsunny commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
Ayushsunny commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1016079249
Hey @sz-p I would like to work on this
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] sz-p commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
sz-p commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1066261657
> > https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
>
> @sz-p the url not work.
>
> @Ayushsunny where's your commit, would you push it?
makeapie.com is not working since 2022/02/15
look this: https://stackblitz.com/edit/js-kvarkq?file=index.js
maybe the error is at https://github1s.com/apache/echarts/blob/HEAD/src/chart/treemap/TreemapView.ts#L869
```javascript
// why use the borderColor render as fill?
normalStyle.fill = visualBorderColor;
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] sz-p commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
sz-p commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1066261892
> > https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
>
> @sz-p the url not work.
>
> @Ayushsunny where's your commit, would you push it?
makeapie.com is not working since 2022/02/15
look this: https://stackblitz.com/edit/js-kvarkq?file=index.js
maybe the error is at https://github1s.com/apache/echarts/blob/HEAD/src/chart/treemap/TreemapView.ts#L869
```javascript
normalStyle.fill = visualBorderColor;
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] fuchunhui commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
fuchunhui commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1069015923
> ```js
> // why use the borderColor render as fill?
> normalStyle.fill = visualBorderColor;
> ```
I can answer this.
In short, `Treemap`'s rendering consists of two groups, `renderBackground` draws a rectangle, on the bottom. `renderContent` draws another rectangle, on the top. let 's suppose, named them B and C.
Why do we need two rectangles? To draw a border. If we set `borderWidth`, the area of rect B greater than C. Canvas use `visualBorderColor` fill the rect.
// Image ?
look back on your [link](https://stackblitz.com/edit/js-kvarkq?file=index.js)
```
{
borderColor: '#000',
color: 'rgba(255, 0, 0, 0.5)'
}
```
according to Canvas compositing, default use ['source-over'](https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcover) operator to merge shapes of different elements are combined into a single image.
let's check.

```
destination: #000 -> rgba(0, 0, 0, 1)
source: rgba(255, 0, 0, 0.5)
then, we get:
αo = 0.5 + 1 * (1 - 0.5) = 1
co = 0.5 * Cs + 1 * Cb * (1 - 0.5) = 0.5 * (Cs + Cb)
r = 0.5 * (255 + 0) = 128
g = 0.5 * (0 + 0) = 0
b = 0.5 * (0 + 0) = 0
a = αo = 1
rgba(r, g, b, a) = rgba(128, 0, 0, 1) = #800000
After compositing, the result is #800000.
```
it looks like this.

`rgba(128, 0, 0, 1)` not equal to `rgba(255,0, 0, 0.5)`
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] pissang commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
pissang commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1069136778
1. colorAlpha will have higher priority. It should be 0.6
2. `colorAlpha` is mainly for visual encoding. We usually use it as a encoding channel which may range from minAlpha to maxAlpha instead of a constant value.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] fuchunhui commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
fuchunhui commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1066108433
> https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
@sz-p the url not work.
@Ayushsunny where's your commit, would you push it?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] fuchunhui commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
fuchunhui commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1069025587
now, back to this issue.
Can you explain this two for me? @pissang
1. which of `color` and `colorAlpha` has higher priority?
```
{
color: 'rgba(255, 0, 0, 0.8)',
colorAlpha: 0.6
}
```
what 's the result? `0.8 or 0.6 or ?`
2. the design of `colorAlpha`, what's the purpose. its range of influence, backgroundColor, borderColor or both.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] fuchunhui commented on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
fuchunhui commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1078887871
After discussing with @pissang today, we had the following solutions.
1. use blend, set `el.style.blend = 'copy'`.
2. computed fixed color, `background + fixed --> color`.
3. new rect, add middle layer, `background + middle + content`, mix middle and content, make color.
4. redesign bakground, `backgroundRect, contentRect1, contentRect2`, draw rect1 and rect2 in counter-clockwise order.
-------------
Next, let's check one by one.
1. set blend, [compositing operators copy](https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_src)
[TreemapView.ts#L932](https://github.com/apache/echarts/blob/d3dbf1215a0ae0c5075efffb10b17fe4de37582c/src/chart/treemap/TreemapView.ts#L932)
```
normalStyle.fill = visualColor;
normalStyle.blend = 'copy';
normalStyle.decal = nodeStyle.decal;
```
[echarts.ts#L2331](https://github.com/apache/echarts/blob/d3dbf1215a0ae0c5075efffb10b17fe4de37582c/src/core/echarts.ts#L2331)
```
if (!el.isGroup) {
el.style.blend = blendMode || el.style.blend;
}
```
the result becomes very strange and uncontrollable, and there is a big gap from expectations.
2. fixed color, but no such color.
```
background = 'rgba(255, 255, 0, 1)'; // yellow
color = 'rgba(0, 255, 255, 0.3)' // cyan, alpha = 0.3
```
we need fixed color, make `background + fixed -> color`. first, compute alpha value.
```
αo = αs + αb x (1 – αs)
0.3 = αs + 1 x (1 - αs)
= αs + 1 - αs
= 1
```
0.3 is not equal to 1。
3. add new layer, named middle. draw middle with custom color. then `custom + fixed -> color`, a good idea?
Frankly, No.
mix background color and custom color will become another color.
finally, another color maybe same with Solution Two.
4. at present, Zrender didn't support this. draw graph anti-clockwise, create hollows.
```
backgroundRect + contentRect1 (by anti-clockwise) + contentRect2 (by anti-clockwise)
contentRect1
contentRect2
```
this is the best solution.
similar case, for example, set semi-transparent fill + stroke for graphics. Half of the stroke will also overlap with the filling part, and then affect the filling color.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] echarts-bot[bot] commented on issue #16367: [Bug] treemap borderColor 显示为 backgroundColor
Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1011999949
@sz-p It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
<details><summary><b>TRANSLATED</b></summary><br>
**BODY**
### Version
5.2.2
### Link to Minimal Reproduction
https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
### Steps to Reproduce
https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
### Current Behavior
The color behaves incorrectly. As shown in the example, the expected color is the 'color' configuration item ('rgba(255,0, 0, 0.5)') actually behaves as a superposition of 'color' and 'borderColor'
### Expected Behavior
Colors are 'rgba(255,0, 0, 0.5)'
### Environment
```markdown
- OS:windows
- Browser:Chrome 96.0.4664.55
- Framework:Vue@2.x
```
### Any additional comments?
_No response_
</details>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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
[GitHub] [echarts] sz-p removed a comment on issue #16367: [Bug] treemap 颜色包含透明度时 表现不正确
Posted by GitBox <gi...@apache.org>.
sz-p removed a comment on issue #16367:
URL: https://github.com/apache/echarts/issues/16367#issuecomment-1066261892
> > https://www.makeapie.com/editor.html?c=x9V2jMtCnO&v=1
>
> @sz-p the url not work.
>
> @Ayushsunny where's your commit, would you push it?
makeapie.com is not working since 2022/02/15
look this: https://stackblitz.com/edit/js-kvarkq?file=index.js
maybe the error is at https://github1s.com/apache/echarts/blob/HEAD/src/chart/treemap/TreemapView.ts#L869
```javascript
normalStyle.fill = visualBorderColor;
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
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