Dynamic scales

Hi.

I’m using timeline view and I’m trying to achieve the same functionality as in docs.dhtmlx.com/gantt/samples/03 … cales.html

Do I need to instantiate 4 timeline views for each scale(day, week, month, year) ? How do I switch between these scales, so that primary and secondary scales are rendered correctly (height problems…)?

Thanks.

Hello,

Try to use the sample for solving your issue.
docs.dhtmlx.com/scheduler/snippet/bf00efa0
Please, give more info about functionality you want to implement, if the problem still occurs for you.

Hi Polina, this is exactly what I was talking about. It works nicely on primary+second scale.

I was thinking to remove the second scale, when ‘Day scale’ is clicked, no need to display the date twice: header+primary scale. Is this possible? When putting timeline.second_scale = false; the scale height does not adjust :astonished: docs.dhtmlx.com/scheduler/snippet/7f4ad846

Yes, it’s possible.
You need to recalculate the height of the X-Axis using scheduler.xy.scale_height (docs.dhtmlx.com/scheduler/api__s … other.html) and to create new second_scales where it’s needed:
timeline.second_scale = { … );

Sample:
docs.dhtmlx.com/scheduler/snippet/673a798b

Perfect! :smiley:

A have another question. After choosing ‘Month’ scale the start date shifts, I presume due to timeline.x_size=30
In month scale I’d like to show all days of the selected month. For example:
1 Jul 2009 – 31 Jul 2009 (not 1 Jul 2009 – 30 Jul 2009, not 31 Jul 2009 – 29 Aug 2009)

And when clicking previous/next button full month should appear (not shifted). For example:
1 Jan 2016 – 31 Jan 2016
1 Feb 2016 – 29 Feb 2016
1 Mar 2016 – 31 Mar 2016
1 Apr 2016 – 30 Apr 2016
etc.

Is there a simple way to choose ‘Full month’ timeline? Thanks.

Please, use this demo:
docs.dhtmlx.com/scheduler/sample … scale.html

:blush: sorry, I overlooked that example.

There’s another thing that’s bothering me. Is it possible to increment less than a day (8 hours)? docs.dhtmlx.com/scheduler/snippet/60ba4a9f

When clicking next button the timeline is not moving… take a look at: return scheduler.date.add(date, step*8, "hour");

If I increase the interval to one day (step*24) it works.

Also you need to change timeline.x_start:
docs.dhtmlx.com/scheduler/snippet/c8e7a780

Thank you for your help.