Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For line chart inconsistent dates observed on x-axis #17

Open
gauravjain811 opened this issue Apr 16, 2019 · 0 comments
Open

For line chart inconsistent dates observed on x-axis #17

gauravjain811 opened this issue Apr 16, 2019 · 0 comments

Comments

@gauravjain811
Copy link

I have a below query using angular2-nvd3.js version 1.0.7-

Using ticks in Option values for line chart inconsistent dates observed on x-axis. While using tickValues able to fix consitent dates dynamically but on legend click / resizing browser window ticks on x-axis disappeared.

Any kind of help will be highly appreciated.

//Problem code

xAxis: {
axisLabel: '',
ticks: 22,
showMaxMin: false,
rotateLabels: -90,
tickFormat: function (d) {
return d3.time.format('%m/%d/%y ')(new Date(d));
}
}

[Tried below solution code]

xAxis: {
axisLabel: '',
tickValues: function(d){
var between = []
var secondDate = d[0].values[d[0].values.length-1].date;
var firstDate = d[0].values[0].date;

      //get all dates between max and min date
      while (firstDate <= secondDate) {
          between.push(new Date(firstDate));
          firstDate.setDate(firstDate.getDate() + 4);
      }

  return between;
     },       

    showMaxMin: false,
    rotateLabels: -90,
    tickFormat: function (d) {
      return d3.time.format('%m/%d/%y ')(new Date(d));
    }
  }

Expected: x-axis ticks using tickValues angular2-nvd3 v1.0.7 should not disappear on legend click / chrome browser window resize.

Actual: inconsistent dates with random interval on x-axis using angular2-nvd3 v1.0.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant