real time displaying graph in jsp

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
terrie
Posts: 11
Joined: Wed Jul 21, 2004 4:09 am

real time displaying graph in jsp

Post by terrie » Wed Jul 21, 2004 4:18 am

Here is my code:
<HTML>
<HEAD>
<%@ page contentType="text/html; charset=Big5" %>
<%@page import="java.util.*"%>
<%@ page import="org.jfree.data.DefaultCategoryDataset"%>
<%@ page import="org.jfree.data.time.*"%>
.
.
.
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
String filename = ServletUtilities.saveChartAsPNG(chart, 500, 300, info, session);
//String filename = ServletUtilities.saveChartAsPNG(chart, 2000, 1400, info, session);

String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;

%>
</BODY>
<P ALIGN="CENTER">

<% if(IS_NO_DATA == false) { %>
<table>
<tr>
:arrow: <td>hihihihi<img src="<%= graphURL%>" width=500 height=300 border=0 usemap="#<%= filename %>">
ewqewqewqedsadasd</td>
<td>ewqeqwdsa</td>
</tr>
</table>
<% } else {
out.println("no date found");
} %>
</P>
dsadsadsadsa

</HTML>

when I use img src="<%= graphURL%>" , the chart can't be displayed and "hihihi" can be displayed.
when I use img src="<%ServletUtilities.sendTempFil(filename,response);%>, the chart can be displayed and "hihihi" can't be displayed.

can I add some code that allow both chart and "hihihi" be displayed?

thank you in advance
cheers,

pmarsollier
Posts: 49
Joined: Thu Jul 08, 2004 8:54 am
Location: France

Post by pmarsollier » Wed Jul 21, 2004 7:03 am

precision please :

What do you exactly get in your browser in both case ?
I mean the html source in really get ?

Just post it there or in a PM.

terrie
Posts: 11
Joined: Wed Jul 21, 2004 4:09 am

Post by terrie » Wed Jul 21, 2004 7:41 am

thx in advance for ur reply

let me make it more clear

when I use img src="<%= graphURL%>" , the chart can't be displayed and "hihihi" can be displayed.
the display i can see like that:
>>
hihihi
:arrow: the chart with nothing and the red"X" on top-left-corner
ewqewqewqedsadasd
<<

when I use img src="<%ServletUtilities.sendTempFil(filename,response);%>, the chart can be displayed and "hihihi" can't be displayed.
the display i can see like that:
>>
:arrow: the chart I want but with no "hihihi" & "ewqewqewqedsadasd"
<<

thX very much for attention

pmarsollier
Posts: 49
Joined: Thu Jul 08, 2004 8:54 am
Location: France

Post by pmarsollier » Wed Jul 21, 2004 7:45 am

ok, that's what I understood.

What I want to see is the HTML you receive in your browser (right click and "source" )

I think in the first cas you have your table (so the HTML you wrote in your JSP) and in the second case, you just have a picture and not your HTML.

nice to confirm it.

terrie
Posts: 11
Joined: Wed Jul 21, 2004 4:09 am

Post by terrie » Wed Jul 21, 2004 7:51 am

THX

i agree with ur point that i get image display in the second case and not in html.

may i ask can how can i display the image in the first case with html code(i.e. both of "hihihi" and the chart)?

thanks in advance

pmarsollier
Posts: 49
Joined: Thu Jul 08, 2004 8:54 am
Location: France

Post by pmarsollier » Wed Jul 21, 2004 7:53 am

ok.

I'll post a new topic with a clean explanation and the way to do it.

terrie
Posts: 11
Joined: Wed Jul 21, 2004 4:09 am

Post by terrie » Wed Jul 21, 2004 8:01 am

THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX in advance

I have try to search in this forum for keyword likejsp,servlet,timeseries...etc... and also run jfreechart-sample.war file.
Most the suggestion is seem to write sevlet class.

As I want all job done in one jsp file like connecting to JDBC, SQL stmt and HTML, I just try to use this method to the chart i want as easy and fast as possible.

Originally, i use cewolf as it's easy to use but got problem of x-axis label.

Locked