Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG! 曲线图,从series中删除一个数据,直接调用setOption,删除的数据还存在,具体看代码 #3002

Closed
HaiYuanQi opened this issue Apr 15, 2016 · 2 comments

Comments

@HaiYuanQi
Copy link

HaiYuanQi commented Apr 15, 2016

 option = {
        title: {
            text: '堆叠区域图'
        },
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                boundaryGap : false,
                data : ['周一','周二','周三','周四','周五','周六','周日']
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name:'邮件营销',
                type:'line',
                stack: '总量',
                areaStyle: {normal: {}},
                data:[120, 132, 101, 134, 90, 230, 210]
            },
            {
                name:'联盟广告',
                type:'line',
                stack: '总量',
                areaStyle: {normal: {}},
                data:[220, 182, 191, 234, 290, 330, 310]
            }
        ]
    };
    var ec=echarts.init(d3.select("#echarts_test").node())
            ec.setOption(option);

    function test(){
        option.series.pop();
       //ec.clear()  如果不调用clear就会出现bug
        ec.setOption(option);
    }
@pissang
Copy link
Contributor

pissang commented Apr 15, 2016

@pissang pissang closed this as completed Apr 15, 2016
@Renhj90520
Copy link

@pissang 看到issue里面有多个类似的需求,所以只清除series,保持其它设置是比较普遍的需求,setOption第二个参数设置为true并不是非常好的解决方法,请问后续有没有更加优雅的解决方法。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants