Ticket #10579 (new enhancement)

Opened 7 months ago

Last modified 7 months ago

[PATCH] colorBy=status should use fixed colours

Reported by: falkb Assigned to: ChrisNelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

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)
 

Attachments

Change History

10/30/12 16:54:58 changed by ChrisNelson

Thanks for the patch. More flexibility in color choices is good. I don't know that I'd accept this patch into the main line but I would use it as the conceptual basis for adding configurable coloring.


Add/Change #10579 ([PATCH] colorBy=status should use fixed colours)




Change Properties
Action