Skip to main content

Function: timeShading()

timeShading(rules): ChromePlugin

Defined in: extensions/features/time-shading.ts:125

Shades regions of the time axis under the bars — a weekend, after-hours, a holiday, a shutdown, whatever a rule's covers names. What a shaded region means is the consumer's; this plugin only paints it. A chrome plugin (no data half), id freegantt.timeShading, layer underBars always.

import { timeShading, daysOfWeek, hours, dates, spans, notCovered } from 'freegantt';

gantt.installPlugin(
timeShading([
{ covers: daysOfWeek(6, 7), class: 'weekend' },
{ covers: hours('17:00', '07:00'), class: 'after-hours' },
]),
);

Reconfiguring the shaded set is one assignment — gantt.plugins = [timeShading(next)] replaces the occupant of this id and paints the new rules (#404 review).

A predicate rule that closes over changing data (a consumer's own WorkSchedule) does not repaint when that object mutates in place: the decoration runner memoizes on the window, and mutating the schedule changes none of it. Assign the list again to repaint — a fresh timeShading() is a fresh provider, which is what makes the memo miss.

Parameters​

rules​

readonly ShadingRule[]

Returns​

ChromePlugin