Source:
public String getGraphHTML(String title) throws GraphException { SortedMap<String, String> variables = new TreeMap<>(); JSONObject config = new JSONObject(); StringBuilder html = new StringBuilder(); try { DataConfiguration data = new DataConfiguration(this); config.put("data", data.getConfiguration()); AxisConfiguration axis = new AxisConfiguration(this); config.put("axis", axis.getConfiguration()); GridConfiguration grid = new GridConfiguration(this); config.put("grid", grid.getConfiguration()); LegendConfiguration legend = new LegendConfiguration(this); config.put("legend", legend.getConfiguration()); variables.put("type", "'" + this.getType() + "'"); variables.put("config", config.toString()); String affix = "min"; html.append( "<html>" + "<head>" + "<link rel='stylesheet' type='text/css' href='file:/ "<link rel='stylesheet' type='text/css' href='file:/ "<script type='text/javascript' src='file:/ "<script type='text/javascript' src='file:/ "<script type='text/javascript'>try {\n"); html.append(getVariablesHTML(variables, null)); html.append(getVariablesHTML(data.getVariables(), "data")); html.append(getVariablesHTML(axis.getVariables(), "axis")); html.append(getVariablesHTML(grid.getVariables(), "grid")); html.append(getVariablesHTML(legend.getVariables(), "legend")); String titleHTML = "<div id='chart-title'>" + title + "</div>"; String errorHTML = "<div id='error'></div>"; String chartHTML = "<div id='chart'></div>"; html.append( "\n} catch (e) { displayError(e); }</script>" + "<script type='text/javascript' src='file:/ "</head>" + "<body>" + titleHTML + errorHTML + chartHTML + "</body>" + "</html>"); } catch (JSONException e) { e.printStackTrace(); throw new RuntimeException(e); } return html.toString(); }

Target:
public String getGraphHTML(String title) throws GraphException { SortedMap<String, String> variables = new TreeMap<>(); JSONObject config = new JSONObject(); StringBuilder html = new StringBuilder(); try { DataConfiguration data = new DataConfiguration(this); config.put("data", data.getConfiguration()); AxisConfiguration axis = new AxisConfiguration(this); config.put("axis", axis.getConfiguration()); GridConfiguration grid = new GridConfiguration(this); config.put("grid", grid.getConfiguration()); LegendConfiguration legend = new LegendConfiguration(this); config.put("legend", legend.getConfiguration()); variables.put("type", "'" + this.getType() + "'"); variables.put("config", config.toString()); String affix = "min"; html.append( "<html>" + "<head>" + "<link rel='stylesheet' type='text/css' href='file:/ "<link rel='stylesheet' type='text/css' href='file:/ "<script type='text/javascript' src='file:/ "<script type='text/javascript' src='file:/ "<script type='text/javascript'>try {\n"); html.append(getVariablesHTML(variables, null)); html.append(getVariablesHTML(data.getVariables(), "data")); html.append(getVariablesHTML(axis.getVariables(), "axis")); html.append(getVariablesHTML(grid.getVariables(), "grid")); html.append(getVariablesHTML(legend.getVariables(), "legend")); String titleHTML = "<div id='chart-title'>" + title + "</div>"; String errorHTML = "<div id='error'></div>"; String chartHTML = "<div id='chart'></div>"; html.append( "\n} catch (e) { displayError(e); }</script>" + "<script type='text/javascript' src='file:/ "</head>" + "<body>" + titleHTML + errorHTML + chartHTML + "</body>" + "</html>"); } catch (JSONException e) { e.printStackTrace(); throw new GraphException(e.getMessage()); } return html.toString(); }