[diagrams] save attribute names instead of indices (fix #7914)