Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a chart similar to Gantt chart using jQuery?

I am new to jQuery and have tried to modify the existing Gantt chart plugins so as to get a chart with months but not days but to no avail. Can somebody please help me in converting the three dimensional date array into a two dimensional one consisting of just the month and the year (as I guess that this might be a solution to this problem)? If I'm wrong about the solution then please provide me with one. Thank you in advance.

// 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;
    }
like image 926
HumptyDumptyEIZ Avatar asked May 07 '13 18:05

HumptyDumptyEIZ


2 Answers

I know of three excellent commercial libraries for creating Gantt charts of varying levels of complexity. None of them require jQuery per se, but they can be used alongside it. In order of simplest to most complex:

  • dhtmlxGantt
  • Ext Gantt
  • EJS TreeGrid
like image 87
nullability Avatar answered Oct 19 '22 07:10

nullability


Why dont you try existing ones like this

like image 5
Zigma Avatar answered Oct 19 '22 09:10

Zigma