Refactor grapher as object, provide function to render to div