New to Hotspots

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Okie
Newbie
Newbie
Posts: 3
Joined: Mon Nov 25, 2002 12:00 am

New to Hotspots

Post by Okie » Tue Jan 03, 2006 3:29 pm

I'm trying to get a simple chart with hot spots, then have the URL say something like "www.test.asp?type=A" or "www.test.asp?type=B", depending on which bar I click

I found the standard hotspot example - it works somewhat, but ALL the bars in the graph are ponting to the same destination. How do I differentiate the hotspots between the bars?

See code below.

DataSet masterDataSet = new DataSet();
Bar bar1 = new Steema.TeeChart.Styles.Bar(WebChart1.Chart);
try
{
OpenConn(ref masterDataSet, "1");
DataTable appTable = masterDataSet.Tables["Applications"];
bar1.YValues.DataMember = appTable.Columns["Counter"].ToString();
bar1.LabelMember = appTable.Columns["appStage"].ToString();
bar1.DataSource = appTable;

//Add Tooltip
Steema.TeeChart.Chart Chart1 = WebChart1.Chart;
Steema.TeeChart.Tools.SeriesHotspot seriesHotSpot1 = new Steema.TeeChart.Tools.SeriesHotspot(Chart1);
seriesHotSpot1.MapAction = Steema.TeeChart.Styles.MapAction.Mark;

//Add Hotspot Destination

seriesHotSpot1.MapAction = Steema.TeeChart.Styles.MapAction.URL;
seriesHotSpot1.GetHTMLMap += new Steema.TeeChart.Tools.SeriesHotspotEventHandler(seriesHotSpot1_GetHTMLMap);
}
catch (SecurityException) {
//lblMsg.Text = "Error in Connection...";
}


private void seriesHotSpot1_GetHTMLMap(Steema.TeeChart.Tools.SeriesHotspot sender, Steema.TeeChart.Tools.SeriesHotspotEventArgs e)
{
e.PointPolygon.Title = "Go to the Steema web";
e.PointPolygon.HREF = "http://www.test.com"; //All the bars are going to this destination. How do I differentiate between bars?
e.PointPolygon.Attributes = "target='bottomFrame'";
}

Thanks in Advance!

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Jan 03, 2006 4:08 pm

Hi -

You can use the e.PointPolygon.ValueIndex property, e.g.

Code: Select all

		private Steema.TeeChart.Styles.Bar bar1;
		private Steema.TeeChart.Tools.SeriesHotspot seriesHotSpot;
		private void Page_Load(object sender, System.EventArgs e)
		{
			seriesHotSpot = new Steema.TeeChart.Tools.SeriesHotspot(WebChart1.Chart);
			WebChart1.Chart.Aspect.View3D = true;
			bar1 = new Steema.TeeChart.Styles.Bar(WebChart1.Chart);
			bar1.FillSampleValues(); 
			seriesHotSpot.Series = bar1;
			seriesHotSpot.MapAction = Steema.TeeChart.Styles.MapAction.URL;
			seriesHotSpot.GetHTMLMap +=new Steema.TeeChart.Tools.SeriesHotspotEventHandler(seriesHotSpot_GetHTMLMap);
		}

		private void seriesHotSpot_GetHTMLMap(Steema.TeeChart.Tools.SeriesHotspot hotspot, Steema.TeeChart.Tools.SeriesHotspotEventArgs e) 
		{
			switch(e.PointPolygon.ValueIndex) 
			{
				case 0:
					e.PointPolygon.Title = "Go to the Microsoft web"; 
					e.PointPolygon.HREF = "http://www.microsoft.com";
					e.PointPolygon.Attributes = "target='bottomFrame'"; 
					break;
				default:
					e.PointPolygon.Title = "Go to the Steema web"; 
					e.PointPolygon.HREF = "http://www.steema.com";
					e.PointPolygon.Attributes = "target='bottomFrame'"; 
					break;
			}
		}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Okie
Newbie
Newbie
Posts: 3
Joined: Mon Nov 25, 2002 12:00 am

Post by Okie » Tue Jan 03, 2006 4:11 pm

Thanks Chris!

Post Reply