Page 1 of 1

New to Hotspots

Posted: Tue Jan 03, 2006 3:29 pm
by 8719701
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!

Posted: Tue Jan 03, 2006 4:08 pm
by Chris
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;
			}
		}

Posted: Tue Jan 03, 2006 4:11 pm
by 8719701
Thanks Chris!