2 Replies Latest reply on Dec 8, 2010 8:00 AM by Leandro godoy

    help a4j:mediaOutput

    Leandro godoy Newbie

      Hello, good afternoon everyone, I have a problem with the graphics display using the
      (<a4j:mediaOutput>), The graph must be updated within a certain range of seconds
      for that I'm using (<a4j:poll>), but my method that generates the image to the graphic has the following


      public void getImageFromTimeLineChart (OutputStream out, Object data) {
      ChartTitle String = "Chart of Operating Times:"
      + UniLoc.getNomeLocalidade (getMBParametros (). GetLocale ());
      HorizontalLabel String = "Days of month";
      VerticalLabel String = "Time / Day";
      List <SeriesTimeVO> <SeriesTimeVO> bars = new ArrayList ();
      bars = getValuesFromChart (ChartType.TEMPO_LOCALIDADE);
      try {
      chartgenerator ChartGeneratorImpl = new ();
      BufferedImage result = chartgenerator.generateTimeSeriesChart (true,
      bars, chartTitle, verticalLabel, horizontalLabel);
      result.flush ();
      ImageIO.write (result, "png", out);
      } Catch (Exception e) {
      e.printStackTrace ();


      how can I call a method that generates a new image for the graph from (<a4j:poll>)?
      Is there any other way to run this update?
      thank you friends, all help and welcome.

        • 1. Re: help a4j:mediaOutput
          Nick Belaevski Master

          Hi Leandro,


          1) Add a4j:mediaOutput as reRender target for poll

          2) Set cacheable="false" for media output

          3) Place nested f:param with random value and arbitrary name inside media output (this is to generate new URI each time it is requested)

          • 2. Re: help a4j:mediaOutput
            Leandro godoy Newbie

            I tried  but could not so he does not call the method of generation of the graph  again, it updates the modalPanel but does not generate a new image


            <a4j:poll  interval="30000" reRender="formChart:chartRegion"
                <a4j:outputPanel ajaxRendered="true" id="chartRegion">   
                            <a4j:mediaOutput createContent="#{bean.getImageFromTempoLineChart}"
                                mimeType="image/png" element="img" cacheable="false" session="false"
                                 standby="Carregando gráfico..."  id="chart1"                        
                                rendered="#{bean.chartType eq 'TEMPO_LOCALIDADE'}"
                                    <f:param name="x" value="#{bean.randomUrl}"/>