translate diagram in js