Zoom into a specified date range

Is it possible to zoom into a specified date range without re-setting config.start_date and config.end_date?

By calling scrollTo(position, null) after finding the position of specified start_date? is there anyway to calculate the position of a given date?

We’re using dhtmlx gantt to replace our legacy gantt based on Flash. The flash one has a nice feature - zoom in a specified date range (show the user the timeline within that date range). It seems DHTMLX gantt is hard to get this kind feature.

Appreciated for a suggestion.

Hello Yong,
Yes, it is possible to do that by using dateFromPos() and posFromDate() methods:
https://docs.dhtmlx.com/gantt/api__gantt_datefrompos.html
https://docs.dhtmlx.com/gantt/api__gantt_posfromdate.html

Here is an example of how it might work:
http://snippet.dhtmlx.com/93b5c7404

And maybe you don’t even need to implement some function, because by default when you click on a task, Gantt scrolls to show that task.

Thanks, posFromDate() is working fine.
But I still struggle for zooming into specified date range to be similar to the legacy app.
The existing legacy app: user could specify a date range in app console, then the gantt chart will zoom into that date range but the user still could pan to move the chart left or right so the user can view the whole chart without re-setting date range.

WIth DTMLX gantt, is there anyway to display the chart within a date range without using config.start_date and end_date?

Hello Yong,
It is possible to change the scale unit and scroll to a certain position. It is not necessary to use the date range in that case.
However, there is no such feature that would allow scaling the chart in a different way.

Thanks, do you have any example to demo that dynamically changing scale unit fits into a given date range?

Hello Yong,
Here is “Zoom to fit” with “Scroll to …” sample:
http://snippet.dhtmlx.com/eafa14ba9

As you can see, it doesn’t reset start_date and end_date parameters.

If that is still not what you want, please send me a video with that functionality.