zoom prop lets users change the time scale by holding Ctrl and scrolling the
mouse wheel over the chart area. It accepts either a boolean flag for simple enablement
or a detailed configuration object.
Enable zoom
Passing the barezoom attribute (equivalent to zoom={true}) activates zooming with
default settings. The Gantt automatically builds zoom levels from the current scales
configuration:
Listening to zoom changes
Thezoom-scale event fires whenever the user changes the zoom level:
Advanced zoom configuration
Pass anIZoomConfig object for full control over zoom levels. The following example
is taken from the zoomConfig demo data:
IZoomConfig fields
Index into the
levels array that is active on initial render. When omitted, the
Gantt picks the level whose minimum unit matches the current scales configuration.Global minimum cell width in pixels applied to all levels that do not specify their
own
minCellWidth. Prevents cells from becoming too narrow when zooming out.Global maximum cell width in pixels applied to all levels that do not specify their
own
maxCellWidth. Prevents cells from becoming too wide when zooming in.Ordered list of zoom levels. Each scroll step moves one level up or down the array.
When omitted, levels are auto-generated from the built-in time units
(
year → quarter → month → week → day → hour).IScaleLevel fields
The scale rows active at this zoom level. Uses the same format as the top-level
scales prop.Minimum cell width for this level. Overrides the global
IZoomConfig.minCellWidth
for this specific level.Maximum cell width for this level. Overrides the global
IZoomConfig.maxCellWidth
for this specific level.When
zoom={true} is used without explicit levels, the Gantt automatically creates one
level per built-in time unit. Custom scale formats provided in the scales prop are
preserved and reused at the corresponding zoom level.