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

Message ListMessage List     Post MessagePost Message

  use getHTMLImageMap with RealTime chart
Posted by Doron on Feb-24-2011 23:34
Hi,

I try to use ImageMap at real time demo.
when I call the JSP from Other I can't see the tool Tip (or run javascript).

for example :
<%@page import="ChartDirector.*" %>
<%
// The data for the pie chart


     double[] data = {10, 20,30, 60};



// The labels for the pie chart
String[] labels = {StringHelper.reverseIt("הפסקה"),StringHelper.reverseIt("חולים"), StringHelper.reverseIt("אחר"), StringHelper.reverseIt("פנויים")};

// The depths for the sectors
double[] depths = {30, 20, 10, 10};

// Create a PieChart object of size 360 x 300 pixels, with a light blue (DDDDFF)
// background and a 1 pixel 3D border
PieChart c = new PieChart(360, 300, 0xddddff, -1, 1);

// Set the center of the pie at (180, 175) and the radius to 100 pixels
c.setPieSize(180, 175, 100);


c.setLabelFormat(
    "<*block,halign=center*>{label}\\n<*font=Arial,size=8*> {value} " +
    "({percent}%)<*/*>");




// Set the pie data and the pie labels
c.setData(data, labels);

// Draw the pie in 3D with variable 3D depths
c.set3D2(depths);

// Set the start angle to 225 degrees may improve layout when the depths of the
// sector are sorted in descending order, because it ensures the tallest sector is at
// the back.
c.setStartAngle(225);

// Output the chart
String chart1URL = c.makeSession(request, "chart3");

// Include tool tip for the chart
String imageMap1 = c.getHTMLImageMap("", "",
    "title='{label}: {value}K ({percent}%)'");
%>
<html>


<head>
    <script type="text/javascript" src="cdjcv.js"></script>

</head>


<body  marginwidth="0" marginheight="0" hspace="0" vspace="0" topmargin="0" leftmargin="0"  scroll=no>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td class = pheader24 align = center>
    
<img id = chart3 src='<%=response.encodeURL("getchart.jsp?"+chart1URL)%>'
    usemap="#map1" border="0">
<map name="map1"><%=imageMap1%></map>
</td>
</tr>
</table>
<%
try
{
    // stream the chart to the browser and terminate immediately
    out.clear();
    if (WebChartViewer.streamChart(response, c.makeChart2(Chart.PNG)))
        return;
}
catch (IllegalStateException e)
{
    // Some very old servers may not support streaming. So we are forced to redirect
    // to the browser to use the traditional method.
    response.sendRedirect(response.encodeRedirectURL("getchart.jsp?" +
        c.makeSession(request, "chart2")));
    return;
}
%>
</body>
</html>








I call the JSP from :

<%@ page import="rambam.util.jsp.*" %>
<%@ page contentType="text/html; charset=windows-1255" %>
<html>
<head>
    <script type="text/javascript" src="cdjcv.js"></script>
<link href="../styleNew.css" rel="STYLESHEET" type="text/css">

</head>
<body  marginwidth="0" marginheight="0" hspace="0" vspace="0" topmargin="0" leftmargin="0"  scroll=no>
<table    width="100%"   style="border-width:0px; border-collapse: collapse;BACKGROUND-COLOR: white "  >
                 <tr >
                     <th  class = pheaderTitleLeft  height = 28 width = 50%   align = left> </th>
                     <th  class = pheaderTitleRight  >
 
משנעים
 
                      </th>

                </tr>
</table>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td class = pheader24>
                <!-- ****** Here is the image tag for the chart image ****** -->
                <img id="chart3" src="coMultiDepthPie.jsp?chartId=chart3"  >
</td>
</tr>
</table>
<script>
// The followings is executed once every second
window.setInterval("JsChartViewer.get('chart3').streamUpdate();", 20000);
</script>
</body>
</html>





The chart is very nice but I cant see the tool Tip or run javascript/

Thanks for your help

Doron

  Re: use getHTMLImageMap with RealTime chart
Posted by Peter Kwan on Feb-25-2011 01:56
Hi Doron,

The code structure you are using cannot update the image map. According to the HTTP/HTML standard, it is impossible to update the image map by updating an <IMG> tag. You would need to use AJAX methods to update the image map.

Please refer to the following thread for an example:

http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1178038913#N1178048881

Hope this can help.

Regards
Peter Kwan