javascript - NVD3 line chart single record issue -
hi,
i facing strange issue while using nvd3 line chart. single record showing data in middle of graph , multiple data working perfectly. issue single data showing future dates relly dont want display.
nv.addgraph(function() { var chart = nv.models.linechart().x(function(d) { return d.x }).y(function(d) { return d.y }).color(d3.scale.category10().range()) .useinteractiveguideline(true); chart.forcey([0,unitinterval]); chart.yaxis.scale().domain([ 0, 9999999 ]); var format = ',f'; chart.yaxis.tickformat(function(d) { return nformatter(d); }).axislabel('no. of records'); chart.margin({ bottom : 50, left : 75 });//set margin chart.xaxis.axislabel("duration").tickformat(function(d) { return d3.time.format('%x')(new date(d)); }); chart.nodata("data unavailable current selection."); d3.select('#recordchartdiv svg').datum(data).transition() .duration(500).call(chart); nv.utils.windowresize(chart.update);
this code using. can pls arrange tick in case of single record? working fine in graph multiple data.
what expect graph 1 data point?
you add domain , forcex show points date maximum so: chart.forcex([mindate, date]); chart.xaxis.scale().domain([mindate, date]);
see fiddle example: https://jsfiddle.net/b3fwowzz/14/
Comments
Post a Comment