how to format time on xAxis use d3.js

后端 未结 5 1705
攒了一身酷
攒了一身酷 2020-12-04 15:38

According the demo on http://bl.ocks.org/mbostock/3883245

I don\'t know how format time on xAxis

this is my code : js:


    var data = [{
                 


        
5条回答
  •  一生所求
    2020-12-04 15:52

    In v4,

    ...
    var scaleX = d3.scaleTime().range([0, width]);
    var axisBottom = d3.axisBottom(scaleX)
                       .ticks(d3.timeMinute, 10); // Every 10 minutes
    ...
    

    Note that use d3.timeMinute - not d3.timeMinutes

提交回复
热议问题