This little patch sets fixed colours if you choose colorBy=status as chart option. It's a user request here because they were confused and didn't realize why the colours changed from time to time, and they wished they can accociate a certain state with certain fixed colours. (Remember, currently _buildMap(colorBy) traverses the tickets and simply increments the colour in the map by the states it finds first on its way through the tickets). Note, I use a hard-coded state<->colour mapping as desired here:
Index: tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py
===================================================================
--- tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py (revision 12265)
+++ tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py (working copy)
@@ -409,6 +410,16 @@
i = i + 1
self.classMap[t[field]] = i
+ def _buildStatusMap(field):
+ self.classMap = {}
+ self.classMap['new'] = 1
+ self.classMap['reopened'] = 1
+ self.classMap['assigned'] = 2
+ self.classMap['needs_work'] = 2
+ self.classMap['accepted'] = 4
+ self.classMap['testing'] = 0
+ self.classMap['closed'] = 3
+
def _buildEnumMap(field):
self.classMap = {}
db = self.env.get_db_cnx()
@@ -427,6 +438,8 @@
# Enums (TODO: what others should I list?)
if options['colorBy'] in ['priority', 'severity']:
_buildEnumMap(colorBy)
+ elif options['colorBy'] in ['status']:
+ _buildStatusMap(colorBy)
else:
_buildMap(colorBy)