Code Monkey home page Code Monkey logo

Comments (4)

plainheart avatar plainheart commented on July 21, 2024

@benleilei 感谢反馈,但我认为这个是 ECharts 的bug,默认如果不指定 notMergetrue,会采用合并的方式,所以 seriesdata 并不会被覆盖,也就是说只能通过遍历的方式把各个 seriesdata 置空。
这个问题会在接下来的 5.0 版本中得到优化。

from echarts-extension-amap.

benleilei avatar benleilei commented on July 21, 2024

可能我描述的有问题,问题不是在于 const opts = echarts.util.clone(option) 语句,即使写成 const opts = { xxxx, series: [] } 即我重写一个新的 JSON 对象,还是无法清除绘制到地图上的点。

setTimeout(function() {
    const opts = {
        amap: {
            viewMode: '3D',
            center: [108.39, 39.9],
            zoom: 4,
            resizeEnable: true,
            renderOnMoving: true,
            mapStyle:'amap://styles/dark'
        },
        tooltip : {
            trigger: 'item'
        },
        animation: true,
        series: []
    }
    chart.setOption(opts);
}, 3000);

我关注的点在于:series 被清空后,再次赋值,原先内容还是存在。
但是,使用 bmap 完全没有此问题

from echarts-extension-amap.

plainheart avatar plainheart commented on July 21, 2024

需要手动将 series 中的 data 置空才可以,series: [] 不行,除非指定 notMergetrue
bmap没有此问题?能否提供一个例子?

from echarts-extension-amap.

plainheart avatar plainheart commented on July 21, 2024

@benleilei 这是官网的bmap例子,如我上边所说的原因,也存在同样问题。
https://gallery.echartsjs.com/editor.html?c=xFt3nuTGd0&v=1
想要清空有两种办法,一个是你所说的遍历,另一个就是指定 notMergetrue,像这样:myChart.setOption(opts, true);
或者在 setOption 之前先调用 chart.clear()

from echarts-extension-amap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.