See Also

Hotspot Members  | dotnetCHARTING Namespace

Language

Visual Basic

C#

Show All

See Also Languages dotnetCHARTING Send comments on this topic.

Hotspot Class

Represents a hotspot on the image and provides events such as tool tips and redirect URL when clicked.

For a list of all members of this type, see Hotspot members.

Object Model


Inheritance Hierarchy

System.Object
   dotnetCHARTING.Hotspot

Syntax

[Visual Basic]
Public Class Hotspot
[C#]
public class Hotspot

Remarks

For more information, see tutorial:
Getting Started > General Tutorials > Interactivity - Hotspots

Example

[Visual Basic] This sample demonstrates how to use hotspots.

<%@ Page Language="VB" Description="dotnetCHARTING Component" %>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<HTML>
    <HEAD>
        <TITLE>.netCHARTING Sample</TITLE>
        <script runat="server">

Sub Page_Load(sender As [Object], e As EventArgs)

   Chart.Type = ChartType.Combo
   Chart.Width = Unit.Parse(600)
   Chart.Height = Unit.Parse(350)
   Chart.TempDirectory = "temp"
   Chart.Debug = True
   Chart.Title = "Hotspots"


   ' This sample demonstrates how to use hotspots.
   Chart.DefaultElement.Hotspot.Attributes.OnMouseOver.StatusBarMessage = "%Name: %Value"
   Chart.DefaultElement.Hotspot.Attributes.Custom.Add("OnClick", "alert('%Name Clicked')")
   Chart.DefaultElement.Hotspot.ToolTip = "%Name: %Value"


   ' *DYNAMIC DATA NOTE*
   ' This sample uses random data to populate the chart. To populate
   ' a chart with database data see the following resources:
   ' - Classic samples folder
   ' - Help File > Data Tutorials
   ' - Sample: features/DataEngine.aspx
   Dim mySC As SeriesCollection = getRandomData()

   ' Add the random data.
   Chart.SeriesCollection.Add(mySC)
End Sub 'Page_Load


Function getRandomData() As SeriesCollection
   Dim SC As New SeriesCollection()
   Dim myR As New Random(1)
   Dim a As Integer
   For a = 0 To 3
      Dim s As New Series()
      s.Name = "Series " +Convert.ToString(a + 1)
      Dim b As Integer
      For b = 0 To 3
         Dim e As New Element()
         e.Name = "Element " +Convert.ToString(b + 1)
         e.YValue = myR.Next(50)
         s.Elements.Add(e)
      Next b
      SC.Add(s)
   Next a

   ' Set Different Colors for our Series
   SC(0).DefaultElement.Color = Color.FromArgb(49, 255, 49)
   SC(1).DefaultElement.Color = Color.FromArgb(255, 255, 0)
   SC(2).DefaultElement.Color = Color.FromArgb(255, 99, 49)
   SC(3).DefaultElement.Color = Color.FromArgb(0, 156, 255)

   Return SC
End Function 'getRandomData

</script>
    </HEAD>
    <BODY>
        <DIV align="center">
            <dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px">
            </dotnet:Chart>
        </DIV>
    </BODY>
</HTML>

[C#] This sample demonstrates how to use hotspots.

<%@ Page Language="C#" Description="dotnetCHARTING Component" %> 
<%@ Register TagPrefix="dotnet"  Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%> 
<%@ Import Namespace="System.Drawing" %> 
<%@ Import Namespace="System.Drawing.Drawing2D" %> 
<HTML> 
    <HEAD> 
        <TITLE>.netCHARTING Sample</TITLE> 
        <script runat="server"> 
 
void Page_Load(Object sender,EventArgs e) 

 
    Chart.Type = ChartType.Combo;//Horizontal; 
    Chart.Width = 600; 
    Chart.Height = 350; 
    Chart.TempDirectory = "temp"; 
    Chart.Debug = true; 
    Chart.Title = "Hotspots"; 
     
     
    // This sample demonstrates how to use hotspots. 
     
    Chart.DefaultElement.Hotspot.Attributes.OnMouseOver.StatusBarMessage = "%Name: %Value"; 
    Chart.DefaultElement.Hotspot.Attributes.Custom.Add("OnClick","alert('%Name Clicked')"); 
    Chart.DefaultElement.Hotspot.ToolTip = "%Name: %Value"; 
     
     
    // *DYNAMIC DATA NOTE*  
    // This sample uses random data to populate the chart. To populate  
    // a chart with database data see the following resources: 
    // - Classic samples folder 
    // - Help File > Data Tutorials 
    // - Sample: features/DataEngine.aspx 
    SeriesCollection mySC = getRandomData(); 
 
    // Add the random data. 
    Chart.SeriesCollection.Add(mySC); 
         

 
SeriesCollection getRandomData() 

    SeriesCollection SC = new SeriesCollection(); 
    Random myR = new Random(1); 
    for(int a = 0; a < 4; a++) 
    { 
        Series s = new Series(); 
        s.Name = "Series " + (a+1); 
        for(int b = 0; b < 4; b++) 
        { 
            Element e = new Element(); 
            e.Name = "Element " + (b+1); 
            e.YValue = myR.Next(50); 
            s.Elements.Add(e); 
        } 
        SC.Add(s); 
    } 
 
    // Set Different Colors for our Series 
    SC[0].DefaultElement.Color = Color.FromArgb(49,255,49); 
    SC[1].DefaultElement.Color = Color.FromArgb(255,255,0); 
    SC[2].DefaultElement.Color = Color.FromArgb(255,99,49); 
    SC[3].DefaultElement.Color = Color.FromArgb(0,156,255); 
 
    return SC; 

        </script> 
    </HEAD> 
    <BODY> 
        <DIV align="center"> 
            <dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px"> 
            </dotnet:Chart> 
        </DIV> 
    </BODY> 
</HTML> 

See Also

Hotspot Members  | dotnetCHARTING Namespace

 

 


2002 - 2005 Webavail Productions Inc. & Corporate Web Solutions Ltd.. All Rights Reserved.