How does the programming languages bar and API work?

I have some questions about the colored programming language ratio bar shown on the project root page (e.g. gitlab.com/MyOrg/MyGroup/MyProject), which I assume uses the Languages API documented here.

  1. Does the calculation use all branches or just one? If just one, then which? Can this be configured?
  2. How does the calculation happen?

Thanks ever so much for any help.