New "Places Color" tab in Family line graph

Hi All,

I like very much Family Line Graph and also like colorizing by family name (Family Colors tab). I would like add similar tab for colorizing by birth places because it will be very informative on chart. I have started rewrite code of this graph and I’m here now (tab have created):

I’m not too familliary in py so I’d like ask support from you:
This code collect all surnames on surname tab. Could you advice how can I change this to collect birth places instead ot surnames?

progress = ProgressMeter(
            _('Finding Surnames'), parent=uistate.window)
        progress.set_pass(_('Finding surnames'),
        for person in database.iter_people():
            key = person.get_primary_name().get_surname()
            count = 0
            if key in surnames:
                count = surnames[key]
            surnames[key] = count + 1

Thx in advance.

1 Like

Places are related to events, So for each people, you need to collect all events.
If you need to do this only for birth event, you can use the function:

from gramps.gen.utils.db import get_birth_or_fallback

get_birth_or_fallback(self.r_db, person)

When you have the event:


Thx, it’s working:

Could you help me how can I get name of place instead ot place ID (see on pic)?

thx in advance.

This is not the place ID but the place handle.
To get the real place, you need to do:

from import displayer as _pd

place = dbstate.db.get_place_from_handle(handle)
place_name = _pd.display(dbstate.db, place)

The place name will use the place format you choose in the display preference tab.


Thx your help, it’s working perfectly: image


Output (colorizing by bithplace) is like this:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.