use gon to pass data to javascript, plotting genericized