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

Ticks that correspond to labels and have uniform spacing #4278

Closed
dandip opened this issue May 20, 2017 · 3 comments
Closed

Ticks that correspond to labels and have uniform spacing #4278

dandip opened this issue May 20, 2017 · 3 comments

Comments

@dandip
Copy link

dandip commented May 20, 2017

Expected Behavior

Change/improvement: The option to have breaks in the x or y-axis. For example, my time dataset only has points between 9:30am and 4:00pm. I'd like to have the ticks on the x-axis go straight from 4pm to 9:30am, in order to avoid the large gap where there is no data. Basically, what I'm looking for is a way to have the ticks on the x-axis align with the present labels. The distance between each tick would be the same, regardless of the actual numerical distance between each label. For example, if the labels are [3, 32, 902], the ticks would be 3, 32, 902, each with the same spacing distance, despite the numerical values being drastically far apart. As far as I know, this is not currently possible. Each label that I'm using is a moment.js object.

Current Behavior

Currently, there is no option (as far as I know) for ticks to align with labels and have the same spacing regardless of the difference in value.

Possible Solution

I think this might be fixable with a custom scale type, but I'm not really sure how that'd be done.
Maybe this would be fixable if I used strings instead of moment.js objects, since the chart wouldn't be able to tell the large span between each time.

Context

I'm trying to plot stock market data for a website that I'm making. Since the stock market is only open from 9:30am to 4:00pm, there are large spans without data. In order to make the chart more seamless, I'd like my users be able to mouse from 4:00pm directly to 9:30am of the following day, without a huge span of no data.

Environment

  • Chart.js version: 2.5.0
  • Browser name and version: Chrome 58.0.3029.110 (64-bit)
  • Thanks!
@etimberg
Copy link
Member

@dandip would #4189 solve your issue? We're hoping to target it to v2.7

@dandip
Copy link
Author

dandip commented May 21, 2017

@etimberg Yes, that definitely would. I've somewhat fixed it for now by using a category axis. The candlestick charts and OHLC would also be super useful. Excited to see this come to fruition.

Thanks!

@etimberg
Copy link
Member

Awesome. I went back through the old issues and found #2006 so I'm closing this in favour of the original one.

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

No branches or pull requests

2 participants