.netCHARTING v4.4 Documentation Send comments on this topic.
Hotspots
See Also
Getting Started > General Tutorials > Hotspots

Glossary Item Box

Introduction

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

 

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"

More Options

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

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

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')")

 

See Also