0

I have an nvd3 line chart that needs to display every date in a month on the x axis. For the current month (July) I have generated 31 x,y pairs. However, the chart omits a couple of those data points. Most data points, actually, have the y coordinate set to null (because not all dates have data, but I still need to display every date).

This is how it looks now:

enter image description here

As you can see, there are some dates missing: 07/08/2018, 07/15/2018, 07/22/2018, 07/30/2018 and 07/31/2018.

This is my code:

chart.xAxis.ticks(weightData.length); // this is 31
chart.xAxis.rotateLabels(-35);
chart.xAxis.showMaxMin(false); // if this is true, even less data is displayed

Is there a way to force the chart do display all the data on the x axis?

dnmh
  • 2,045
  • 2
  • 34
  • 49

1 Answers1

0

I have found the answer here:

NVD3 Line Chart X Axis Ticks Are Missing

The point is to use tickValues() instead of ticks() as the answer on the post in link says.

dnmh
  • 2,045
  • 2
  • 34
  • 49