Displaying multiple charts of the same type on single page

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ahopkins
Posts: 8
Joined: Thu Jul 20, 2006 2:10 pm

Displaying multiple charts of the same type on single page

Post by ahopkins » Wed Aug 23, 2006 7:39 pm

Is it possible to display several "bar" charts on one web page? For instance, I am retreiving data from the DB that is to be displayed on a graph. It is possible for me to have several data sets for one particular chart type (i.e., PIE, LINE) that I need to display on a single web page. Is this possible to do?

kelly
Posts: 7
Joined: Tue Aug 01, 2006 4:58 pm

Post by kelly » Thu Aug 24, 2006 4:56 pm

How are you displaying them on the web-page right now?

ahopkins
Posts: 8
Joined: Thu Jul 20, 2006 2:10 pm

Post by ahopkins » Thu Aug 24, 2006 5:20 pm

I am using STRUTS with this web app. My servlet retreives all the data that should be sent to graphing tool. I can currently display a PIE, TIMESERIES, LINE and BAR graphs all on one web page, but not multiples of the same type (i.e., can't display two PIE charts on the same graph).

My algorithm basically cycles through my result data and sets the data in session attributes. So, when I retrieve this data through my session attributes I access these attributes in the JSP to display the graphs. If I produced multiple graphs on the same type on a single web page, only the last dataset will be displayed, the others will be overwritten.

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Fri Aug 25, 2006 7:55 am

You haven't said yet, how the browser retrieves the chart images. Do you generate them on the fly or do you save them temporarily?

ahopkins
Posts: 8
Joined: Thu Jul 20, 2006 2:10 pm

Post by ahopkins » Fri Aug 25, 2006 11:27 am

I save them temporarily in the HTTPServlet request object and then I retreive them later via the <jsp:useBean> in my JSP. The problem is that each jsp:useBean has an instance of a chart type stored in it (i.e., PIE, BAR). So, based on this, I am not sure how to store multiple instances of the same chart type to be accessed later in my JSP.

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Mon Aug 28, 2006 7:46 am

ahopkins wrote:I save them temporarily in the HTTPServlet request object and then I retreive them later via the <jsp:useBean> in my JSP. The problem is that each jsp:useBean has an instance of a chart type stored in it (i.e., PIE, BAR). So, based on this, I am not sure how to store multiple instances of the same chart type to be accessed later in my JSP.
I don't understand the way you are generating the charts, but (no offence) it seems just too complicated.

I only use ServletUtilities.saveChartAsPNG() to save the image temporarily and the DisplayChart to retrieve them.

Sometimes all the fancy frameworks like struts, spring, jsp, etc... create more burden than benefit.

ahopkins
Posts: 8
Joined: Thu Jul 20, 2006 2:10 pm

Post by ahopkins » Mon Aug 28, 2006 2:21 pm

It is a very simple framework to generate the charts. Below is a very simple to understand explanation.


1) User clicks on link on web page
2) Web app retrieves all data from Oracle DB
3) DataSets are stored in a Collection (i.e., Map) DataSets will consist of metadata about a various chart type
4) Loop through stored data and produce charts based on the data

**My problem is coming in when I have to display multiple charts of the same type on one single page. I.E., if the result set data from the database contains two sets of data for a PIE chart to be displayed on a single page. I am using the STRUTS framework, because this is being used for the other web apps, and it will make integration easier. BUT, since I am sending all of the datasets to the graphing tool at one time, sending multiple datasets of the same chart type would not allow for me to display all my charts. Because I am temporarily storing the dataset for the producer bean in the request object and accessing it later in the JSP for display, it limits my ability to display multiple datasets for a particular chart type (i.e., PIE, BAR).

Do you understand the problem a little better?

sirim
Posts: 2
Joined: Tue Sep 04, 2018 4:26 pm
antibot: No, of course not.

Re: Displaying multiple charts of the same type on single page

Post by sirim » Tue Sep 04, 2018 4:31 pm

I have same issue, am trying to display multiple charts on page, but am getting same chart multiple times.The session object am adding is not updating with new chart object.

Locked