I found it! This is something I'd been searching for on-and-off over the last couple years.
The code that generates the charts is in
your gnucash program files, in scm\report\standard-reports. (Different operating systems will have things put in slightly different places. You can search inside gnucash for "standard-reports".)
In files like account-piechart.scm or category-barchart.scm, you can search for the word "Maximum" twice to find something that looks like this:
"c" (N_ "Maximum number of slices in pie.") 7
2 24 0 1))
(It'll be "Maximum number of bars" in the barchart one.)