Try this (there were two stats at the end of your search in question which seems wrong to me, because count will always be 1 in second stats.
(index=SOME_INDEX sourcetype=SOME_SOURCE source=...
| eval API=CASE(searchmatch("xxx"), "yyy", ...)
| search API=WebResponse
| eval Status=case(...)
| chart count AS Avg by status_code API
... View more