如何使用jQuery创建类似于甘特图的图表?

时间:2013-05-07 18:18:18

标签: jquery gantt-chart

我是jQuery的新手,并试图修改现有的甘特图插件,以便获得一个有几个月而不是几天但没有用的图表。有人可以帮我把三维日期数组转换成一个只包含月份和年份的二维数据(因为我猜这可能是解决这个问题的方法)?如果我对解决方案有误,请给我一个。先感谢您。

// Creates a 3 dimensional array [year][month][day] of every day 
    // between the given start and end dates
    function getDates(start, end) {
        var dates = [];
        dates[start.getFullYear()] = [];
        dates[start.getFullYear()][start.getMonth()] = [start]
        var last = start;
        while (last.compareTo(end) == -1) {
            var next = last.clone().addDays(1);
            if (!dates[next.getFullYear()]) { dates[next.getFullYear()] = []; }
            if (!dates[next.getFullYear()][next.getMonth()]) { 
                dates[next.getFullYear()][next.getMonth()] = []; 
            }
            dates[next.getFullYear()][next.getMonth()].push(next);
            last = next;
        }
        return dates;
    }

3 个答案:

答案 0 :(得分:6)

我知道有三个优秀的商业图书馆用于创建不同复杂程度的甘特图。它们都不需要jQuery本身,但它们可以与它一起使用。按照最简单到最复杂的顺序:

答案 1 :(得分:5)

为什么不试试现有的this

答案 2 :(得分:3)

了解http://gantt.twproject.com/它是免费且强大的

有关组件的完整说明,请参阅 http://roberto.open-lab.com/2012/08/24/jquery-gantt-editor/

Github上提供的资源来源:https://github.com/robicch/jQueryGantt

相关问题