Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Timeline: Control the scale(s) and step(s) of both major and minor gridlines, independently #3323

Open
ShawnMercado opened this issue Jul 31, 2017 · 6 comments

Comments

@ShawnMercado
Copy link

I've been using this library for a few weeks now, and while it works well for most use cases, not having direct control over when gridlines is drawn can limit the usefulness or force the user to compromise.

I'm pretty sure what I'm asking for is not a feature right now, but if I'm wrong about that please let me know.

First, I think at the very least the showMajorLabels option, when false, should prevent drawing major gridlines. Currently, for instance, if you set your timeline to the week scale, there will still be lines drawn at the month boundaries even when hiding the major labels. Months do not follow naturally from weeks, and there are plenty of use cases where all you may care about is weeks, and all the month lines do is add clutter.

(This is a problem I'm trying to find a workaround for right now, so if anyone has any suggestions, please let me know).

But even better would be if I could control exactly when a major gridline is drawn in the first place.

Currently, you can set a fixed scale by adding an option like this:

options = { timeAxis: { scale: 'day', step: 1, }

It would be far more useful if I could set this both for the minor lines and the major lines. So a really obvious example would be like (and this is just an example, i don't know how it would actually be implemented):

options = { timeAxis: { minorLines: { scale: 'day', step: 1 }, majorLines: { scale: 'week', step: 1, }, } }

Another example might be single days for minor lines and then 30 days for major lines (I have a client who specifically plans work in this manner, actually).

But there's another thing, with the current implementation, you can only set one scale/step and then you lose a lot of what makes the library useful. It would be super, duper nice if we could define an array of scale combinations somehow, and that zooming the timeline would simply cycle through these predefined scales. I know that might be asking a lot but currently the zoom functionality is just not that useful if you have to go away from the default scaling.

@ponml
Copy link
Contributor

ponml commented Aug 1, 2017

Hey @ShawnMercado, I have a PR up right now that I believe addresses the week/month major label issue:
#3305
original issue: #3246

@ShawnMercado
Copy link
Author

@ponml oh cool. that will be very helpful when available.

@marcortw
Copy link
Contributor

@ShawnMercado I absolutely agree with you - I too would love to have more control over the minorLines and majorLines as well as the labels. I originally wrote the week style PR (#3009) and wasn't fully satisfied either - it was just a mere start to at least have a basic week feature. However, I think it would mean a major refactoring of TimeStep.js and how it is called. Quite a lot of work, and I don't have the time for that currently. Any volunteers?

@knokit
Copy link
Contributor

knokit commented Oct 11, 2017

Hey,
I've added a PR that adds week to the zooming and moves the majorLabels to the first week in the months - #3549

@avrahamcool
Copy link

you had a lot of good ideas here,

  1. controlling the major/minor steps independently
  2. setting an array of scale combinations - zooming the timeline would simply cycle through these predefined scales.

it would be very helpful if they get done.
I'd like to try to accomplish that - can an expert from the community help in identifying where is best to begin? [I'm not very familiar in the code base - but would like to create a PR for that]

@marcortw
Copy link
Contributor

That would be great! I think TimeStep.js is the place to get started. It might be difficult though to implement it without breaking changes from what I remember from when I worked on it. Maybe it's good to discuss this with somebody who's more familiar with the code base and who could also review and merge the PR. Maybe @yotamberk ?

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

No branches or pull requests

6 participants