Rank: Advanced Member
Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered Joined: 1/3/2011(UTC) Posts: 483
Thanks: 0 times Was thanked: 87 time(s) in 87 post(s)
|
You can try using the following code to convert your data: Code: var ganttModel = [ { task: "Task 1", from: new Date(2012, 1, 1), to: new Date(2012, 1, 2) }, { task: "Task 2", from: new Date(2012, 1, 4), to: new Date(2012, 1, 6) }, { task: "Task 3", from: new Date(2012, 1, 10), to: new Date(2012, 1, 20) } ];
function convertModelToGanttData(model) { var ganttData = [];
for (var i = 0; i < model.length; i++) { var item = model[i];
ganttData.push([item.task, item.from, item.to]); }
return ganttData; }
$('#jqChart').jqChart({ series: [ { type: 'gantt', data: convertModelToGanttData(ganttModel) } ] }); You need to download the latest version (3.7.5.0) of jqChart, so you can use Gantt chart. Best Regards, Dragan Matek jqChart Inc.
|