I have a mysql table like:
id, visitorid, pageid
When a visitor hits the website it stores their visitor id and the page id as a row.
You can wrap your query inside another one:
SELECT
cnt AS page_visits
, COUNT(*) AS number_of_visitors
FROM
( SELECT
COUNT(*) AS cnt --- use: COUNT(DISTINCT page_id)
--- for a different count
FROM vislog
GROUP BY visid
) AS grp
GROUP BY cnt
ORDER BY number_of_visitors ;
or (I suppose this makes more sense for passing the numbers to a chart), remove the ORDER BY which is the same as putting:
ORDER BY cnt ;