Skip to content

Commit 760717d

Browse files
committed
[update] info on sticky labels & update constraints
1 parent 4dabe9f commit 760717d

File tree

5 files changed

+96
-6
lines changed

5 files changed

+96
-6
lines changed

data/api/gantt_auto_scheduling_config.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ auto_scheduling
44
@short:
55
enables auto scheduling
66

7-
@type: boolean
8-
@default:false
7+
@type: boolean | object
8+
@default: false
99
@example:
1010
gantt.config.auto_scheduling = true;
1111

@@ -19,6 +19,20 @@ gantt.init("gantt_here");
1919
{{note This config is defined in the **auto_scheduling** extension, so you need to activate the [auto_scheduling](desktop/extensions_list.md#autoscheduling) plugin. Read the details in the desktop/auto_scheduling.md article.}}
2020

2121

22+
The `auto_scheduling` config can be set as a boolean or as an object to enable additional control over the auto-scheduling behavior. When set as an object, the following options are available:
23+
24+
- **enabled** (*boolean*) - turns auto-scheduling on or off (same as using a boolean value directly).
25+
- **show_constraints** (*boolean*) - controls the display of task constraints on the Gantt chart. Set to `true` to display constraints or `false` to hide them.
26+
27+
For example, to enable auto-scheduling but disable the display of task constraints:
28+
29+
~~~js
30+
gantt.config.auto_scheduling = {
31+
enabled: true,
32+
show_constraints: false
33+
};
34+
gantt.init("gantt_here");
35+
~~~
2236

2337
@related:
2438
desktop/auto_scheduling.md

data/desktop/configuring_time_scale.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,3 +721,28 @@ And here is how it looks when they are shown (**gantt.config.skip_off_time** is
721721

722722
You can find detailed examples on how to implement an infinite scroll in the timeline in the [related](desktop/how_to.md#howtohaveaninfinitescrollinthetimeline) article.
723723

724+
## Sticky labels
725+
726+
Starting from v9.0, time scale labels are sticky by default. This means that when the width of a cell is significantly larger than the width of its label, the label will remain visible as you scroll through the timeline, staying attached to the viewport until it naturally scrolls off. This improves the visibility of scale labels, particularly when zoomed in or out.
727+
728+
To revert to the old behavior where labels are centered within their cells and do not remain visible while scrolling, you can disable sticky labels by setting the `sticky` property of the scale object to `false`:
729+
730+
~~~js
731+
gantt.config.scales = [
732+
{unit: "year", step: 1, format: "%Y", sticky: false},
733+
{unit: "month", step: 1, format: "%F", sticky: false},
734+
{unit: "day", step: 1, format: "%j", sticky: false}
735+
];
736+
gantt.init("gantt_here");
737+
~~~
738+
739+
You can also force sticky labels for a particular scale regardless of cell width by setting `sticky: true`. This will ensure the labels are always sticky, even when the label width is smaller than the cell width:
740+
741+
~~~js
742+
gantt.config.scales = [
743+
{unit: "year", step: 1, format: "%Y", sticky: true},
744+
{unit: "month", step: 1, format: "%F", sticky: true},
745+
{unit: "day", step: 1, format: "%j", sticky: true}
746+
];
747+
gantt.init("gantt_here");
748+
~~~

data/desktop/inbuilt_baselines.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,33 @@ and if it contains a valid date, the deadline element will be displayed in the t
240240

241241
### Task constraints
242242

243-
When [auto scheduling](desktop/auto_scheduling.md) is enabled and works in the Constraint mode (api/gantt_auto_scheduling_compatibility_config.md is set to *false*),
244-
Gantt will automatically display constraint dates in the chart.
243+
Starting from v9.0, when [auto scheduling](desktop/auto_scheduling.md) is enabled and works in Constraint mode (api/gantt_auto_scheduling_compatibility_config.md is set to *false*), Gantt will automatically display constraint dates in the chart.
244+
245+
~~~js
246+
gantt.parse({
247+
data: [
248+
{
249+
id: 1,
250+
text: "Task #1",
251+
start_date: "2025-04-04",
252+
duration: 4,
253+
constraint_date: "2025-04-04",
254+
constraint_type: "snet",
255+
parent: 0
256+
},
257+
// Additional tasks
258+
]
259+
})
260+
~~~
261+
262+
The display of constraints can be controlled using the `display_constraints` option in the api/gantt_auto_scheduling_config.md config. By default, constraints are shown, but you can disable them by setting `display_constraints` to `false`:
263+
264+
~~~js
265+
gantt.config.auto_scheduling = {
266+
enabled: true,
267+
display_constraints: false
268+
};
269+
~~~
245270

246271
{{sample 02_extensions/19_constraints_scheduling.html}}
247272

data/migrating.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,35 @@ you can use the corresponding confguration options: api/gantt_baselines_config.m
148148
// disabling the built-in baselines functionality
149149
gantt.config.baselines = false;
150150

151-
// disabling the built-in deadlines and constraints functionality
151+
// disabling the built-in deadlines functionality
152152
gantt.config.deadlines = false;
153153
~~~
154154

155+
Built-in display of task constraints can also be disabled using the extended api/gantt_autoscheduling_config.md config:
156+
157+
~~~js
158+
gantt.config.auto_scheduling = {
159+
enabled: true,
160+
show_constraints: false
161+
};
162+
~~~
163+
164+
This disables the default display of task constraints while still keeping auto-scheduling functionality active.
165+
166+
### Sticky labels in the Timeline
167+
168+
Starting from v9.0, time scale labels are sticky by default. This means the labels stay visible on the screen as you scroll, following the viewport until they scroll off naturally. In previous versions, labels were centered within their cells and did not remain visible while scrolling.
169+
170+
If you need to revert to the old behavior and disable sticky labels, you can set the `sticky` property of the [scale](desktop/configuring_time_scale.md) object to false:
171+
172+
~~~js
173+
gantt.config.scales = [
174+
{unit: "year", step: 1, format: "%Y", sticky: false},
175+
{unit: "month", step: 1, format: "%F", sticky: false},
176+
{unit: "day", step:1, format: "%j", sticky: false}
177+
];
178+
~~~
179+
155180
### Promise implementation
156181

157182
The **Bluebird** library has been excluded from the Gantt bundle. api/gantt_promise.md now uses the native Promise implementation.

data/whatsnew.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If your current version of dhtmlxGantt is older than 2.0, check migrating.md for
1313
<b>9.0</b>
1414
---------------
1515

16-
<span class='release_date'>October 18, 2024. Major update</span>
16+
<span class='release_date'>October 17, 2024. Major update</span>
1717

1818
[Review of release on the blog](https://dhtmlx.com/blog/dhtmlx-gantt-9-0/)
1919

@@ -28,6 +28,7 @@ This update brings some changes in the structure of the Gantt package and behavi
2828
- New [Dark skin](desktop/skins.md#darkskin) is introduced
2929
- Built-in support for [Baselines](desktop/baselines.md) is added
3030
- [Manually Scheduled Summary tasks](desktop/custom_projects_dates.md) are now supported
31+
- [Sticky labels for time scales](desktop/configuring_time_scale.html#stickylabels)
3132

3233
### Updates
3334

0 commit comments

Comments
 (0)