set display = none if diagram is blank in javascript