dictionary - 制作百分比条形图
问题描述
对不起,我不知道该怎么称呼这种图表。我已经制作了一个方形网格图,矩形位于每个质心上。(图一)
现在我想做一个百分比图(同型?),但我不知道该怎么做。(图2--photoshop)
这是代码,我从一个简单的地图代码修改它
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 上手动添加数据,但我想知道如何从动态输入中做到这一点。我想用谷歌搜索,但没有任何线索或关键字。谢谢
解决方案
推荐阅读
- symfony - 在 symfony 4 中部署期间获取所有独白文件路径
- python-3.x - GeoPandas dataFrame using iterrows() to fill a dictionary with column data
- swift - Reflection in Swift
- mysql - how to display two queries in one mysql table
- php - json_decode getting JSON_ERROR_SYNTAX on POST request
- spring-kafka - @EventListener 中的 SPEL 表达式
- python - tf.keras 卷积架构不起作用
- html - Bootstrap 输入背景不覆盖整个输入
- r - lm 的系数太多
- tensorflow - 为 LSTM RNN 预测时间序列动态找到正确的时间步长