I don't think they need to do anything as sophisticated as a query, they're just looking at how many questions are tagged for each language (which you can see from the tag search page) and then plotting those on a logarithmic scale.
> Credit: My colleague Rachel Stephens wrote the queries that are responsible for the GitHub axis in these rankings. She is also responsible for the query design for the Stack Overflow data.