我一直在寻找一个小示例,在css中设置由R包r2d3创建的d3样式属性。例如,对于beta RStudio中的默认RStudio脚本,
// !preview r2d3 data=c(0.3, 0.6, 0.8, 0.95, 0.40, 0.20)
//
// r2d3: https://rstudio.github.io/r2d3
//
var barHeight = Math.ceil(height / data.length);
svg.selectAll('rect')
.data(data)
.enter().append('rect')
.attr('width', function(d) { return d * width; })
.attr('height', barHeight)
.attr('y', function(d, i) { return i * barHeight; })
.attr('fill', 'steelblue');我将如何编码相当于添加,比如说,
.attr('stroke-width', 2)
.attr('stroke', 'white')但要在css文件中这样做吗?
发布于 2018-10-17 23:18:10
就像您将样式的任何其他CSS属性。如果需要的话,让选择器更加具体,很可能会向rect rect.someclass添加一个类。
rect {
stroke-width: 2;
stroke: white;
}https://stackoverflow.com/questions/52864442
复制相似问题