apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.63k stars 19.61k forks source link

legend does not respect itemStyle.opacity #9670

Closed tmalaher closed 3 years ago

tmalaher commented 5 years ago

General Questions

In this issue, I have provided information with: 在这个 issue 中我提供了以下信息:

Issue Type

Issue Details

When overriding the itemStyle in a data series, the legend does not respect the opacity setting.

Expected Behavior

Setting the data[n].itemStyle.opacity should affect both the plot area and the legend.

Current Behavior

legend opacity bug

Setting the itemStyle.color and opacity results in the legend showing a fully opaque item of the correct color. The opacity is ignored.

Online Example

Using 4.1.0 (only one I could get a link to from jsfiddle): http://jsfiddle.net/yL64mkn0/

Full code:

var option = {
            title: {
                textStyle: {fontSize:12},
                text:'Legend Opacity Bug'
            },
            toolbox: {
                 show: true,
                 feature: {
                     saveAsImage: {show: true}
                 }
            },
            legend: {
                data:['Value2','Border'],
                right: '10%'
            },
            xAxis: {type: 'time'},
            yAxis: {type: 'value'},
            series: [
                {
                name: 'Value2',
                type: 'line',
                data: [
                    [1546377489000, 1.26],
                    [1546377589000, 3.68],
                    [1546377689000, 5.24],
                    [1546377789000, 7.82],
                    [1546377889000, 9.95],
                    [1546377989000, 11.81],
                    [1546378089000, 13.04],
                    [1546378189000, 5.33],
                    [1546378289000, 7.84],
                    [1546378389000, 3.58],
                    [1546378489000, 1.96],
                ]
                },
            {
                name: 'Border',
                type: 'bar',
                itemStyle: {  color: 'green', opacity: 0.3 },
                markArea: {
                            itemStyle: 
                                { normal: { color: 'green', opacity: 0.3 }},
                            label: {
                                normal: {
                                    show: false,
                                    position: ['0%','50%'],
                                    color: '#000'
                                }
                            },
                            data: [
                                [{
                                    name: 'Lower Critical',
                                    yAxis: -99999999999
                                }, {
                                    yAxis: 1.5
                                }],
                                [{
                                    name: 'Upper Critical',
                                    yAxis: 9.5
                                }, {
                                    yAxis: 99999999999
                                }]
                            ]
                }
            }
            ]
        };

Topics

Anything Else We Need to Know

N/A

Environment

pissang commented 5 years ago

Currently only color and symbol will be reflected in the legend.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] commented 3 years ago

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!