i drawing line chart using nvd3 , specifying set of xaxis values draw ticks using:
chart.xaxis.tickvalues(tickarr) where tickarr has list of points draw ticks for.
for reason, ticks close beginning or end values x axis not being drawn. guessing because of default setting boundary value ticks not able find way override , show specified ticks.
here link fiddle . can see though tickarr has 7 data points, 3 ticks shown.
any parameter should change or why happening appreciated.
i modified source around situation. in nv.models.axis(), there buffer given when showmaxmin true bottom/top orientation:
if (showmaxmin && (axis.orient() === 'top' || axis.orient() === 'bottom')) { var maxminrange = []; wrap.selectall('g.nv-axismaxmin') .each(function(d,i) { try { if (i) // i== 1, max position maxminrange.push(scale(d) - this.getboundingclientrect().width - 4); //assuming max , min labels wide next tick (with 4 pixels in case) else // i==0, min position maxminrange.push(scale(d) + this.getboundingclientrect().width + 4) }catch (err) { if (i) // i== 1, max position maxminrange.push(scale(d) - 4); //assuming max , min labels wide next tick (with 4 pixels in case) else // i==0, min position maxminrange.push(scale(d) + 4); } }); // g's wrapping each tick g.selectall('g').each(function(d, i) { if (scale(d) < maxminrange[0] || scale(d) > maxminrange[1]) { if (d > 1e-10 || d < -1e-10) // accounts minor floating point errors... though problematic if scale extremely small d3.select(this).remove(); else d3.select(this).select('text').remove(); // don't remove 0 line!! } }); } i removed these buffers:
try { if (i) // i== 1, max position maxminrange.push(scale(d)); else // i==0, min position maxminrange.push(scale(d)) }catch (err) { if (i) // i== 1, max position maxminrange.push(scale(d)); else // i==0, min position maxminrange.push(scale(d)); } there post talking similar issue. solution posted there remove boundary ticks seems wrong approach boundary ticks helpful when considering perceptual aspects of visualization. hope answer helps faces similar situation in future.
Comments
Post a Comment