1

I am currently working with NVD3 using Angular Directive (angular-nvd3). I have a very simple line chart with very simple data.

The problem I have encountered now is that my data is wrongly aligned with the Axis.

I am using dates on my xAxis, which are parsed using d3 library:

tickFormat: function(d) {return d3.time.format('%d/%m')(new Date(d))}

I googled lot, but wouldn't find any satisfactory answer. Please help, Thanks

ved raj
  • 33
  • 4

1 Answers1

0

You need to add this to your index.html

<script data-require="lodash.js@1.3.1" data-semver="1.3.1" src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.min.js"></script>

And you have to add additional tickValues to your xAxis

rotateLabels: -45, tickValues: function(values) { return _.map(values[0].values, function(v) { return new Date(v.x); }); }

Here is PLUNKR

Check here for more information. Even this looks like gives you some bugs, but looks like this is best possible solution.

Community
  • 1
  • 1
mtkilic
  • 1,213
  • 1
  • 12
  • 28