How to plot time on the X-axis in non-ugly mode?

后端 未结 1 1367
感情败类
感情败类 2021-01-28 09:34

This is ugly:

I need something that is not ugly. Time series are very usual, but I not see how to build a \"plug and play\" chart with ISO date

相关标签:
1条回答
  • 2021-01-28 09:37

    You can try using historicalBarChart which can have time series on x axis.

      var chart = nv.models.historicalBarChart()
       .x(function(d) { return d[0]})
       .y(function(d) { return d[1]})
       .useInteractiveGuideline(true);
    
      ...
    
      chart.xAxis
        .showMaxMin(false)
        .tickFormat(function(d) {
          return d3.time.format('%x')(new Date(d))
        });
    

    Working example is here.

    0 讨论(0)
提交回复
热议问题