/*
Simple demo showing some interactivity options of Highcharts Gantt. More
custom behavior can be added using event handlers and API calls. See
http://api.highcharts.com/gantt.
*/
var today = new Date(),
day = 1000 * 60 * 60 * 24,
each = Highcharts.each,
reduce = Highcharts.reduce,
btnShowDialog = document.getElementById('btnShowDialog'),
btnRemoveTask = document.getElementById('btnRemoveSelected'),
btnAddTask = document.getElementById('btnAddTask'),
btnCancelAddTask = document.getElementById('btnCancelAddTask'),
addTaskDialog = document.getElementById('addTaskDialog'),
inputName = document.getElementById('inputName'),
selectDepartment = document.getElementById('selectDepartment'),
selectDependency = document.getElementById('selectDependency'),
chkMilestone = document.getElementById('chkMilestone'),
isAddingTask = false;
// Set to 00:00:00:000 today
today.setUTCHours(0);
today.setUTCMinutes(0);
today.setUTCSeconds(0);
today.setUTCMilliseconds(0);
today = today.getTime();
// Update disabled status of the remove button, depending on whether or not we
// have any selected points.
function updateRemoveButtonStatus() {
var chart = this.series.chart;
// Run in a timeout to allow the select to update
setTimeout(function () {
btnRemoveTask.disabled = !chart.getSelectedPoints().length ||
isAddingTask;
}, 10);
}
// Create the chart
var chart = Highcharts.ganttChart('container', {
chart: {
spacingLeft: 50
},
title: {
text: 'Interactive Gantt Chart'
},
subtitle: {
text: 'Drag and drop points to edit'
},
plotOptions: {
series: {
animation: false, // Do not animate dependency connectors
dragDrop: {
draggableX: true,
draggableY: true,
dragMinY: 0,
dragMaxY: 2,
dragPrecisionX: day / 3 // Snap to eight hours
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.