.netCHARTING v10.3 Documentation
Hotspots

Introduction

Hotspots represent areas on the chart image that encapsulate interactive functionality. They also allow you to specify any custom HTML attributes of the generated image map <area> tags. The following objects all contain a Hotspot property.

  • Element
  • Annotation
  • Chart
  • EmptyElement
  • LegendEntry
  • Label (Version 4.0+)
  • Mapping.Shape (Version 4.1+)

 

Basic Functionality

To set the href, alt, or target attributes of the hotspot the following code can be used. In this case an element will be used as an example but similar code will work for other hotspots as well.

[C#]

Element el = new Element();
el.Hotspot.URL = "?elementName=%Name";
el.Hotspot.URLTarget = "_blank";
el.Hotspot.ToolTip = "%Name: %Value";
[Visual Basic]

Dim el As new Element()
el.Hotspot.URL = "?elementName=%Name"
el.Hotspot.URLTarget = "_blank";
el.Hotspot.ToolTip = "%Name: %Value"

Rich Tooltips

The ToolTip property can also parse and understand the label markup tagsInfoGrids, and MicroCharts. This provides the ability to specify format, layout, and styling inside the tooltip, as well as embedding images or pages that stream images. 

More Options

For more advanced java script attributes the Hotspot.Attributes property exposes a number of events:

  • OnClick
  • OnMouseOver
  • OnDoubleClick

Each of these events is an HtmlAttribute class that also exposes several actions that can be created automatically:

  • Alert
  • Redirect
  • RedirectFrame
  • StatusBarMessage

This example demonstrates all the automatic JavaScript attribute features:

[C#]

element.Hotspot.Attributes.OnMouseOver.StatusBarMessage = "%SeriesName - %Name: %YValue";
element.Hotspot.Attributes.OnClick.Alert= "%Name Clicked";
element.Hotspot.Attributes.OnDoubleClick.Redirect = "?name=%Name";
element.Hotspot.Attributes.OnDoubleClick.RedirectFrame = "?name=%Name";
[Visual Basic]

element.Hotspot.Attributes.OnMouseOver.StatusBarMessage = "%SeriesName - %Name: %YValue"
element.Hotspot.Attributes.OnClick.Alert= "%Name Clicked"
element.Hotspot.Attributes.OnDoubleClick.Redirect = "?name=%Name"
element.Hotspot.Attributes.OnDoubleClick.RedirectFrame = "?name=%Name";

 

Custom Attributes

There are several other events and JavaScript functions which are not available in the HtmlAttribute classes. For that reason, custom attributes can be specified. This code shows how to add one of the above attributes manually:

[C#]

element.Hotspot.Attributes.Custom.Add("OnClick","alert('%Name Clicked')");
[Visual Basic]

element.Hotspot.Attributes.Custom.Add("OnClick","alert('%Name Clicked')")

 

 

Notes and Limitations:

Ajax Zoomer:

  • Hotspot.Attributes are not supported, only Hotspot.URL and Hotspot.Tooltip can be used.
  • Markup is not allowed in Hotspot.Tooltip properties. Only text should be used. For example a new line character can be used instead of <br>.

Silverlight Navigator

  • Hotspot.Attributes are not supported, only Hotspot.URL and Hotspot.Tooltip can be used.
  • Markup however is usable in tooltips.

 

See Also