@@ -32,24 +32,30 @@ public class Flotr2Charts extends Charts {
3232
3333 @ Override
3434 public void renderHead (IHeaderResponse response ) {
35-
35+
3636 // add Google Chart JS API reference
3737 ServletContext servletContext = WebApplication .get ().getServletContext ();
3838 String contextPath = servletContext .getContextPath ();
39-
39+
4040 response .renderJavascriptReference (contextPath + "/bootstrap/js/jquery.js" );
4141 response .renderJavascriptReference (contextPath + "/flotr2/flotr2.min.js" );
4242 response .renderCSSReference (contextPath + "/flotr2/flotr2.custom.css" );
43-
43+
4444 // prepare draw chart function
4545 StringBuilder sb = new StringBuilder ();
46-
46+
4747 line (sb , "$( document ).ready(function() {" );
48+ line (sb , "try {" );
4849 // add charts to header
4950 for (Chart chart : charts ) {
5051 chart .appendChart (sb );
5152 }
52-
53+ line (sb , "} catch (exception) {" );
54+ line (sb , " if (window.console && window.console.log) {" );
55+ line (sb , " window.console.log('flotr2 exception');" );
56+ line (sb , " window.console.log(exception);" );
57+ line (sb , " }" );
58+ line (sb , "}" );
5359 // end draw chart function
5460 line (sb , "});" );
5561 response .renderJavascript (sb .toString (), null );
@@ -72,5 +78,5 @@ public Chart createBarChart(String tagId, String title, String keyName,
7278 String valueName ) {
7379 return new Flotr2BarChart (tagId , title , keyName , valueName );
7480 }
75-
81+
7682}
0 commit comments