Represents a hotspot on the image and provides events such as tool tips and
redirect URL when clicked.
Object Model
Syntax
Visual Basic (Declaration) | |
---|
Public Class Hotspot
Inherits Property |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As Hotspot
|
C# | |
---|
public class Hotspot : Property |
Example
This sample demonstrates how to use hotspots.
Visual Basic | Copy Code |
---|
<%@ 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"
Chart.DefaultElement.Hotspot.Attributes.OnMouseOver.StatusBarMessage = "%Name: %Value"
Chart.DefaultElement.Hotspot.Attributes.Custom.Add("OnClick", "alert('%Name Clicked')")
Chart.DefaultElement.Hotspot.ToolTip = "%Name: %Value"
Dim mySC As SeriesCollection = getRandomData()
Chart.SeriesCollection.Add(mySC)
End Sub
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
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
</script>
</HEAD>
<BODY>
<DIV align="center">
<dotnet:Chart id="Chart" runat="server" Width="568px" Height="344px">
</dotnet:Chart>
</DIV>
</BODY>
</HTML>
|
This sample demonstrates how to use hotspots.
C# | Copy Code |
---|
<%@ 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> |
Remarks
Inheritance Hierarchy
System.Object
dotnetCHARTING.Mapping.Drawing.Property
dotnetCHARTING.Hotspot
See Also