Dictionary 制作百分比条形图

Dictionary 制作百分比条形图,dictionary,d3.js,grid,square,waffle-chart,Dictionary,D3.js,Grid,Square,Waffle Chart,对不起,我不知道该怎么称呼这种图表。我已经做了一个正方形网格地图,矩形位于每个质心上。(图一) 现在我想做一个百分比图(同型?),但我不知道怎么做。(图2——photoshopped) 这是代码,我修改了它从一个简单的地图代码 d3.json(url).then(function(dataset){ group = canvas.selectAll("g") .data(dataset.features) .enter() .append("g") are

对不起,我不知道该怎么称呼这种图表。我已经做了一个正方形网格地图,矩形位于每个质心上。(图一)

现在我想做一个百分比图(同型?),但我不知道怎么做。(图2——photoshopped)

这是代码,我修改了它从一个简单的地图代码

d3.json(url).then(function(dataset){

  group = canvas.selectAll("g")
    .data(dataset.features)
    .enter()
    .append("g")

  areas = group.append("path")
    .attr("d", path)
    .attr("class","area")
    .style("fill","white")
    .style("opacity",0)
    ;

  group.append("rect")
    .attr("x",function (d) { return path.centroid(d)[0];})
    .attr("y",function (d) { return path.centroid(d)[1];})
    .attr("width",10)
    .attr("height",10)
    .style("fill","orange");


});
通过在JSON上手动添加数据,我已经有了一个想法,但我想知道如何从动态输入中进行添加。我想用谷歌搜索,但没有任何线索或关键词。
谢谢

你能在问题中添加你的代码吗,这将有助于解决你的问题。@Ma'mounothman Hi,我已经编辑了我的帖子,希望能解释清楚。你能在问题中添加你的代码吗,这将有助于解决你的问题。@Ma'mounothman Hi,我已经编辑了我的帖子,希望能解释清楚