almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.86k stars 1.48k forks source link

Timeline major label drawing interval #4237

Open TivoSoho opened 5 years ago

TivoSoho commented 5 years ago

I am using the timeline feature as this does mostly everything we are after. I am however experiencing problems with major labels. This is part question (since maybe I am not aware of something), part feature request.

My issue is the following: I have set up formats as we use ISO date instead of weekday and long month names, which is the default. However the setup is confusing as major labels are not drawn at the frequency they should be. E.g. I would like to show minutes as :55, and then hourly major labels. Since I have zoom and otherwise like the auto labels, I cannot use a the timeAxis. Otherwise they would not fit at certain levels.

Proposed change: For every minorLabel, you draw a majorLabel at the next time if the label is different than previous. OR I can use a custom function and return false/null/undefined to not draw a label but the function itself must be execute at the next time slot (e.g. minor label minute, then it executes it every hour; minor label hour, it executes it every day)

Example 1: Timeline is drawn with minorLabel minute. The majorLabel minute format is: Y-MM-DD HH:00. It draws the majorLabel per every hour.

Example 2: Timeline is drawn with minorLabel minute. The majorLabel minute format is: Y-MM-DD. It draws the majorLabel per every day.

Edited to add: it can actually draw it per every minute and only show on difference so that you can also have it show lines say every 15 minutes if that is your desire. So majorLabels should execute per every minorLabel time unit.