score:1

Accepted answer

What I did wrong is giving the date string instead of date obj.

So I split the JSON and create date object using date string for the x-axis labels. like below.

new Date(dateStr)

Now it is working fine

score:1

There are two things:

  1. you can setup the ticker;
  2. and you can convert your value from a random string to something NVD3 understands

If you provide a String on the X-axis, NVD3 doesn't know how to order it, so a Date object is required. You can setup your chart like this:

chart.xAxis
  .x(function(d) { new Date(d.x) }) // this convert the data object
  .axisLabel('Date')
  .tickFormat(function(d) { return d3.time.format('%Y-%m-%d')(new Date(d)); }); // this convert the ticker

Related Query

More Query from same tag