many improvements

Fix subDomainTextFormat as a function not working
add legendTitleFormat as a function (value, index) to format title in
legend elements.