Modify

Opened 21 months ago

Last modified 21 months ago

#10579 new enhancement

[PATCH] colorBy=status should use fixed colours

Reported by: falkb Owned by: 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:

  • tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py

     
    409410                    i = i + 1 
    410411                    self.classMap[t[field]] = i 
    411412 
     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 
    412423        def _buildEnumMap(field): 
    413424            self.classMap = {} 
    414425            db = self.env.get_db_cnx() 
     
    427438            # Enums (TODO: what others should I list?) 
    428439            if options['colorBy'] in ['priority', 'severity']: 
    429440                _buildEnumMap(colorBy) 
     441            elif options['colorBy'] in ['status']: 
     442                _buildStatusMap(colorBy) 
    430443            else: 
    431444                _buildMap(colorBy) 
    432445 

Attachments (0)

Change History (1)

comment:1 Changed 21 months ago 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 Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.