I need to show four diagrams on the grails page in a grid layout with positions 11, 12, 21 and 22. Each diagram is built with code similar to:
<img src="${createLink(controller:'paretoChart', action:'buildParetoChart11')}"/>
Chart action action code:
def buildParetoChart11 = { def PlotService p11 = PlotService.getInstance() def poList = paretoChartService.getParetoidPO() def listCounter = 0 def idPO = poList[listCounter] idPO.toString() def String idPOvalue = idPO def out = response.outputStream out = p11.paretoPlot(out, idPOvalue) response.setContentType("image/jpg") session["idPOList11"] = poList }
Java p11.paretoPlot (out, idPOvalue) returns a BufferedImage of a chart inside an OutputStream, but only works for one chart. The other three diagrams vary depending on the order in which each action is called.
PlotService was written by me, yes. In this implementation, I pass an OutputStream obtained from response.outputStream and String idPOvalue for the Java method. plotPareto is as follows:
public OutputStream paretoPlot(OutputStream out, String po) throws IOException { chart = buildParetoChart(po);
So, is there a way to make sure that one action is completed before the next one starts?
Thanks in advance!
source share