javascript - 如何从我的 d3 视觉对象中删除格陵兰岛

标签 javascript json d3.js

我有这个改编的 d3 地理视觉效果:

https://plnkr.co/edit/BnCRYzCH3TGEP5ypTGGu?p=preview

我想从 map 中删除格陵兰岛,并认为在 foobar.json 文件中注释掉以下内容就足够了:

            // , { "type": "MultiPolygon", "id": 86, "arcs": [
            //    [
            //        [503]
            //    ],
            //    [
            //        [504]
            //    ],
            //    [
            //        [505]
            //    ],
            //    [
            //        [506]
            //    ],
            //    [
            //        [507]
            //    ],
            //    [
            //        [508]
            //    ],
            //    [
            //        [509]
            //    ],
            //    [
            //        [510]
            //    ],
            //    [
            //        [511]
            //    ]
            // ], 
            // "properties": { "admin": "Greenland", "id": "GRL" } }

此调整破坏了完整的视觉效果 - 如何删除格陵兰岛?

最佳答案

这更容易:

svg.select("#code_GRL").remove();

这是您更新的插件:https://plnkr.co/edit/yPgYLSSvtyDh6rW5vPyS?p=preview

关于javascript - 如何从我的 d3 视觉对象中删除格陵兰岛,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40597165/

相关文章:

json - Postgres : expand JSON array elements into values with their index?

arrays - 如何快速将数据附加到 JSON 格式数组中?

javascript - d3.js 使用函数作为 csv 源而不是 csv 路径

r - 如何使用 networkD3 在 R 中绘制有向图?

javascript - 是否可以在 chrome 和 firefox 等浏览器中自定义 "allow"弹出窗口?

javascript - 递归过多的原因是什么?

javascript - Ruby on Rails 应用程序中的 React .js.jsx 扩展

javascript - 如何在 JavaScript 中替换 JSON 字符串中的所有 sibling ?

javascript - d3.nest 具有可变子深度

javascript - 代码无法识别 ColumnDataSource 的本质