demonstrate diagram envoronment, with separate name, counter, and ref format
The equation environment is special -- references to equations get parentheses around them. This code shows how to replicate that.
%% Make a diagram environment just like equation but with its own counter;
%% for only one diagram at a time
\newcounter{diagcounter}
\renewcommand{\thediagcounter}{(\thesection.\arabic{diagcounter})}
\newenvironment{diag}{\begin{equation}}{ \setcounter{diagcounter}{\value{equation}-1} \refstepcounter{diagcounter} \end{equation}}
%% Diagram environment without a counter
\newenvironment{diag*}{\begin{equation*}}{\end{equation*}}
%% This makes diag follow the theorem counter
\makeatletter\let\c@diagcounter\c@thm\makeatother
%% Set crefname
\crefname{diagcounter}{Diagram}{Diagrams}