Opened 5 years ago

# [PATCH] colorBy=status should use fixed colours

Reported by: Owned by: falkb Chris Nelson normal TracJsGanttPlugin normal

### 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:

• ## tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py

 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() # 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)

### comment:1 Changed 5 years ago by Chris Nelson

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.

### Modify Ticket

Change Properties