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

Message ListMessage List     Post MessagePost Message

  Adding Tooltip to custom symbols (images)
Posted by Brent Hetland on Feb-11-2014 22:59
Hi,

I am using version 5.0.3 of ChartDirector for .NET

I have added a ScatterLayer to my chart, so I can display custom symbols (from .png
files).  The symbols are displaying fine.

My goal is to add tooltips to the custom symbols.

Q.  Can I add tooltips to the custom symbols???

Here is what I've tried:

c.addExtraField(timeStatusImageTooltips)   'my 4th field is extra field3

.....  the code that sets up the chart and other layers is omitted here  .....

'The following lines all work fine...
Call c.setSearchPath(System.Web.HttpContext.Current.Server.MapPath("~"))
Dim imgLayer As ChartDirector.ScatterLayer =
c.addScatterLayer(dataPointNumbers, ChartDirector.Chart.CTime(latestEndDates), "", 1,
0, ChartDirector.Chart.Transparent, ChartDirector.Chart.Transparent)

Dim tb As ChartDirector.TextBox = imgLayer.setDataLabelStyle()
tb.setAlignment(5)
imgLayer.setDataLabelFormat("<*img={field1}*>")

'THIS LINE DOES NOTHING - I'd expect it to add a tooltip to my image
imgLayer.setHTMLImageMap("", "", "title='{field3}'")

Is it possible?  If so, what am I doing wrong?

Regards,
Brent

  Re: Adding Tooltip to custom symbols (images)
Posted by Peter Kwan on Feb-12-2014 02:14
Hi Brent,

Have you also added a line that calls getHTMLImageMap and set the image map to the
WinChartViewer or WebChartViewer?

For trouble-shooting, you may try:

imgLayer.setHTMLImageMap("aaa.aspx", "", "title='ABC {field1} XYZ'")

I used {field1} for testing the tooltip because {field1} is known to work (since your custom
symbols work). The ABC ... XYZ is to ensure something is visible even if the extra field does
not work. The "aaa.aspx" helps to determine if the image map exists (the cursor should
change to a hand shape if it is over an image map with a URL).

If you cannot even see the ABC ... XYZ, please try to view the HTML source code of the
web page (in some browsers, it may be right clicking on the web page, and choose view
page source). Please check if the image map does contain the title='ABC .... XYZ' attribute
and the HTML is well formed. Sometimes third party Javascript library or some special HTML
construction may disable the browser default tooltip from appearing. If you cannot find any
issue in the HTML, please save the entire web page as a "web archive" and include the web
archive in your message. I will try to open it to see if I can see the tooltip. (If you cannot
post the web archive in a public forum, you may email me at pkwan@advsofteng.net.

Regards
Peter Kwan

  Re: Adding Tooltip to custom symbols (images)
Posted by Brent Hetland on Feb-12-2014 03:38
Thanks Peter.

I think my problem was that I had set the symbol size to 0, when adding my ScatterLayer.
When I changed that to a number greater than 0 (15 in the example below), I was able to
see the tooltips when I hover over the image (and of course my image is in the same spot
where the symbol would be).

So, the code below gives me what I wanted.  I have a scatterLayer with my own custom
symbols (from image files), with tooltips on each image.

Call c.setSearchPath(System.Web.HttpContext.Current.Server.MapPath("~"))
Dim imgLayer As ChartDirector.ScatterLayer = c.addScatterLayer(dataPointNumbers,
ChartDirector.Chart.CTime(latestEndDates), "", 2, 15, ChartDirector.Chart.Transparent,
ChartDirector.Chart.Transparent)

Dim tb As ChartDirector.TextBox = imgLayer.setDataLabelStyle()
tb.setAlignment(5)

imgLayer.addExtraField(timeStatusImageTooltips)
imgLayer.setHTMLImageMap("", "", "title='{field0}'")
imgLayer.setDataLabelFormat("<*img={field1}*>")

This is resolved.

Thanks much for your reply.
Brent