You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emi Lu <em...@encs.concordia.ca> on 2011/02/01 21:36:22 UTC

displaytag1.2 + struts2.2.1.1 + jfreechart. Graph did not update based on displaytag sortable column

Good afternoon,

displaytag1.2 + struts2.2.1.1 + jfreechart.

<img src="jfreechartReport.action">

Can display the graph, but when using displaytag to order by a specific 
column , the graph does not refresh automatically.

Some clues?

thanks a lot!
--
Lu Ying

GUI is like the following:

------------------------------------
col1    | col 2   | ...
--------------------------------------
value1  | value2  | ...
value11 | value22 | ...
...

Graph result shown correctly.


Now clicking col1(sortable displaytag generated column),

The graph did not refresh at all!



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: displaytag1.2 + struts2.2.1.1 + jfreechart. Graph did not update based on displaytag sortable column

Posted by Chris Pratt <th...@gmail.com>.
It sounds like what you're trying to do is a displaytag feature.  You may
have more luck in their mailing list.
  (*Chris*)

On Tue, Feb 1, 2011 at 12:57 PM, Emi Lu <em...@encs.concordia.ca> wrote:

> Dave,
>
>     displaytag1.2 + struts2.2.1.1 + jfreechart.
>>    <img src="jfreechartReport.action">
>>
>>    Can display graph, but when using displaytag to order by a
>>
>>    specific column , the graph does not refresh automatically.
>>
>>    Some clues?
>>
>
>  > If the image is on the page why would it refresh unless the page
>> refreshes?
>>
>
> By clicking column "col1" - order action, struts2 triggered "search()
> "method in JfreechartReport.java
>
> Dataset is re-calculated and returned, but the graph is not!
>
> --
> Lu Ying
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: displaytag1.2 + struts2.2.1.1 + jfreechart. Graph did not update based on displaytag sortable column

Posted by Emi Lu <em...@encs.concordia.ca>.
> <ma...@encs.concordia.ca>> wrote:
>
>             displaytag1.2 + struts2.2.1.1 + jfreechart.
>         <img src="jfreechartReport.action">
>
>             Can display graph, but when using displaytag to order by a
>
>             specific column , the graph does not refresh automatically.
>
>             Some clues?
>
>
>          > If the image is on the page why would it refresh unless the
>         page refreshes?
>
>
>     By clicking column "col1" - order action, struts2 triggered
>     "search() "method in JfreechartReport.java
>
>     Dataset is re-calculated and returned, but the graph is not!
>
>
> This does not help diagnose the problem.
>
> Is there a full-page refresh, or not?
I think so.

public class JfreechartReport extends ActionSupport
{
    private BeanPageDisplay   bean_display      = new BeanPageDisplay();
    private SqlSessionFactory sqlSessionFactory = null;
    private ArrayList<BeanReportGraduation> alist_paging_bean = new 
  ArrayList<BeanReportGraduation>();
    private JFreeChart chart;
    private DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    ...
  /* when displaytag col1 is clicked, this method is called!
    definitely, jsp page is refreshed!
*/
  public String search() throws Exception
  {
    HttpServletRequest  req=ServletActionContext.getRequest();
    HttpServletResponse res=ServletActionContext.getResponse();
    process_paging(req);
    ...
    session.setAttribute("alist_paging_bean");
    return SUCCESS;
  }

  public void process_paging (  HttpServletRequest req)
  {
    ... to get & update alist_paging_bean used by .jsp displaytag
    req.setAttribute("alist_paging_bean",    this.alist_paging_bean);
    req.setAttribute(GlobalGUI.DISPLAY_BEAN, this.bean_display);

  }


  public String jfreechart_report() throws Exception
  {
   HttpServletRequest  req = ServletActionContext.getRequest();
   HttpServletResponse res = ServletActionContext.getResponse();
   this.alist_paging_bean  = 
(ArrayList<BeanReportGraduation>)session.getAttribute("alist_paging_bean"); 

       setChart();
       return SUCCESS;
  }




    public void setChart()
    {
       for(int i=0; i<alist_paging_bean.size(); i++)
       {
           ...generate data set
       }

       chart = ChartFactory.createBarChart3D(
                "example report",
                "x",
                "y",
                dataset,
                PlotOrientation.VERTICAL,
                true,
                true,
                false
                );
       chart.setBackgroundPaint(java.awt.Color.white);
    }

  ...

}

When click "col1", search() is called, and jfreechart_report() is called 
as well, but the shared alist_paging_bean is not correctly displayed by 
jfreechart!

--
Lu Ying

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: displaytag1.2 + struts2.2.1.1 + jfreechart. Graph did not update based on displaytag sortable column

Posted by Dave Newton <da...@gmail.com>.
On Tue, Feb 1, 2011 at 3:57 PM, Emi Lu <em...@encs.concordia.ca> wrote:

>    displaytag1.2 + struts2.2.1.1 + jfreechart.
>>    <img src="jfreechartReport.action">
>>
>>    Can display graph, but when using displaytag to order by a
>>
>>    specific column , the graph does not refresh automatically.
>>
>>    Some clues?
>>
>
>  > If the image is on the page why would it refresh unless the page
>> refreshes?
>>
>
> By clicking column "col1" - order action, struts2 triggered "search()
> "method in JfreechartReport.java
>
> Dataset is re-calculated and returned, but the graph is not!
>

This does not help diagnose the problem.

Is there a full-page refresh, or not?

Dave

Re: displaytag1.2 + struts2.2.1.1 + jfreechart. Graph did not update based on displaytag sortable column

Posted by Emi Lu <em...@encs.concordia.ca>.
Dave,

>     displaytag1.2 + struts2.2.1.1 + jfreechart.
>     <img src="jfreechartReport.action">
>
>     Can display graph, but when using displaytag to order by a
>     specific column , the graph does not refresh automatically.
>
>     Some clues?

> > If the image is on the page why would it refresh unless the page refreshes?

By clicking column "col1" - order action, struts2 triggered "search() 
"method in JfreechartReport.java

Dataset is re-calculated and returned, but the graph is not!

--
Lu Ying

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: displaytag1.2 + struts2.2.1.1 + jfreechart. Graph did not update based on displaytag sortable column

Posted by Dave Newton <da...@gmail.com>.
On Tue, Feb 1, 2011 at 3:36 PM, Emi Lu <em...@encs.concordia.ca> wrote:

> displaytag1.2 + struts2.2.1.1 + jfreechart.
>
> <img src="jfreechartReport.action">
>
> Can display the graph, but when using displaytag to order by a specific
> column , the graph does not refresh automatically.
>
> Some clues?
>

Not much information to go on.

If the image is on the page why would it refresh unless the page refreshes?

Dave