The problem occurs when the "Visible name" of the host exists and is different from the "Host name".
I figured out that the problem comes from the function resolveGraphsFunctionalItemMacros in the file include/classes/macros/CMacrosResolver.php. SQL query in this function works well only when "Visible name" is missing.
In the case when the "Visible name" is set this value goes to the graph header. The same value is passed to Macro resolver. But the function expects for the "host name".
In the other hand, why macro HOST.HOST in the graph name is resolvable like HOST.NAME?