Thursday 15 August 2013

javascript - NVD3 Line Chart X Axis Ticks Are Missing -



javascript - NVD3 Line Chart X Axis Ticks Are Missing -

i using nvd3 display line chart here: http://jsbin.com/xodaxafiti/2/edit?js,output

but seems nvd3 auto-hide ticklabels on xaxis, ticks near edge, i.e. 2-3oct , 27-28oct (except first , lastly tick). know auto-reduce because when increment width of chart, ticks start show up. find reducing behaviour weird, , linechart not have reducexticks alternative multibarchart.

i want able command reducing behaviour myself this:

var chart = nv.models.linechart() .useinteractiveguideline(true) .margin({left: 80,top: 20,bottom: 120,right: 20}); chart.xaxis.ticks(function() { homecoming data[0].map(chart.x()).filter(function(d,i) { % math.ceil(data[0].values.length / (availablewidth / 100)) === 0; }) })

but didn't work. has thought how command this?

the reducing behavior works because showmaxmin set true default. adding .showmaxmin(false) fixes problem:

chart.xaxis.axislabel("xaxislabel") .showmaxmin(false) .tickvalues(tickvalues) .tickformat(function (d) { homecoming tickformat[d]; }) ;

javascript d3.js nvd3.js linechart

No comments:

Post a Comment