Make the popup legend draggable. This can be useful for plots that contain a lot of information.
Fix a bug that I introduced in a recent checkin. Selecting views with a non-default time range was not working correctly.
Refactoring for improved maintainability