Friday, February 12, 2010

As easy as "Pie"


       In the same manner as report integration, to view a Next flash chart in you application you have to do three things :
  • start a local web server
  • write just a few lines of code which will create a json file :
ChartRunner runner = new ChartRunner();
runner.setChart(chart);
runner.setConnection(connection);
runner.setQueryTimeout(queryTimeout);
runner.setParameterValues(parameterValues);
OutputStream os = new FileOutputStream(webRoot + 
                  File.separatorChar + "data.json");
boolean result = runner.run(os); 
os.close(); 
  • open the url :
openUrl("http://localhost:" + webServerPort + "/chart.html?ofc=data.json");
And that is all. 

No comments: