javascript - D3js X-axis transition logging NaN-error in console -
when transition x-axis error logged @ console (translation might bit incorrect because logged in own language):
unexpected value "translate(nan, 0)" when parsing transform-attribute the error seems originate axis.js:154. although error logged, works fine.
i have debugged problem , found @ line 154 d undefined. results in following:
var v0 = x0(d); //v0 = nan isfinite(v0) //false x1(d) //nan (isfinite(v0) ? v0 : x1(d)) // false ? nan : nan -> returns nan return "translate(" + (isfinite(v0) ? v0 : x1(d)) + ",0)" //alwaysreturns "translate(nan, 0)" d = undefined i use version 3.5.5 of d3 , code follows (only relevant parts):
var x = d3.scale.linear().range([0, getwidthwithoutmargin()]); var xaxis = d3.svg.axis(); xaxis.scale(x); xaxis.orient("bottom"); xaxis.tickformat(formatfunction); xaxis.ticks(1); x.domain([0, getmaxpercentageprediction()]); //the chart created after //when updating this: xaxis.tickvalues([0, getmaxpercentageprediction()]); var xaxiselement = d3.select(".chart g").select(".x.axis"); xaxiselement.call(xaxis); getwidthwithoutmargin , getmaxpercentageprediction always return number (and not undefined or else). if replace them hardcoded values error still logged.
i hope can me issue.
thanks in advance!
Comments
Post a Comment