fixed code flow to populate legend, added GET DATA button