VibeFox JS Gantt — Демо
Швидкий старт
Звичайний HTML
Підсумкове завдання з його підзавданнями, віха, зв'язки, лише робочі дні та критичний шлях. Перетягніть смугу Build праворуч: Testing і Launch зсуваються разом із нею.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', {
...look,
data: tasks,
links,
resources,
workdaysOnly: true,
showCriticalPath: true,
});Основні поняття
Події
Кожна зміна передається як подія з одним об'єктом payload; останні з них перелічено під діаграмою. Перемістіть або змініть розмір смуги, перетягніть її маркер прогресу або клацніть рядок.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const out = document.createElement('p');
document.getElementById('app').after(out);
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true });
const say = (text) => { out.textContent = text; };
say('Events appear here.');
gantt.on('taskChange', (e) => e.task && say('taskChange: ' + e.task.name + ' ' + e.task.start + ' – ' + e.task.end + ' (' + e.source + ')'));
gantt.on('progressChange', (e) => e.task && say('progressChange: ' + e.task.name + ' ' + e.task.progress + '%'));
gantt.on('selectionChange', (e) => say('selectionChange: ' + (e.task ? e.task.name : 'none')));
gantt.on('dependencyCreate', (e) => say('dependencyCreate: ' + e.link.from + ' → ' + e.link.to + ' ' + e.link.type));Знімки стану
Збережіть вигляд, потім змініть масштаб, згорніть підсумкове завдання або відсортуйте за стовпцем і відновіть його: getState() / setState() повертають масштаб, згорнуті рядки, сортування та прокручування.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true });
let saved = gantt.getState();
button('Save view', () => { saved = gantt.getState(); });
button('Restore view', () => gantt.setState(saved));
button('Zoom out', () => gantt.zoomOut());
button('Collapse all', () => gantt.collapseAll());Відміна та повтор
Перемістіть кілька смуг або змініть тривалість у таблиці, а потім відмініть та повторіть кроки кнопками, панеллю інструментів або клавішами Ctrl+Z / Ctrl+Y.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true });
button('Undo', () => gantt.undo());
button('Redo', () => gantt.redo());Завдання і зв'язки
Робота із завданнями
Клацніть рядок і скористайтеся кнопками: додайте завдання після нього, зробіть його вкладеним у завдання вище, поверніть на рівень вище або видаліть.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true });
let selected = null;
gantt.on('selectionChange', (e) => { selected = e.task ? e.task.id : null; });
let n = 0;
button('Add task', () => {
const after = selected != null ? gantt.getTask(selected) : null;
const task = { name: 'New task ' + (++n), parent: after ? after.parent : 1, start: after ? after.start : '2026-10-26', duration: 2 };
gantt.addTask(task, after ? { after: selected } : undefined);
});
button('Indent', () => selected != null && gantt.indentTask(selected));
button('Outdent', () => selected != null && gantt.outdentTask(selected));
button('Remove', () => selected != null && gantt.removeTask(selected));Зв'язки
Чотири типи зв'язків: «завершення — початок» із затримкою 1 день, «початок — початок», «завершення — завершення» та «початок — завершення». Щоб додати зв'язок, перетягніть від крапки в кінці смуги до іншої смуги.
const gantt = VibeFoxJSGantt.createGantt('#app', {
data: [
{ id: 1, name: 'Foundation', start: '2026-10-26', duration: 2 },
{ id: 2, name: 'Walls (FS +1)', start: '2026-10-29', duration: 3 },
{ id: 3, name: 'Wiring (SS)', start: '2026-10-29', duration: 2 },
{ id: 4, name: 'Inspection (FF)', start: '2026-10-30', duration: 2 },
{ id: 5, name: 'Handover (SF)', start: '2026-10-29', duration: 2 },
],
links: [
{ from: 1, to: 2, type: 'FS', lag: 1 },
{ from: 2, to: 3, type: 'SS' },
{ from: 2, to: 4, type: 'FF' },
{ from: 4, to: 5, type: 'SF' },
],
workdaysOnly: true,
columns: ['name', 'duration'], gridWidth: 290,
});Розділення завдань
Build розділено на два робочі відрізки з перервою; Painting розділено за допомогою splitTask(). Перетягніть один відрізок уздовж часової шкали.
const gantt = VibeFoxJSGantt.createGantt('#app', {
data: [
{ id: 1, name: 'Design', start: '2026-10-26', duration: 2 },
{ id: 2, name: 'Build', segments: [{ start: '2026-10-28', duration: 2 }, { start: '2026-11-02', duration: 3 }] },
{ id: 3, name: 'Painting', start: '2026-10-28', duration: 4 },
],
links: [{ from: 1, to: 2 }],
workdaysOnly: true,
columns: ['name', 'duration'], gridWidth: 290,
});
gantt.splitTask(3, '2026-10-30', 1); // the rest starts 1 working day laterПланування
Автоматичне планування та робочий час
Тривалості вказано в робочих днях, вихідні заштриховано. Подовжте Design, перетягнувши кінець його смуги: Build, Testing і Launch зсуваються та пропускають вихідні.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', {
...look,
data: tasks,
links,
resources,
autoSchedule: true,
workdaysOnly: true,
workingDays: [1, 2, 3, 4, 5],
weekendHighlight: true,
});Завдання з годинами
Завдання, заплановані в годинах, у межах робочого часу 08:00–12:00 і 13:00–17:00, при масштабі за годинами. Перетягніть смугу: вона прив'язується до 15 хвилин і пропускає обідню перерву та нічний час.
const gantt = VibeFoxJSGantt.createGantt('#app', {
data: [
{ id: 1, name: 'Unpack the server', start: '2026-10-26 08:00', duration: 2, durationUnit: 'hour' },
{ id: 2, name: 'Install the system', start: '2026-10-26 10:00', duration: 3, durationUnit: 'hour' },
{ id: 3, name: 'Copy the data', start: '2026-10-26 14:00', duration: 4, durationUnit: 'hour' },
{ id: 4, name: 'Switch over', start: '2026-10-27 09:00', type: 'milestone' },
],
links: [{ from: 1, to: 2 }, { from: 2, to: 3 }, { from: 3, to: 4 }],
zoom: 0,
workdaysOnly: true,
workHours: ['08:00-12:00', '13:00-17:00'],
snapMinutes: 15,
columns: ['name', 'start', 'duration'], gridWidth: 375,
dateFormat: 'DD.MM',
});
gantt.scrollToDate('2026-10-26 08:00');Констрейнти та дедлайни
Testing не можна розпочати раніше 5 листопада (SNET), а його дедлайн — 5 листопада: позначки показують констрейнт і пропущений дедлайн, конфлікти перелічено під діаграмою. Перетягніть Testing ліворуч: дата констрейнта зміщується разом із ним (moveConstraintOnDrag).
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const out = document.createElement('p');
document.getElementById('app').after(out);
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, showConstraints: true });
gantt.setConstraint(5, 'SNET', '2026-11-05');
gantt.setDeadline(5, '2026-11-05');
const show = () => {
out.textContent = gantt.getConflicts().map((c) => c.kind + ' of ' + gantt.getTask(c.task).name + ': ' + c.date + ', finishes ' + c.required).join('; ') || 'No conflicts';
};
gantt.on('constraintConflict', show);
show();Критичний шлях, резерв часу та стан плану
Червоні смуги визначають завершення проєкту; штрихована частина після Content — її резерв часу. Зробіть Content довшим за його резерв часу, і він теж стане критичним.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const out = document.createElement('p');
document.getElementById('app').after(out);
const gantt = VibeFoxJSGantt.createGantt('#app', {
...look, data: tasks, links, resources, workdaysOnly: true,
showCriticalPath: true,
showSlack: true,
});
const show = () => {
const { slack } = gantt.getCriticalPath();
out.textContent = 'Slack of Content: ' + slack[3] + ' days. Schedule health: ' + gantt.getScheduleHealth().score + ' / 100';
};
gantt.on('taskChange', show);
show();Календарі
Календар проєкту «Office» має свято 2 листопада та скорочену п'ятницю; завдання Server move використовує власний календар, який також працює в суботу. Свята заштриховано, і тривалості їх пропускають: Migration займає 4 робочі дні, оминаючи свято.
const gantt = VibeFoxJSGantt.createGantt('#app', {
data: [
{ id: 1, name: 'Planning', start: '2026-10-26', duration: 2 },
{ id: 2, name: 'Migration', start: '2026-10-28', duration: 4 },
{ id: 3, name: 'Server move', start: '2026-10-28', duration: 4, calendar: 'weekend-shift' },
{ id: 4, name: 'Go live', start: '2026-11-04', type: 'milestone' },
],
links: [{ from: 1, to: 2 }, { from: 2, to: 4 }],
workdaysOnly: true,
calendars: [
{ id: 'office', name: 'Office', workingDays: [1, 2, 3, 4, 5], hours: ['09:00-13:00', '14:00-18:00'],
dayHours: { 5: ['09:00-14:00'] },
holidays: [{ date: '2026-11-02', name: 'Company day' }] },
{ id: 'weekend-shift', name: 'Weekend shift', parent: 'office', workingDays: [1, 2, 3, 4, 5, 6] },
],
calendar: 'office',
columns: ['name', 'calendar'], gridWidth: 340,
});Ресурси та вирівнювання
Ресурси та призначення
Панель ресурсів під діаграмою показує завантаження кожної людини; Eva працює над Content і Review одночасно й перевантажена (червоним). Перетягніть Review пізніше, щоб прибрати перевантаження.
const gantt = VibeFoxJSGantt.createGantt('#app', {
data: [
{ id: 1, name: 'Design', start: '2026-10-26', duration: 3, resources: ['ann'] },
{ id: 2, name: 'Content', start: '2026-10-26', duration: 4, resources: ['eva'] },
{ id: 3, name: 'Build', start: '2026-10-29', duration: 5, resources: ['bob', { id: 'ann', units: 50 }] },
{ id: 4, name: 'Review', start: '2026-10-28', duration: 2, resources: ['eva'] },
],
links: [{ from: 1, to: 3 }],
resources: [
{ id: 'ann', name: 'Ann', capacity: 100 },
{ id: 'bob', name: 'Bob', capacity: 100 },
{ id: 'eva', name: 'Eva', capacity: 100 },
],
workdaysOnly: true,
showResourceHistogram: true,
showResourceNames: true,
resourceColumns: ['name', 'peak', 'work'],
columns: ['name', 'duration', 'resources'], gridWidth: 430,
});Вирівнювання ресурсів
Eva перевантажена. Preview показує запропоновані дати як примарні смуги та звіт; Apply переміщує завдання, Undo повертає їх назад.
const gantt = VibeFoxJSGantt.createGantt('#app', {
data: [
{ id: 1, name: 'Content', start: '2026-10-26', duration: 3, resources: ['eva'] },
{ id: 2, name: 'Review', start: '2026-10-27', duration: 2, resources: ['eva'] },
{ id: 3, name: 'Translations', start: '2026-10-28', duration: 2, resources: ['eva'] },
{ id: 4, name: 'Build', start: '2026-10-26', duration: 5, resources: ['bob'] },
],
resources: [{ id: 'eva', name: 'Eva' }, { id: 'bob', name: 'Bob' }],
workdaysOnly: true,
showResourceHistogram: true,
columns: ['name', 'duration'], gridWidth: 290,
});
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const out = document.createElement('p');
document.getElementById('app').after(out);
button('Preview', () => { out.textContent = gantt.previewLeveling({ withinSlack: false }).text; });
button('Apply', () => { gantt.applyPreview(); out.textContent = 'Applied.'; });
button('Undo', () => { gantt.clearPreview(); gantt.undo(); out.textContent = ''; });Редагування
Двічі клацніть назву, щоб відредагувати її в таблиці; двічі клацніть смугу, щоб відкрити редактор завдання (з додатковим полем Owner); клацніть смугу правою кнопкою миші, щоб відкрити контекстне меню з додатковим пунктом.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const out = document.createElement('p');
document.getElementById('app').after(out);
tasks[4].owner = 'QA team';
const gantt = VibeFoxJSGantt.createGantt('#app', {
...look, data: tasks, links, resources, workdaysOnly: true,
cellEditing: true,
taskEditor: { fields: [{ field: 'owner', label: 'Owner', type: 'text', tab: 'general' }] },
contextMenu: {
task: [{ id: 'mail', label: 'Send to owner', action: (ctx) => { out.textContent = 'Send ' + ctx.task.name + ' to ' + (ctx.task.owner || 'nobody'); } }],
},
});Часова шкала та вигляди
Масштаб і прокручування
Оберіть масштаб від годин до кварталів або скористайтеся плаваючою панеллю інструментів на діаграмі; кнопки прокручують до завдання чи дати.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, zoom: 2 });
const zoom = document.createElement('select');
['Hours', 'Days', 'Weeks', 'Months', 'Quarters'].forEach((name, i) => zoom.add(new Option(name, i)));
zoom.value = 2;
zoom.onchange = () => gantt.setZoom(+zoom.value);
gantt.on('zoomChange', (e) => { zoom.value = e.zoom; });
bar.append(zoom, ' ');
button('Scroll to Launch', () => gantt.scrollToTask(6));
button('Scroll to 26 Oct', () => gantt.scrollToDate('2026-10-26'));Таблиця
Номери WBS, обрані стовпці з ресурсами, формат дат день.місяць і ширша таблиця. Перетягніть роздільник між таблицею та діаграмою; клацніть заголовок, щоб відсортувати.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', {
...look, data: tasks, links, resources, workdaysOnly: true,
columns: ['name', 'start', 'end', 'duration', 'progress', 'resources'],
showWBS: true,
dateFormat: 'DD.MM.YYYY',
gridWidth: 520,
});Що показує часова шкала
Базові плани (заплановані дати) під смугами, вихідні та режим фокусування: клацніть Build, щоб приглушити все поза ланцюжком його залежностей, клацніть ще раз, щоб вийти.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
tasks[1].baselineStart = '2026-10-26'; tasks[1].baselineEnd = '2026-10-27';
tasks[3].baselineStart = '2026-10-28'; tasks[3].baselineEnd = '2026-11-02';
tasks[4].baselineStart = '2026-11-03'; tasks[4].baselineEnd = '2026-11-04';
const gantt = VibeFoxJSGantt.createGantt('#app', {
...look, data: tasks, links, resources, workdaysOnly: true,
showBaseline: true,
weekendHighlight: true,
todayLine: true,
focusMode: true,
});Лінія прогресу, S-крива і PERT
Лінія прогресу від дати стану 30 жовтня показує, які завдання відстають (ліворуч) або випереджають графік. Перемкніть вигляд на мережу PERT або S-криву.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const gantt = VibeFoxJSGantt.createGantt('#app', {
...look, data: tasks, links, resources, workdaysOnly: true,
showProgressLine: true,
statusDate: '2026-10-30',
});
const view = document.createElement('select');
for (const v of ['gantt', 'pert', 'scurve']) view.add(new Option(v));
view.onchange = () => gantt.setView(view.value);
bar.append('View: ', view);Фільтрація, сортування та пошук
Показуйте лише завдання однієї людини (її підсумковий рядок залишиться як контекст), сортуйте за стовпцем або шукайте за назвами: знайдені рядки підсвічуються.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true });
const who = document.createElement('select');
for (const r of ['all', 'ann', 'bob', 'eva']) who.add(new Option(r));
who.onchange = () => (who.value === 'all' ? gantt.clearFilter()
: gantt.setFilter((t) => (t.resources || []).some((r) => r.id === who.value), { showAncestors: true }));
const sort = document.createElement('select');
for (const f of ['none', 'start', 'duration', 'name']) sort.add(new Option(f));
sort.onchange = () => (sort.value === 'none' ? gantt.clearSort() : gantt.setSort(sort.value, 'asc'));
const find = document.createElement('input');
find.placeholder = 'Search';
find.oninput = () => (find.value ? gantt.search(find.value) : gantt.clearSearch());
bar.append('Resource: ', who, ' Sort: ', sort, ' ', find);Сценарії «що якщо»
Сценарій «Faster build» скорочує Build до 2 днів і перепланує графік, не змінюючи основний план; примарні смуги показують основний план, а лінія під діаграмою — різницю. Перемикайтеся між планами.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const out = document.createElement('p');
document.getElementById('app').after(out);
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true });
const s = gantt.createScenario('Faster build', { activate: true });
gantt.updateTask(4, { duration: 2 });
gantt.scheduleProject({ compact: true }); // successors move earlier too
const diff = gantt.compareScenario(s.id);
out.textContent = 'Project end: ' + diff.projectEnd[0] + ' → ' + diff.projectEnd[1] + ' (' + diff.projectEndDelta + ' working days)';
button('Main plan', () => { gantt.setActiveScenario(null); gantt.clearComparison(); });
button('Faster build', () => { gantt.setActiveScenario(s.id); gantt.compareScenario(s.id); });Синхронізація з сервером
Менеджер CRUD завантажує план і надсилає кожну зміну пакетом; тут сервер — заглушка-функція в прикладі (transport), тому запити перелічено під діаграмою. Перемістіть смугу або додайте завдання.
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const out = document.createElement('p');
document.getElementById('app').after(out);
// a stub server instead of fetch(): a real app gives url: '/api/plan'
let nextId = 100;
const server = async (req) => {
if (req.type === 'load') {
return { status: 200, data: { success: true, revision: 1,
tasks: { rows: [
{ id: 1, name: 'Design', start: '2026-10-26', end: '2026-10-28' },
{ id: 2, name: 'Build', start: '2026-10-29', end: '2026-11-03' },
] },
dependencies: { rows: [{ id: 1, from: 1, to: 2, type: 'FS' }] } } };
}
const body = JSON.parse(req.body);
const t = body.tasks || {};
out.textContent = 'POST sync: ' + (t.added || []).length + ' added, ' + (t.updated || []).length + ' updated, ' + (t.removed || []).length + ' removed';
const rows = (t.added || []).map((r) => ({ $PhantomId: r.$PhantomId, id: nextId++ }));
if (rows.length) out.textContent += '; server ids ' + rows.map((r) => r.id).join(', ');
return { status: 200, data: { success: true, revision: body.revision + 1, tasks: { rows } } };
};
const gantt = VibeFoxJSGantt.createGantt('#app', {
workdaysOnly: true,
columns: ['name', 'duration'], gridWidth: 290,
crud: { transport: server, autoLoad: true, autoSyncDelay: 300 },
});
gantt.getCrudManager().on('syncStatusChange', (e) => { bar.lastChild.textContent = ' Status: ' + e.status; });
button('Add task', () => gantt.addTask({ name: 'New task', start: '2026-11-04', duration: 2 }));
bar.append(' Status: idle');Асистент
Асистент розуміє команди без мережевого зʼєднання. Тут команда «move Build by 2 days» показана як попередній перегляд із примарними смугами; клацніть ✦ на панелі інструментів, щоб побачити відповідь із кнопками Apply і Cancel, або введіть власну команду, наприклад «add task Docs 3 days after Testing».
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, assistant: true });
gantt.ask('move Build by 2 days'); // a preview: confirmAssistant() applies it, cancelAssistant() drops itВеликі плани
10 000 завдань у 500 групах із зв'язками: малюються лише видимі рядки та видима частина часової шкали. Прокрутіть таблицю або діаграму.
const data = [];
const links = [];
for (let g = 0; g < 500; g++) {
const parent = g * 20 + 1;
data.push({ id: parent, name: 'Group ' + (g + 1) });
for (let i = 1; i < 20; i++) {
const id = parent + i;
const day = 2 + ((g * 3 + i * 2) % 26);
data.push({ id, name: 'Task ' + id, parent, start: '2026-10-' + String(day).padStart(2, '0'), duration: 1 + (i % 4), progress: (i * 13) % 100 });
if (i > 1 && i % 3) links.push({ from: id - 1, to: id });
}
}
const gantt = VibeFoxJSGantt.createGantt('#app', {
data, links, virtualize: true, autoSchedule: false,
columns: ['name', 'duration'], gridWidth: 290,
});Scheduler: вигляди та події
Вигляди та навігація
Вигляд місяця з тепловою картою зайнятих днів. Перемикайте вигляд і період на панелі інструментів: month, week, day, agenda, year.
const events = [
{ id: 1, title: 'Stand-up', start: '2026-11-02 09:00', end: '2026-11-02 09:30', rrule: 'FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR' },
{ id: 2, title: 'Design review', start: '2026-11-03 11:00', end: '2026-11-03 12:30', color: 'green' },
{ id: 3, title: 'Client call', start: '2026-11-04 14:00', end: '2026-11-04 15:00', color: 'orange' },
{ id: 4, title: 'Workshop', start: '2026-11-05 10:00', end: '2026-11-05 13:00', color: 'purple' },
{ id: 5, title: 'Release', start: '2026-11-06', end: '2026-11-06', allDay: true, color: 'red' },
];
const calendar = VibeFoxJSGantt.createScheduler('#app', {
view: 'month',
date: '2026-11-04',
data: events,
showHeat: true,
views: ['month', 'week', 'day', 'agenda', 'year'],
});Події
Перетягніть у порожній проміжок, щоб створити подію, перетягніть подію, щоб перемістити її, перетягніть її нижній край, щоб змінити розмір, клацніть її, щоб відредагувати. Останню зміну показано під календарем.
const events = [
{ id: 1, title: 'Stand-up', start: '2026-11-02 09:00', end: '2026-11-02 09:30', rrule: 'FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR' },
{ id: 2, title: 'Design review', start: '2026-11-03 11:00', end: '2026-11-03 12:30', color: 'green' },
{ id: 3, title: 'Client call', start: '2026-11-04 14:00', end: '2026-11-04 15:00', color: 'orange' },
{ id: 4, title: 'Workshop', start: '2026-11-05 10:00', end: '2026-11-05 13:00', color: 'purple' },
{ id: 5, title: 'Release', start: '2026-11-06', end: '2026-11-06', allDay: true, color: 'red' },
];
const out = document.createElement('p');
document.getElementById('app').after(out);
const calendar = VibeFoxJSGantt.createScheduler('#app', {
view: 'week',
date: '2026-11-04',
data: events,
editable: true,
snapMinutes: 30,
dayStart: 8,
dayEnd: 18,
});
calendar.on('eventCreate', (e) => { out.textContent = 'eventCreate: ' + e.event.start + ' – ' + e.event.end; });
calendar.on('eventChange', (e) => { if (e.event) out.textContent = 'eventChange: ' + e.event.title + ' ' + e.event.start + ' – ' + e.event.end + ' (' + e.source + ')'; });Швидке додавання, вільні проміжки та конфлікти
Дві події перекриваються в середу і отримують позначки конфліктів. Введіть подію в поле швидкого додавання на панелі інструментів, наприклад «Lunch 12:00-13:00 #green», або знайдіть першу вільну годину.
const events = [
{ id: 1, title: 'Stand-up', start: '2026-11-02 09:00', end: '2026-11-02 09:30', rrule: 'FREQ=DAILY;BYDAY=MO,TU,WE,TH,FR' },
{ id: 2, title: 'Design review', start: '2026-11-03 11:00', end: '2026-11-03 12:30', color: 'green' },
{ id: 3, title: 'Client call', start: '2026-11-04 14:00', end: '2026-11-04 15:00', color: 'orange' },
{ id: 4, title: 'Workshop', start: '2026-11-05 10:00', end: '2026-11-05 13:00', color: 'purple' },
{ id: 5, title: 'Release', start: '2026-11-06', end: '2026-11-06', allDay: true, color: 'red' },
];
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const out = document.createElement('p');
document.getElementById('app').after(out);
events.push({ id: 6, title: 'Budget', start: '2026-11-04 14:30', end: '2026-11-04 15:30', color: 'teal' });
const calendar = VibeFoxJSGantt.createScheduler('#app', {
view: 'week', date: '2026-11-04', data: events, dayStart: 8, dayEnd: 18,
quickAdd: true,
showConflicts: true,
});
button('Find a free hour', () => {
const slot = calendar.findFreeSlot(60, { from: '2026-11-04', withinDays: 5 });
out.textContent = slot ? 'Free: ' + slot.start + ' – ' + slot.end : 'No free slot';
});Scheduler: повторення та часові пояси
Повторювані події
Засідання правління щомісяця в другий понеділок, щотижнева синхронізація у вівторок і четвер без кінцевої дати та щоденний check-in. Клацніть на повторення, щоб змінити його — цей або наступні.
const calendar = VibeFoxJSGantt.createScheduler('#app', {
view: 'month',
date: '2026-11-04',
data: [
{ id: 'board', title: 'Board', start: '2026-11-09 10:00', end: '2026-11-09 12:00', rrule: { freq: 'monthly', byDay: '2MO', count: 10 }, color: 'purple' },
{ id: 'sync', title: 'Sync', start: '2026-11-03 15:00', end: '2026-11-03 15:30', rrule: 'FREQ=WEEKLY;BYDAY=TU,TH', exdate: ['2026-11-19 15:00'], color: 'teal' },
{ id: 'check', title: 'Check-in', start: '2026-11-16 09:00', end: '2026-11-16 09:15', rrule: 'FREQ=DAILY;COUNT=5', color: 'orange' },
],
recurrenceEditMode: 'ask',
});Часові пояси
Календар показано за берлінським часом із другою шкалою годин для Нью-Йорка; дзвінок зберігається за нью-йоркським часом і відображається в потрібну берлінську годину.
const calendar = VibeFoxJSGantt.createScheduler('#app', {
view: 'week',
date: '2026-11-04',
timeZone: 'Europe/Berlin',
secondTimeZone: 'America/New_York',
dayStart: 8,
dayEnd: 20,
data: [
{ id: 1, title: 'Team meeting', start: '2026-11-03 10:00', end: '2026-11-03 11:00' },
{ id: 2, title: 'Call with New York', start: '2026-11-04 10:00', end: '2026-11-04 11:00', timeZone: 'America/New_York', color: 'orange' },
],
});Scheduler: ресурси та часова шкала
Вигляд timeline: один рядок на ресурс, згруповано за командами; Ann перебуває у відпустці в п'ятницю (заштриховано). Перетягніть подію на інший рядок, щоб передати її іншому ресурсу.
const calendar = VibeFoxJSGantt.createScheduler('#app', {
view: 'timeline',
date: '2026-11-04',
timelineScale: 'week',
resourceGroupBy: 'team',
resources: [
{ id: 'r1', name: 'Room A', team: 'Rooms' },
{ id: 'r2', name: 'Room B', team: 'Rooms' },
{ id: 'ann', name: 'Ann', team: 'People', unavailable: [{ start: '2026-11-06', name: 'Vacation' }] },
{ id: 'bob', name: 'Bob', team: 'People' },
],
data: [
{ id: 1, title: 'Workshop', start: '2026-11-03 10:00', end: '2026-11-03 16:00', resource: ['r1', 'ann'] },
{ id: 2, title: 'Interviews', start: '2026-11-04 09:00', end: '2026-11-04 17:00', resource: 'r2', color: 'green' },
{ id: 3, title: 'Training', start: '2026-11-05 09:00', end: '2026-11-05 17:00', resource: 'bob', color: 'orange' },
],
});Календарі, спільні з Gantt
Scheduler під планом слідує календарям Gantt: свято 28 жовтня заштриховано в обох, і Planning його пропускає. Свята, додані в Gantt, також з'являються в Scheduler.
const app = document.getElementById('app');
const plan = document.createElement('div');
const week = document.createElement('div');
plan.style.height = '160px';
app.append(plan, week);
const gantt = VibeFoxJSGantt.createGantt(plan, {
data: [
{ id: 1, name: 'Planning', start: '2026-10-26', duration: 3 },
{ id: 2, name: 'Build', start: '2026-10-29', duration: 4 },
],
links: [{ from: 1, to: 2 }],
workdaysOnly: true,
holidays: [{ date: '2026-10-28', name: 'Company day' }],
columns: ['name', 'duration'], gridWidth: 290,
});
const calendar = VibeFoxJSGantt.createScheduler(week, {
view: 'week', date: '2026-10-28', dayStart: 8, dayEnd: 14,
data: [{ id: 1, title: 'Planning meeting', start: '2026-10-27 09:00', end: '2026-10-27 10:30' }],
});
calendar.useGanttCalendars(gantt, { follow: true, resources: true });Scheduler: імпорт, експорт і друк
Події зчитуються з тексту iCalendar методом importICS(), зокрема з щотижневим правилом; кнопки експортують календар у файл .ics, PNG або PDF.
const bar = document.createElement('p');
document.getElementById('app').before(bar);
const button = (label, onclick) => { const b = document.createElement('button'); b.textContent = label; b.onclick = onclick; bar.append(b, ' '); };
const calendar = VibeFoxJSGantt.createScheduler('#app', { view: 'week', date: '2026-11-04', dayStart: 8, dayEnd: 18 });
const ics = [
'BEGIN:VCALENDAR', 'VERSION:2.0', 'PRODID:-//Example//EN',
'BEGIN:VEVENT', 'UID:1@example', 'SUMMARY:Planning', 'DTSTART:20261102T100000', 'DTEND:20261102T113000',
'RRULE:FREQ=WEEKLY;BYDAY=MO', 'END:VEVENT',
'BEGIN:VEVENT', 'UID:2@example', 'SUMMARY:Customer visit', 'DTSTART:20261104T130000', 'DTEND:20261104T160000', 'END:VEVENT',
'END:VCALENDAR',
].join('\r\n');
calendar.importICS(ics);
button('Export .ics', () => calendar.exportICS('week.ics'));
button('Export PNG', () => calendar.exportPNG('week.png'));
button('Export PDF', () => calendar.exportPDF('week.pdf', { pageSize: 'A4' }));Теми та стилізація
Теми
Оберіть тему у списку над діаграмою: вбудовану світлу, темну або висококонтрастну чи тему з vibefox-js-themes.css (підключений тут).
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, showCriticalPath: true });
const picker = document.createElement('select');
for (const name of ['light', 'dark', 'high-contrast', 'paper', 'ocean', 'forest', 'sunset', 'glass', 'graphite-dark']) picker.add(new Option(name));
picker.onchange = () => gantt.setTheme(picker.value);
document.getElementById('app').before(picker);CSS-змінні
Вищі рядки, кольоровий заголовок, зелені смуги та червоний критичний шлях, задані як CSS-змінні лише для цієї діаграми (у style її елемента; CSS-правило для елемента працює так само).
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
document.getElementById('app').style.cssText = `
--vfjs-gantt-row-height: 40px;
--vfjs-gantt-header-bg: #1e3a8a;
--vfjs-gantt-header-fg: #ffffff;
--vfjs-gantt-scale-fg: #ffffff;
--vfjs-gantt-bar-bg: #16a34a;
--vfjs-gantt-critical: #dc2626;`;
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, showCriticalPath: true });Готові стилі
Оберіть один із п'яти готових стилів; кожен стиль працює з будь-якою темою та щільністю.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, style: 'rounded' });
const picker = document.createElement('select');
for (const name of VibeFoxJSGantt.GANTT_STYLES) picker.add(new Option(name));
picker.value = 'rounded';
picker.onchange = () => gantt.setOptions({ style: picker.value });
document.getElementById('app').before(picker);Щільність і розмір
Перемикайте щільність контейнера: компактні, звичайні або комфортні рядки й відступи.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const app = document.getElementById('app');
app.setAttribute('data-vfjs-density', 'compact');
const gantt = VibeFoxJSGantt.createGantt(app, { ...look, data: tasks, links, resources, workdaysOnly: true });
const picker = document.createElement('select');
for (const name of ['compact', 'normal', 'comfortable']) picker.add(new Option(name));
picker.onchange = () => app.setAttribute('data-vfjs-density', picker.value);
app.before(picker);Локалізація та RTL
Мови
Російська з мовного пакета vibefox-js-gantt.ru.js, який завантажується після бібліотеки: заголовки таблиці, шкала часу та панель інструментів. Перемкніть мову у списку.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, locale: 'ru' });
const picker = document.createElement('select');
for (const name of ['ru', 'en']) picker.add(new Option(name));
picker.onchange = () => gantt.setOptions({ locale: picker.value });
document.getElementById('app').before(picker);Справа наліво (RTL)
З rtl: true таблиця розташовується праворуч, а часова шкала йде справа наліво.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, rtl: true });Доступність
Клавіатура
Клацніть рядок, а потім скористайтеся клавішами: ↑ ↓ вибирають завдання, → ← розгортають і згортають, Enter відкриває редактор. Перейдіть клавішею Tab до часової шкали: ← → переміщують смугу, Shift+← → змінюють її кінець, L починає зв'язок.
const tasks = [
{ id: 1, name: 'Website' },
{ id: 2, name: 'Design', parent: 1, start: '2026-10-26', duration: 3, progress: 100, resources: ['ann'] },
{ id: 3, name: 'Content', parent: 1, start: '2026-10-26', duration: 4, progress: 50, resources: ['eva'] },
{ id: 4, name: 'Build', parent: 1, start: '2026-10-29', duration: 4, progress: 25, resources: ['bob'] },
{ id: 5, name: 'Testing', parent: 1, start: '2026-11-04', duration: 2, resources: ['eva'] },
{ id: 6, name: 'Launch', parent: 1, start: '2026-11-06', type: 'milestone' },
];
const links = [{ from: 2, to: 4 }, { from: 4, to: 5 }, { from: 3, to: 5 }, { from: 5, to: 6 }];
const resources = [{ id: 'ann', name: 'Ann' }, { id: 'bob', name: 'Bob' }, { id: 'eva', name: 'Eva' }];
const look = { columns: ['name', 'duration'], gridWidth: 290 }; // a narrow table
const gantt = VibeFoxJSGantt.createGantt('#app', { ...look, data: tasks, links, resources, workdaysOnly: true, keyboard: true });