Modify ↓
Opened 12 years ago
Last modified 12 years ago
#10579 new enhancement
[PATCH] colorBy=status should use fixed colours
Reported by: | falkb | Owned by: | Chris Nelson |
---|---|---|---|
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:
-
tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py
409 410 i = i + 1 410 411 self.classMap[t[field]] = i 411 412 413 def _buildStatusMap(field): 414 self.classMap = {} 415 self.classMap['new'] = 1 416 self.classMap['reopened'] = 1 417 self.classMap['assigned'] = 2 418 self.classMap['needs_work'] = 2 419 self.classMap['accepted'] = 4 420 self.classMap['testing'] = 0 421 self.classMap['closed'] = 3 422 412 423 def _buildEnumMap(field): 413 424 self.classMap = {} 414 425 db = self.env.get_db_cnx() … … 427 438 # Enums (TODO: what others should I list?) 428 439 if options['colorBy'] in ['priority', 'severity']: 429 440 _buildEnumMap(colorBy) 441 elif options['colorBy'] in ['status']: 442 _buildStatusMap(colorBy) 430 443 else: 431 444 _buildMap(colorBy) 432 445
Attachments (0)
Note: See
TracTickets for help on using
tickets.
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.