小编ang*_*gel的帖子

如何将选项附加到 d3 中的选择组合框中

我想将该选项添加到选择组合框中,例如我有类似的数据

[{ "NAME": "JONE", "ID": {"id1":123,"id2":124}}, { "NAME": "ANGEL", "ID": {"id1":125,"id2":127}}]` 
Run Code Online (Sandbox Code Playgroud)

我想将“名称”附加到选项中,到目前为止我已经这样做了:

dataset=d3.json("namees.json", function(data) {
    select = d3.select('body')
    .append('select')
    .attr('class','style');
    options = select
    .selectAll('option')


    .append('option')
            .text(data.forEach(function (d) {return d.Name}))



});
Run Code Online (Sandbox Code Playgroud)

但它没有显示选择选项中的值

javascript d3.js

2
推荐指数
1
解决办法
4941
查看次数

标签 统计

d3.js ×1

javascript ×1