D3.js 中是否可以制作带有时间刻度 y 轴的折线图?
我找到了文档: https://github.com/mbostock/d3/wiki/Time-Scales
Y 轴似乎没有限制。
有什么例子吗?
最佳答案
它与使用线性刻度几乎相同:
var svg = d3.select('#your_svg_id').select("svg")
.attr('width', 300)
.attr('height', 300)
.append("g");
var yScale = d3.time.scale()
.domain([new Date(1980, 0, 1), new Date() ])
.range([100, 0]);
// Domian being the from and to date and range the from to positioning of the axis
svg.append("svg:g")
.attr("class", "y axis")
.call(yAxisGen);
关于javascript - D3.js y 轴时间刻度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31824990/