Don't show legend when singular hit obtained

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>
t.js: Switch from function defintion to function expression , minor style changes

Changes some variables from snake case to camel case to conform with
the overall style.

Signed-off-by: Vivek Rai <vivekraiiitkgp@gmail.com>