VibeFox JS Gantt — Demo
Inicio rápido
HTML puro
Una tarea resumen con sus subtareas, un hito, vínculos, solo días laborables y la ruta crítica. Arrastre la barra Build hacia la derecha: Testing y Launch se desplazan con ella.
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,
});Conceptos básicos
Eventos
Cada cambio se notifica como un evento con un único objeto de carga útil; los últimos aparecen bajo el gráfico. Mueva o redimensione una barra, arrastre su controlador de progreso o haga clic en una fila.
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));Instantáneas del estado
Guarde la vista y, después, cambie el zoom, contraiga la tarea resumen u ordene por una columna, y restáurela: getState() / setState() devuelven el zoom, las filas contraídas, el orden y el desplazamiento.
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());Deshacer y rehacer
Mueva algunas barras o cambie una duración en la tabla; después use Undo y Redo para deshacer y rehacer los pasos con los botones, la barra de herramientas o con 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());Tareas y vínculos
Trabajo con tareas
Haga clic en una fila y use los botones: añadir una tarea después de ella, aumentar su nivel bajo la tarea superior, reducir su nivel o eliminarla.
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));Vínculos
Los cuatro tipos de vínculo: fin a inicio con un retardo de 1 día, inicio a inicio, fin a fin e inicio a fin. Arrastre desde el punto al final de una barra hasta otra barra para añadir un vínculo.
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,
});Tareas divididas
Build se divide en dos segmentos de trabajo con una pausa; Painting se divide con splitTask(). Arrastre un segmento a lo largo de la línea de tiempo.
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 laterProgramación
Programación automática y tiempo laborable
Las duraciones se expresan en días laborables y los fines de semana aparecen sombreados. Alargue Design arrastrando el extremo de su barra: Build, Testing y Launch se desplazan y saltan el fin de semana.
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,
});Tareas por horas
Las tareas planificadas en horas dentro de la jornada laboral 08:00–12:00 y 13:00–17:00, con el zoom por horas. Arrastre una barra: se ajusta a intervalos de 15 minutos y omite la pausa del almuerzo y la noche.
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');Restricciones y fechas límite
Testing no puede empezar antes del 5 de noviembre (SNET), y su fecha límite es el 5 de noviembre: las marcas muestran la restricción y la fecha límite incumplida, y los conflictos se enumeran bajo el gráfico. Arrastre Testing hacia la izquierda: la fecha de restricción se mueve con ella (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();Ruta crítica, holgura y salud de la programación
Las barras rojas determinan el fin del proyecto; la parte con trama rayada tras Content es su holgura. Si alarga Content más de su holgura, también se vuelve crítica.
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();Calendarios
El calendario del proyecto «Office» tiene un día festivo el 2 de noviembre y un viernes con jornada reducida; la tarea Server move usa su propio calendario, que también funciona los sábados. Los días festivos se sombrean y las duraciones los omiten: Migration dura 4 días laborables alrededor del festivo.
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,
});Recursos y nivelación
Recursos y asignaciones
El panel de recursos bajo el gráfico muestra la carga de cada persona; Eva trabaja en Content y Review al mismo tiempo y está sobrecargada (en rojo). Arrastre Review más tarde para eliminar la sobrecarga.
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,
});Nivelación de recursos
Eva está sobrecargada. Preview muestra las fechas propuestas como barras fantasma y el informe; Apply mueve las tareas y Undo las devuelve a su posición.
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 = ''; });Edición
Haga doble clic en un nombre para editarlo en la tabla, haga doble clic en una barra para abrir el editor de tareas (con un campo adicional Owner) y haga clic con el botón derecho en una barra para abrir el menú contextual con un elemento adicional.
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'); } }],
},
});Línea de tiempo y vistas
Zoom y desplazamiento
Elija una escala de horas a trimestres, o use la barra de herramientas flotante del gráfico; los botones desplazan la vista hasta una tarea o una fecha.
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'));Tabla
Números de EDT (WBS), columnas elegidas con los recursos, formato de fecha día.mes y una tabla más ancha. Arrastre el separador entre la tabla y el gráfico; haga clic en un encabezado para ordenar.
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,
});Qué muestra la línea de tiempo
Las líneas base (las fechas planificadas) bajo las barras, los fines de semana y el modo de enfoque: haga clic en Build para atenuar todo lo que queda fuera de su cadena de dependencias; vuelva a hacer clic para salir.
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,
});Línea de progreso, curva en S y PERT
La línea de progreso a partir de la fecha de estado del 30 de octubre muestra qué tareas van retrasadas (a la izquierda) o adelantadas. Cambie la vista a la red PERT o a la curva en 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);Filtrado, ordenación y búsqueda
Muestre solo las tareas de una persona (su tarea resumen se mantiene como contexto), ordene por una columna o busque en los nombres: las filas encontradas se resaltan.
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);Escenarios «qué pasaría si»
El escenario «Faster build» reduce Build a 2 días y vuelve a programar el plan, sin tocar el plan principal; las barras fantasma muestran el plan principal y la línea bajo el gráfico muestra la diferencia. Cambie entre los planes.
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); });Sincronización con el servidor
El gestor CRUD carga el plan y envía cada cambio en un lote; aquí el servidor es una función simulada en el ejemplo (transport), así que las solicitudes se enumeran bajo el gráfico. Mueva una barra o añada una tarea.
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');Asistente
El asistente entiende comandos sin conexión a un servidor. Aquí «move Build by 2 days» se muestra como una vista previa con barras fantasma; haga clic en ✦ en la barra de herramientas para ver la respuesta con los botones Apply y Cancel, o escriba su propio comando, por ejemplo «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 itPlanes grandes
10 000 tareas en 500 grupos con vínculos: solo se dibujan las filas visibles y la parte visible de la línea de tiempo. Desplácese por la tabla o por el gráfico.
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: vistas y eventos
Vistas y navegación
La vista mensual con un mapa de calor de los días ocupados. Cambie la vista y el período en la barra de herramientas: mes, semana, día, agenda, año.
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'],
});Eventos
Arrastre sobre un hueco libre para crear un evento, arrástrelo para moverlo, arrastre su borde inferior para cambiar su tamaño, haga clic en él para editarlo. El último cambio aparece bajo el calendario.
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 + ')'; });Adición rápida, huecos libres y conflictos
Dos eventos se solapan el miércoles y reciben marcas de conflicto. Escriba un evento en el campo de adición rápida de la barra de herramientas, por ejemplo «Lunch 12:00-13:00 #green», o busque la primera hora libre.
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: recurrencia y zonas horarias
Eventos recurrentes
Una reunión de junta directiva el segundo lunes de cada mes, una sincronización semanal los martes y jueves sin una única fecha, y un control diario. Haga clic en una ocurrencia para cambiarla, solo esa o las siguientes.
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',
});Zonas horarias
El calendario se muestra en hora de Berlín, con una segunda escala horaria para Nueva York; la llamada se guarda en hora de Nueva York y aparece a la hora correcta de Berlín.
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: recursos y línea de tiempo
La vista de línea de tiempo: una fila por recurso, agrupada por equipo; Ann está de vacaciones el viernes (sombreado). Arrastre un evento a otra fila para asignarlo a otro recurso.
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' },
],
});Calendarios compartidos con un Gantt
El Scheduler bajo el plan sigue los calendarios del Gantt: el festivo del 28 de octubre aparece sombreado en ambos y Planning lo omite. Los festivos añadidos al Gantt también aparecen en el 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: importación, exportación e impresión
Los eventos leídos de texto iCalendar con importICS(), incluida una regla semanal; los botones exportan el calendario como archivo .ics, PNG o 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' }));Temas y estilos
Temas
Elija un tema en la lista sobre el gráfico: los integrados claro, oscuro y de alto contraste, o un tema de vibefox-js-themes.css (enlazado aquí).
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);Variables CSS
Filas más altas, un encabezado coloreado, barras verdes y una ruta crítica roja, definidos como variables CSS solo de este gráfico (en el style de su elemento; una regla CSS para el elemento funciona igual).
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 });Estilos listos para usar
Elija uno de los cinco estilos listos para usar; cada estilo funciona con todos los temas y densidades.
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);Densidad y tamaño
Cambie la densidad del contenedor: filas y rellenos compactos, normales o cómodos.
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);Localización y RTL
Idiomas
Ruso desde el paquete de idioma vibefox-js-gantt.ru.js, cargado después de la biblioteca: encabezados de la tabla, la escala temporal y la barra de herramientas. Cambie el idioma en la lista.
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);Derecha a izquierda (RTL)
Con rtl: true la tabla queda a la derecha y la línea de tiempo va de derecha a izquierda.
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 });Accesibilidad
Teclado
Haga clic en una fila y después use las teclas: ↑ ↓ eligen una tarea, → ← expanden y contraen, Enter abre el editor. Pulse Tab para llegar a la línea de tiempo: ← → mueven la barra, Shift+← → cambian su extremo, L inicia un vínculo.
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 });