我正在使用带有咖啡脚本的nvd3库cumulativeChart,我的图表上有刻度(xAxis)的问题,当日期范围太大时,日期相互重叠。
任何想法如何解决这个问题?
Image for Nvd3 cumulativeChart ticks (xAxis) issue
这是代码
chart = nv.models.cumulativeLineChart()
.x((d) ->
d[0] )
.y((d) ->
d[2])
.color(d3.scale.category10().range())
.useInteractiveGuideline(true)
chart.xAxis
.axisLabel('Dates')
.ticks(3) // doesn't show 3 ticks shows every time differently
.tickFormat((d)->
d3.time.format('%d/%m/%Y')(new Date(d)))
chart.yAxis.axisLabel('Percents').tickFormat(d3.format(',r'))
$('#d3-graph').append('<svg></svg>')
graph = d3.select('#d3-graph svg').datum(dataSet).call(chart)
nv.utils.windowResize(chart.update)
console.log(dataSet)
chart
这是我的dataSet的缩短版本
dataSet =
[{
"key": "Series 1",
"values": [ [ 1025409600000 , 0] , [ 1028088000000 , -6.3382185140371]]
}]
任何想法如何让刻度正好为3?