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:
(add-option
(gnc:make-number-range-option
gnc:pagename-display optname-slices
"c" (N_ "Maximum number of slices in pie.") 7
2 24 0 1))
(It'll be "Maximum number of bars" in the barchart one.)
That 24 in the last line is the maximum value, so just change that to be something much higher, like 99. Save it, restart gnucash, and follow the usual advice to set the number of slices/bars in your reports, this time without such a low maximum number. Keep in mind your legend would be unwieldy. (If you export your reports to HTML, you can edit the JavaScript to turn the legend off. I don't know if there's a setting in gnucash.)