I believe the easiest way to do this would be to go through the UI in your environment and go to "deployment status" -> "show all hosts" -> "all Hosts" where it will tell you how many hosts you have connected.
If you have multiple environments you could also use this API endpoint to pull out the information programmatically:
IF you are looking to make a "chart" of hosts that are connected, I would recommend using the API then exporting the json into excel and making a chart. You could also make a custom chart and base it off of CPU, from there export it to excel and graph it by number of hosts.
Perhaps one way to chart this would be to create a dashboard and use the host health metric. Each host instance equates to a Dynatrace OneAgent installed in your environment.
Hope this helps!
Freshly announced, there is now an EAP for a oneagent API. If you'd like to sign up for that EAP, click the following link: https://www.dynatrace.com/news/blog/manage-thousands-of-hosts-with-the-new-oneagent-on-a-host-rest-a...
This might help fulfill your request.