Visual Basic (Declaration) | |
---|---|
Public Property EnableClickEvent As Boolean |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As FpChart Dim value As Boolean instance.EnableClickEvent = value value = instance.EnableClickEvent |
C# | |
---|---|
public bool EnableClickEvent {get; set;} |
Property Value
true
if the Click event can be used; otherwise, false
.The EnableClickEvent property specifies whether the Click event fires.
The MapAreaClick event fires if the RenderMapArea property is true and the EnableClickEvent property is false. If the RenderMapArea property is false and the EnableClickEvent property is true, only the Click event fires. If the RenderMapArea property is true and the EnableClickEvent property is true, the MapAreaClick event fires if the user clicks on a chart element. The Click event fires if the user clicks on the chart background.
The HotSpotMode property is used if RenderMapArea is true. HotSpotMode determines the behavior when the user clicks in a map area. The options are inactive, navigate, and post back. The inactive option is useful if you wish to display a tooltip in the map area. If the HotSpotMode is set to post back, the MapAreaClick and Client events are fired. If the RenderMapArea property is false, the HotSpotMode property has no effect.
C# | Copy Code |
---|---|
public FarPoint.Web.Chart.FpChart FpChart1; protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { FpChart1 = FpSpread1.ActiveSheetView.Charts[0]; FpChart1.RenderMapArea = true; FpChart1.HotSpotMode = HotSpotMode.PostBack; FpChart1.AutoGenerateMapAreaToolTip = true; FpChart1.EnableClickEvent = true; FpChart1.MapAreaClick += new FarPoint.Web.Chart.MapAreaClickEventHandler(FpChart1_MapAreaClick); return; FpChart1.Click += new System.Web.UI.ImageClickEventHandler(FpChart1_Click); } FpSpread1.Sheets[0].RowCount = 10; FpSpread1.Sheets[0].ColumnCount = 10; FpSpread1.Sheets[0].Cells[1, 0].Value = "s1"; FpSpread1.Sheets[0].Cells[2, 0].Value = "s2"; FpSpread1.Sheets[0].Cells[3, 0].Value = "s3"; FpSpread1.Sheets[0].Cells[4, 0].Value = "s4"; FpSpread1.Sheets[0].Cells[0, 1].Value = "c1"; FpSpread1.Sheets[0].Cells[1, 1].Value = 1; FpSpread1.Sheets[0].Cells[2, 1].Value = 2; FpSpread1.Sheets[0].Cells[3, 1].Value = 3; FpSpread1.Sheets[0].Cells[4, 1].Value = 4; FpSpread1.Sheets[0].Cells[0, 2].Value = "c2"; FpSpread1.Sheets[0].Cells[1, 2].Value = 7; FpSpread1.Sheets[0].Cells[2, 2].Value = 8; FpSpread1.Sheets[0].Cells[3, 2].Value = 9; FpSpread1.Sheets[0].Cells[4, 2].Value = 10; FpSpread1.Sheets[0].Cells[0, 3].Value = "c3"; FpSpread1.Sheets[0].Cells[1, 3].Value = 13; FpSpread1.Sheets[0].Cells[2, 3].Value = 14; FpSpread1.Sheets[0].Cells[3, 3].Value = 15; FpSpread1.Sheets[0].Cells[4, 3].Value = 16; FarPoint.Web.Spread.Model.CellRange range = new FarPoint.Web.Spread.Model.CellRange(0, 0, 4, 4); FpSpread1.Sheets[0].AddChart(range, typeof(FarPoint.Web.Chart.ClusteredBarSeries), 200, 200, 0, 0, FarPoint.Web.Chart.ChartViewType.View3D, false); FpChart1 = FpSpread1.Sheets[0].Charts[0]; FpChart1.RenderMapArea = true; FpChart1.HotSpotMode = HotSpotMode.PostBack; FpChart1.AutoGenerateMapAreaToolTip = true; FpChart1.EnableClickEvent = true; } protected void FpChart1_MapAreaClick(object sender, FarPoint.Web.Chart.MapAreaClickEventArgs e) { ListBox1.Items.Clear(); ListBox1.Items.Add("AreaIndex:" + e.MapAreaInfo.AreaIndex.ToString()); ListBox1.Items.Add("Coords:" + e.MapAreaInfo.Coords); ListBox1.Items.Add("MapAreaName:" + e.MapAreaInfo.MapAreaName); ListBox1.Items.Add("PointIndex:" + e.MapAreaInfo.PointIndex.ToString()); ListBox1.Items.Add("SeriesIndex:" + e.MapAreaInfo.SeriesIndex.ToString()); ListBox1.Items.Add("SubSeriesIndex:" + e.MapAreaInfo.SubSeriesIndex.ToString()); ListBox1.Items.Add("Type:" + e.MapAreaInfo.Type.ToString()); //FarPoint.Web.Chart.HitTest hitTest = this.FpChart1.HitTest(e.MapAreaInfo); //ListBox1.Items.Add(hitTest.ToString()); } protected void FpChart1_Click(object sender, ImageClickEventArgs e) { FarPoint.Web.Chart.HitTest hitTest = FpChart1.HitTest(e.X, e.Y); ListBox1.Items.Add("click event"); } |
Visual Basic | Copy Code |
---|---|
Public WithEvents FpChart1 As FarPoint.Web.Chart.FpChart Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If (Me.IsPostBack) Then FpChart1 = FpSpread1.ActiveSheetView.Charts(0) FpChart1.RenderMapArea = True FpChart1.HotSpotMode = HotSpotMode.PostBack FpChart1.AutoGenerateMapAreaToolTip = True FpChart1.EnableClickEvent = True Return End If FpSpread1.Sheets(0).RowCount = 10 FpSpread1.Sheets(0).ColumnCount = 10 FpSpread1.Sheets(0).Cells(1, 0).Value = "s1" FpSpread1.Sheets(0).Cells(2, 0).Value = "s2" FpSpread1.Sheets(0).Cells(3, 0).Value = "s3" FpSpread1.Sheets(0).Cells(4, 0).Value = "s4" FpSpread1.Sheets(0).Cells(0, 1).Value = "c1" FpSpread1.Sheets(0).Cells(1, 1).Value = 1 FpSpread1.Sheets(0).Cells(2, 1).Value = 2 FpSpread1.Sheets(0).Cells(3, 1).Value = 3 FpSpread1.Sheets(0).Cells(4, 1).Value = 4 FpSpread1.Sheets(0).Cells(0, 2).Value = "c2" FpSpread1.Sheets(0).Cells(1, 2).Value = 7 FpSpread1.Sheets(0).Cells(2, 2).Value = 8 FpSpread1.Sheets(0).Cells(3, 2).Value = 9 FpSpread1.Sheets(0).Cells(4, 2).Value = 10 FpSpread1.Sheets(0).Cells(0, 3).Value = "c3" FpSpread1.Sheets(0).Cells(1, 3).Value = 13 FpSpread1.Sheets(0).Cells(2, 3).Value = 14 FpSpread1.Sheets(0).Cells(3, 3).Value = 15 FpSpread1.Sheets(0).Cells(4, 3).Value = 16 Dim range As New FarPoint.Web.Spread.Model.CellRange(0, 0, 4, 4) FpSpread1.Sheets(0).AddChart(range, GetType(FarPoint.Web.Chart.ClusteredBarSeries), 200, 200, 0, 0, FarPoint.Web.Chart.ChartViewType.View3D, False) FpChart1 = FpSpread1.Sheets(0).Charts(0) FpChart1.RenderMapArea = True FpChart1.HotSpotMode = HotSpotMode.PostBack FpChart1.AutoGenerateMapAreaToolTip = True FpChart1.EnableClickEvent = True End Sub Protected Sub FpChart1_MapAreaClick(ByVal sender As Object, ByVal e As FarPoint.Web.Chart.MapAreaClickEventArgs) Handles FpChart1.MapAreaClick ListBox1.Items.Clear() ListBox1.Items.Add("AreaIndex:" + e.MapAreaInfo.AreaIndex.ToString()) ListBox1.Items.Add("Coords:" + e.MapAreaInfo.Coords) ListBox1.Items.Add("MapAreaName:" + e.MapAreaInfo.MapAreaName) ListBox1.Items.Add("PointIndex:" + e.MapAreaInfo.PointIndex.ToString()) ListBox1.Items.Add("SeriesIndex:" + e.MapAreaInfo.SeriesIndex.ToString()) ListBox1.Items.Add("SubSeriesIndex:" + e.MapAreaInfo.SubSeriesIndex.ToString()) ListBox1.Items.Add("Type:" + e.MapAreaInfo.Type.ToString()) 'Dim hit As FarPoint.Web.Chart.HitTest 'hit = FpChart1.HitTest(e.MapAreaInfo) 'ListBox1.Items.Add(hit.ToString()) End Sub Protected Sub FpChart1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles FpChart1.Click Dim hit As FarPoint.Web.Chart.HitTest hit = FpChart1.HitTest(e.X, e.Y) ListBox1.Items.Add("Click event") End Sub |
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family