The Wealth & Health of Nations | Benbinbin | Observable
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
ojs
Author
Benbinbin
@benbinbin
Creator
Comments (2)
Benbinbin
Oct 25, 2022
这里要与径向比例尺 `d3.scaleRadial()` 区分,该也是将数据映射为面积,即映射关系是将定义域的值与值域的值的平方构成线性关系。但实际和 `d3.scaleSqrt()` 略有不同,这个映射关系好像是会随着半径而变化(?) 一般用于径向条形图中 实际用例
https://observablehq.com/@d3/radial-stacked-bar-chart
相关的讨论
https://github.com/d3/d3-scale/issues/90
Reply
Benbinbin
Oct 26, 2022
绘制网格参考线的另一种方法:拷贝坐标轴的刻度线并进行延伸 核心代码如下 ```js g => g.selectAll(".tick line").clone() // 这里复制了一份刻度线,用以绘制散点图中纵向的网格参考线 .attr("y2", marginTop + marginBottom - height) // 调整复制后的刻度线的终点位置(往上移动) .attr("stroke-opacity", 0.1)) // 调小网格线的透明度 ``` 参考
https://observablehq.com/@benbinbin/scatterplot#Scatterplot
Reply
Add comment
Subscribe to notifications
© 2026 Observable, Inc.
Terms of service
Privacy policy
Product
About
Pricing
Documentation
Release notes
Contact us
Open source
Notebook Kit
Plot
D3
Community
Explore
Forum
Bluesky
YouTube
X
0
Follow
Follow
The Wealth & Health of Nations | Benbinbin | Observable