refactor graph label unit calculations