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

Message ListMessage List     Post MessagePost Message

  How to embed image with tooltips in an email?
Posted by Shruti Seth on Aug-26-2016 14:39
I need to embed chart images created through chardirector in emails sent using gmail smtp.
Currently, I am able to embed only the images in the email using BaseChart.makechart() method that creates the image in the specified location and appending the img src in the returnString but if I try to append image map in the returnString for this image in the HTML for email; the email gets distorted towards the end of the mail(some tags from the map are vsiisble in the mail after the image) and the tooltip is also not functional unless the mail is in draft mode. What is the ideal way to get the image map so that I can display the tooltips for these charts along with these charts in an email which will be visible to the user along with their tooltips without any distortion in the email.
I am using Java.

PFB the current code that I am using to create and set the image and image map ;store the image; and then embedding it in the email(returnString):


viewer.setImageMap(c.getHTMLImageMap("clickable", "",
            "title='{label}:{value}'"));

String imgSrc = directory + "//Funnel"+chartCount+".png";

c.makeChart(imgSrc);
returnString.append("<img src= "cid:funnel"+chartCount+"" usemap='map'>");
returnString.append("<map name='map'>");
returnString.append(viewer.getImageMap());
returnString.append("</map></br>");


Will it work properly if I replace  "returnString.append(viewer.getImageMap());" with "returnString.append(c.getHTMLImageMap("clickable", "","title='{label}:{value}'"));" ?

  Re: How to embed image with tooltips in an email?
Posted by Shruti Seth on Aug-26-2016 15:53
It doesn't work even after replacing with "returnString.append(c.getHTMLImageMap("clickable", "","title='{label}:{value}'"));" and the email is distorted again and no tooltip is visible to the user receiving the email.

  Re: How to embed image with tooltips in an email?
Posted by Peter Kwan on Aug-26-2016 17:30
Hi Shruti,

ChartDirector can only ensure that it generates the correct image and image map. You would need to develop the necessary code to put them into a web page or an email.

To test if the image and image map is valid, instead of creating an email, please create an HTML web page in your hard disk, and try the web page to see if it works.

Anyway, by reading your code, there are some issues. First, the usemap attribute seems to be incorrect. It should point to the URL of the image map. Because the image map is usually in the same page as the <img>, so it should be a link to part of the same map, like "#map". (You probably know that in HTML, the "#" refers to an anchor in the same web page.)

The "</br>" appears incorrect as I am not aware of such a tag. Do you mean "<br />"?

The "clickable" URL is not necessary, as it is a URL used in desktop applications. Please replace it with "".

I am not sure how the returnString is used in your code. Make sure it is used as HTML. If it is used as text, some system may automatically escape HTML characters. So instead of sending "<map>" in the email, it may end up as "&>map&<" and so will be displayed as text instead of being interpreted as HTML.

If you need further help, you can consider to send the email generated by your code to me  at pkwan@advsofteng.net. I can check the email to see if it does contain HTML or if the image map is treated as text.

Regards
Peter Kwan

  Re: How to embed image with tooltips in an email?
Posted by Peter Kwan on Aug-26-2016 17:31
Hi Shruti,

Sorry, in the above email, I mean the "<map>" in the email may end up as "&gt;map&lt;" if it is treated as text.

Regards
Peter Kwan