[nim] Extracted visualisation control-related functions from index.js for Single Responsibility and readability