javascript - D3.js y 轴时间刻度

标签 javascript d3.js time

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/

相关文章:

javascript - D3(重新)绘制单个对象的约定

c++ - 将 float 存储为 short int。令人困惑的结果

javascript - 替换正则表达式

javascript - 配置文件脚本未正确显示

javascript - Highcharts 如何根据点数创建图例

javascript - 圆环图 : show percentage inside

javascript - 创建可重用的 JavaScript 函数

javascript - d3.js 缩放不溢出

javascript - javascript中的正则表达式24小时时间验证

iOS 设备上的 ctime 无法正确测量时间