ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Changes required to work with liferay framework
Posted by dipak on Feb-12-2009 21:52
Hi I am trying to use trial version of chartdirector with liferay technology.I copied code on my jsp page from sam[le demo.
but i am not able to view the image.
I am  facing problem with following tag.

<img src="<%=response.encodeURL("getchart.jsp?"+chart1URL)%>" border="0" usemap="#map1">
<map name="map1">
<%=imageMap1%>
</map>

I have to test above code with liferay framework.Please let me know what changes i have to do??

  Re: Changes required to work with liferay framework
Posted by Peter Kwan on Feb-13-2009 04:42
Hi dipak,

I have not used liferay technology before, and so am not sure if the issue is related to liferay technology or not.

In any case, from your message, I assume you are putting the code in a JSP file (not another type of file). If you use the <img> tag, and it does not work, would you mind to inform me what is the error message? (Does you server produce any error message? Does the browser show any error message?)

If you get a "red X" (broken image), would you mind to inform me what is the error message inside the "red X"? See the following link if you are not sure how to read the error message inside the "red X".

http://www.chartdir.com/forum/download_thread.php?site=chartdir&bn=chartdir_faq&thread=1117817200

Also, have you included the file "getchart.jsp" in the same directory as your JSP? (The <img> tag refers to the file "getchart.jsp", which can be find in the ChartDirector/jspdemo directory.)

The chart image is created in memory as a session variable. The "getchart.jsp" is used to read the chart image. If you prefer to create the chart image as a temporary file in the hard disk (so you can see it in the disk), you may use something like:

//make sure the tmpchart directory exists under your application directory, and is readable and writable
String chart1URL = c.makeTmpFile(application.getRealPath("/tmpchart"));

Then your <img> tag can point to your temporary file:

<img src='<%=request.getContextPath() + "/tmpchart/" + chart1URL%>' border="0" usemap="#map1">

The code that calls getHTMLImageMap is to create a HTML image map for the chart. It makes the chart clickable and has tooltips or Javascript events for the data points. The particular code you use seems to come from the Javascript Clickable Charts. In that sample code, the image map is set up to connect the mouse events of the data points to some Javascript code for hiding and showing additional data for the data points.

Hope this can help.

Regards
Peter Kwan

  Re: Changes required to work with liferay framework
Posted by dipak on Feb-13-2009 14:27
thanks  for your reply.
I am getting following error message on my console

659: <img src="<%=response.encodeURL("getchart.jsp?"+chart1URL)%>" border="0" usemap="#map1">
660: <map name="map1">
661: <%=imageMap1%>
662: </map>


Stacktrace:
06:25:02,565 ERROR [IncludeTag] java.lang.IllegalArgumentException: URL path must start with a '/' or include '://'
        at com.liferay.portlet.PortletResponseImpl.encodeURL(PortletResponseImpl.java:341)
        at com.liferay.portlet.PortletServletResponse.encodeURL(PortletServletResponse.java:101)
        at javax.servlet.http.HttpServletResponseWrapper.encodeURL(HttpServletResponseWrapper.java:75)
        at org.apache.jsp.html.portlet.reportsanalysis.analysis.view_jsp._jspService(view_jsp.java:2411)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

  Re: Changes required to work with liferay framework
Posted by Peter Kwan on Feb-14-2009 00:24
Hi dipak,

The error is not generated by ChartDirector. It is generated by "liferay". There may be more information in the "liferay" documentation on why there is such an error. My guess is that "liferay" requiries you to use a full URL. In this case, please use a full URL so as to satisfy "liferay", like:

<img src="<%=response.encodeURL("/aaa/bbb/ccc/ddd/getchart.jsp?"+chart1URL)%>" border="0" usemap="#map1">

(In the above, "/aaa/bbb/ccc/ddd" is a placeholder for the path. Please replace it with the actual path you are using.)

Hope this can help.

Regards
Peter Kwan