|
getHTMLImageMap() is null for SurfaceChart |
Posted by Gil on Dec-03-2011 04:17 |
|
Hi there,
I have used getHTMLImageMap() with XY charts successfully in the past and with no
problems. I am currently working on a SurfaceChart in JSP and getHTMLImageMap() is
returning a null object. Please see the code below.
Please respond asap as this is kind of urgent.
Thanks!
--------------------------------------------------------------------
<%@page import="ChartDirector.*" %>
<%
double[] dataX = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
double[] dataY = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0};
double[] dataZ = new double[(dataX.length) * (dataY.length)];
for (int yIndex = 0; yIndex < dataY.length; ++yIndex) {
double y = (dataY[yIndex] - 0.5) * 2 * 3.1416;
for (int xIndex = 0; xIndex < dataX.length; ++xIndex) {
double x = (dataX[xIndex] - 0.5) * 2 * 3.1416;
dataZ[yIndex * (dataX.length) + xIndex] = Math.sin(x) * Math.sin(y);
}
}
SurfaceChart c = new SurfaceChart(720, 540);
c.addTitle("Quantum Wave Function", "Times New Roman Italic", 20);
c.setPlotRegion(360, 245, 360, 360, 270);
c.setViewAngle(20, 30);
c.setData(dataX, dataY, dataZ);
c.setInterpolation(80, 80);
c.setSurfaceAxisGrid(0xdd000000);
c.setContourColor(0x80ffffff);
c.setColorAxis(645, 270, Chart.Left, 200, Chart.Right).setColorGradient();
c.xAxis().setTitle("x/L(x)", "Arial Bold", 10);
c.yAxis().setTitle("y/L(y)", "Arial Bold", 10);
c.zAxis().setTitle("Wave Function Amplitude", "Arial Bold", 10);
String chart1URL = c.makeSession(request, "chart1", Chart.JPG);
String imageMap1 = c.getHTMLImageMap("clickline.jsp"); // imageMap1 = null ??
%>
<html>
<body style="margin:5px 0px 0px 5px">
<div style="font-size:18pt; font-family:verdana; font-weight:bold">
Simple Clickable Bar Chart
</div>
<hr style="border:solid 1px #000080" />
<div style="font-size:10pt; font-family:verdana; margin-bottom:20">
<a href="viewsource.jsp?file=<%=request.getServletPath()%>">View Source
Code</a>
</div>
<img src="<%=response.encodeURL("getchart.jsp?"+chart1URL)%>" border="0"
usemap="#map1">
<map name="map1">
<%=imageMap1%>
</map>
</body>
</html> |
Re: getHTMLImageMap() is null for SurfaceChart |
Posted by Peter Kwan on Dec-05-2011 17:48 |
|
Hi Gil,
It is normal that that for a SurfaceChart, the getHTMLImageMap returns null. It is because in ChartDirector, the SurfaceChart does not have any clickable data points.
If you want the entire chart to be clickable as one object, you just need to use an <A> tag. There is no need to use an image map.
<a href="clickline.jsp"><img src="<%=response.encodeURL("getchart.jsp?"+chart1URL)%>" border="0"></a>
Hope this can help.
Regards
Peter Kwan |
|