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:


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/

    409410                    i = i + 1
    410411                    self.classMap[t[field]] = i
     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
    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)

Attachments (0)

Change History (1)

comment:1 Changed 12 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
Set your email in Preferences
as new The owner will remain Chris Nelson.

Add Comment

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

Note: See TracTickets for help on using tickets.