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

Not numerical min and max values #35

Closed
geraldo opened this issue Nov 8, 2016 · 2 comments
Closed

Not numerical min and max values #35

geraldo opened this issue Nov 8, 2016 · 2 comments
Labels

Comments

@geraldo
Copy link

geraldo commented Nov 8, 2016

Great plugin! I really would like it to apply to date ranges, putting min and max-values like that:

yMin: '2016-06-01'
yMax: '2016-07-01'
@compwright
Copy link
Collaborator

Have you tried yMin: new Date('2016-06-01')?

If that doesn't work, you can use a linear scale instead of a date scale, and use a custom tick formatter to format UNIX timestamps as date strings. Then you could do this:

yMin: new Date('2016-06-01').getTime()

@thegruffalo
Copy link

I had the same issue with a barchart with a non numeric scale. My tweak was in the LineAnnotation configure function

if (scale) { pixel = helpers.isValid(options.value) ? scale.getPixelForValue(options.value) : NaN; endPixel = helpers.isValid(options.endValue) ? scale.getPixelForValue(options.endValue) : pixel; }

->

if (scale) { pixel = scale.getPixelForValue(options.value); endPixel = scale.getPixelForValue(options.endValue || options.value); }

I didn't try your suggestion to use a custom tick formatter as I didn't think of it.

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

No branches or pull requests

3 participants