order metric characters by element then code