There is, as far as I know, no way to compute this, in one step, from the diagram. But there is a recursive formula that uses the diagram and prior knowledge of the length of the longest element. (Acknowledgment: I learned about this from John Stembridge and looked it up in some notes he shared with me years ago.) The recursion runs over all subsets of the nodes of the diagram, so it's not efficient, but for specific infinite families, it can run smoothly. We need to give Poincaré series rather than just orders.
For a Coxeter system $(W,S)$, let $W(q)=\sum_{w\in W}q^{\ell(w)}$, where $\ell$ is the usual length function relative to words in $S$. For $J\subseteq S$, let $W_J$ be the standard parabolic subgroup generated by $J$, so that $W_J(w)=\sum_{w\in W_J}q^{\ell(w)}$.
Theorem (Steinberg).
$$\sum_{J\subseteq S}(-1)^J\frac{1}{W_J(q)}=\begin{cases}\frac{q^{\ell(w_0)}}{W(q)}\text{ if }W\text{is finite with longest element }w_0,\\0\text{ if }W\text{ is infinite.}\end{cases}$$
This theorem is supposed to be in Steinberg's monograph Endomorphisms of linear algebraic groups (AMS Memoir 80), but I haven't chased that down.
It's useful to remember that if $W$ has a disconnected diagram, the its Poincaré series is the product of the Poincaré series of its components.