Our state of the art Gantt chart


Post by zhang »

Can gantt charts switch time dimensions, like calendar views, by week, month, season, year? Or can the same functionality be implemented in some other form?


Post by mats »

Can you please share some screenshots of the type of views you are looking for?


Post by zhang »

The link below is a screenshot of other Gantt chart products, and the areas marked in red are the ones I want. Can it be done?

https://sm.ms/image/5rIG9LiAkjEB86H


Post by alex.l »

Gantt has ViewPresets. It's set of zoom levels with some pre-defined set of headers. You can specify your own set or choose from pre-defined. Together with desired visible date range for timeAxis (startDate/endDate), I assume you will have that you want.
Links to docs:
https://bryntum.com/docs/gantt/api/Gantt/view/Gantt#config-viewPreset
https://bryntum.com/docs/gantt/api/Scheduler/preset/ViewPreset
https://bryntum.com/docs/gantt/api/Scheduler/preset/PresetManager
https://bryntum.com/docs/gantt/api/Scheduler/view/TimelineBase#function-setTimeSpan

All the best,
Alex


Post by zhang »

Which method can change the default viewpreset? I can't find the corresponding method in the document


Post by mats »


Post by zhang »

I may not be making myself clear, but I want the following effect:
By default viewPreset is weekandYear
When I click today, viewPreset is Hourandday
https://sm.ms/image/lnwbQihST2YzvOj


Post by zhang »

Or something like this:
Viewpreset is still WeekandYear when the user clicks "Today", but it rolls the current time back into visual range by default
https://sm.ms/image/Zdn5tCXAFSYMaBy


Post by alex.l »

By default viewPreset is weekandYear
When I click today, viewPreset is Hourandday

What problems you have to get that behaviour?
See example above how to change viewPreset:

gantt.viewPreset = 'dayAndWeek'

How to get scheduler instance?

There is misunderstanding because you code example we posted. You don't need scheduler instance since you use Gantt. instance in your code is that you need. The Gantt is based on the Scheduler, so mixin from Scheduler also available in Gantt.

Viewpreset is still WeekandYear when the user clicks "Today", but it rolls the current time back into visual range by default

Did you try https://bryntum.com/docs/gantt/api/Scheduler/view/TimelineBase#function-setTimeSpan ?
Or maybe
https://bryntum.com/docs/gantt/api/Scheduler/view/mixin/TimelineScroll#function-scrollToDate
https://bryntum.com/docs/gantt/api/Scheduler/view/mixin/TimelineScroll#function-scrollToNow

All the best,
Alex


Post Reply