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

Limit start & end date #271

Open
rmehner opened this issue May 27, 2019 · 3 comments · May be fixed by #269
Open

Limit start & end date #271

rmehner opened this issue May 27, 2019 · 3 comments · May be fixed by #269

Comments

@rmehner
Copy link

rmehner commented May 27, 2019

👋

First of all: Thanks for all the work on this library, worked really well for us so far :)

For our app, we need to be able to limit the start date and the end date and need to disallow zooming / panning beyond that. We're setting the date range initially like this:

const config = {
 // ... omitting other values for readability
  range: {
    start: new Date('2019/01/01'),
    end: new Date('2019/05/27'),
  },
}

So the initial state is correct, but it allows to scroll beyond that. onZoomEnd triggers after the chart already has been redrawn and even with the other event listeners, the redraw usually happens before we can limit the date again, leading to some flickering.

Any ideas / hints on how to achieve what we want to achieve? Thank you :)

@Busteren
Copy link
Contributor

This is not currently in version 1.3.0. However I made a pr for this: #269

So it uses extents in D3 to do this. So the initial boundaries are start and end range. Also make sure to set max zoom to 1 so you cannot zoom out of bounds (think it’s max zoom scale).

Just download the repo and build it from th zoomInprovements branch and you should have what you need.

There are also some bug fixes not released yet, so really recommend using latest

@Busteren
Copy link
Contributor

@rmehner did it solve your need?

If not let me know and if it did, then please close the issue 🙌

@rmehner
Copy link
Author

rmehner commented May 28, 2019

@Busteren haven't had the time to test that, will report back (albeit would prefer a proper 1.4 release, but I realize that this might be much more work :))

@Busteren Busteren linked a pull request Aug 30, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants