id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release
10579,[PATCH] colorBy=status should use fixed colours,falkb,ChrisNelson,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:\r\n\r\n{{{\r\n#!diff\r\nIndex: tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py\r\n===================================================================\r\n--- tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py	(revision 12265)\r\n+++ tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py	(working copy)\r\n@@ -409_6 +410_16 @@\r\n                     i = i + 1\r\n                     self.classMap[t[field]] = i\r\n \r\n+        def _buildStatusMap(field):\r\n+            self.classMap = {}\r\n+            self.classMap['new'] = 1\r\n+            self.classMap['reopened'] = 1\r\n+            self.classMap['assigned'] = 2\r\n+            self.classMap['needs_work'] = 2\r\n+            self.classMap['accepted'] = 4\r\n+            self.classMap['testing'] = 0\r\n+            self.classMap['closed'] = 3\r\n+\r\n         def _buildEnumMap(field):\r\n             self.classMap = {}\r\n             db = self.env.get_db_cnx()\r\n@@ -427_6 +438_8 @@\r\n             # Enums (TODO: what others should I list?)\r\n             if options['colorBy'] in ['priority'_ 'severity']:\r\n                 _buildEnumMap(colorBy)\r\n+            elif options['colorBy'] in ['status']:\r\n+                _buildStatusMap(colorBy)\r\n             else:\r\n                 _buildMap(colorBy)\r\n \r\n}}},enhancement,new,normal,TracJsGanttPlugin,normal,,,,
