Use CSS styles instead of labelsDivStyles
Check for visible viewport width, not the plotter width
Use "legend" option with "follow" value. Hide legend on deselect.