class Figure {

  public String asJavascript(String divName) {
    Writer writer = new StringWriter();
    PebbleTemplate compiledTemplate;

    buildContext(divName);

    try {
      compiledTemplate = engine.getTemplate("figure_template.html");
      compiledTemplate.evaluate(writer, getContext());
    } catch (PebbleException e) {
      throw new IllegalStateException(e);
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
    return writer.toString();
  }

  public  Figure(FigureBuilder builder);
  public  Figure(Trace... traces);
  public  Figure(Layout layout, Trace... traces);
  public  Figure(Layout layout, Config config, Trace... traces);
  @Deprecated public  Figure(Layout layout, EventHandler eventHandler, Trace... traces);
  @Deprecated public  Figure(Layout layout, EventHandler[] eventHandlers, Trace... traces);

}