|Version 2 (modified by ChrisNelson, 4 years ago) (diff)|
Trac jsGantt plugin
A plugin which allows Trac ticket data to be displayed in a jsGantt chart in a wiki page.
If you have any issues, create a new ticket.
Download the zipped source from here.
[[TracJSGanttChart(milestone=Test)]] displays all the tickets in the Test milestone. [[TracJSGanttChart(sample=1)]] displays the sample project from jsgantt.com.
Trac-jsGantt is intended to be flexible enough to get data from various plugins by configuring the field names for those plugins in trac.ini. It is known to work with TimingAndEstimationPlugin (for estimated and total hours), MasterTicketsPlugin (for FS dependencies), and Subtickets for parent/child relationships. Custom fields for start and finish date are also supported.
Tasks are colored based on ticket priority consistent with the colors used in Trac reports.
Your trac.ini may include:
[trac-jsgantt] fields.estimate = estimatedhours fields.worked = totalhours fields.pred = blockedby fields.succ = blocking fields.parent = parents fields.start = userstart fields.finish = userfinish date_format = %Y-%m-%d milestone_type = milestone
All of the fields.* items name custom fields which may contain data for the Gantt.
When estimate and worked are both configured, the plugin attempts to display (100 * worked/estimate) as the percent complete. The example works with TimingAndEstimationPlugin. Alternatively, if percent is configured, the plugin attempts to display it as the percent complete (it should be a number from 0 to 100). If none of those are configured, all tasks will be marked as 0% complete.
When pred and succ are configured the plugin uses them to determine the task dependencies. The example works with MasterTickets plugin. If these fields are not configured, no dependencies are shown.
When parent is configured, it is the field which holds the parent ticket number. The example works with Subtickets. If this field is not configured, no parent/child relationship will be displayed. If it is configured, the Gantt can be collapsed by the user to show or hide subtasks.
When start and finish are configured, the plugin uses them to set task start and finish dates. The date_format field is a Python strptime() format specifier which describes the contents of start and finish. If these fields are not configured, all tasks end today and have a 1-day duration.
The milestone_type may be used to have a custom ticket type show up as milestones on the chart. If this field is not specified, only Trac milestones are displayed as milestones.
The chart display can be controlled with a number of macro arguments:
- format - Initial display format: day (default), week, month, or quarter
- sample - Display sample tasks (1) or not (0; default)
- res - Show resource column (1; default) or not (0)
- dur - Show duration colunn (1; default) or not (0)
- comp - Show percent complete column (1; default) or not (0)
- caption - Caption to place to right of tasks: None, Caption, Resource (default), Duration, %Complete
- startDate - Show start date column (1; default) or not (0)
- endDate - Show end date column (1; default) or not (0)
- dateDisplay - Date display format: 'mm/dd/yyyy' (default), 'dd/mm/yyyy', or 'yyyy-mm-dd'
- openLevel - Number of levels of tasks to show. 1 = only top level task. 999 is the default.
All other macro arguments are treated as TracQuery specification (e.g., milestone=MS1|MS2) to control which tickets are displayed.
- Ticket status and type are not displayed.
- Allow coloring of tasks by severity, milestone, or owner.
- Allow configuration of default task duration.
-  by ChrisNelson on 2014-08-07 14:39:09
Save schedule under Trac 1.0, bump version. Refs #11773.
NOTE: This is incompatible with versions of Trac prior to 1.0!
Plugin version now 0.11. That's a little confusing since plugin 0.10
worked in Trac 0.11(.6). Sorry. This is temporary. Hopefully I'll get
some other changes in soon and bump the plugin version again.
There are other database accesses that should be converted to 1.0 style
but I haven't fully tested those changes yet.
-  by rjollos on 2014-07-23 21:28:33
Added license text and file headers. Tidied up indentation. Refs #11871.
-  by ChrisNelson on 2014-04-24 16:38:38
Use executemany() when inserting multiple rows. Refs #11027.
Required for cross-db compatibility.
Light testing shows this still works for me in PostgreSQL so it
doesn't seem I broke anything. I need SQLite feedback, though.