You can get the slice of a Pie with a click using the following method:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim seriesIndex = 0 Dim pointIndex = 0 Private Sub C1Chart1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1Chart1.MouseMove Dim si, pi, d As Integer If C1Chart1.ChartGroups(0).CoordToDataIndex(e.X, e.Y, _ C1.Win.C1Chart.CoordinateFocusEnum.XandYCoord, si, pi, d) Then seriesIndex = si pointIndex = pi End If End Sub Private Sub C1Chart1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1Chart1.MouseClick MsgBox(C1Chart1.ChartGroups(0).ChartData(seriesIndex).Y(pointIndex)) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
var seriesIndex = 0; var pointIndex = 0; private void // ERROR: Handles clauses are not supported in C# C1Chart1_MouseMove(System.Object sender, System.Windows.Forms.MouseEventArgs e) { int si = 0; int pi = 0; int d = 0; if (C1Chart1.ChartGroups(0).CoordToDataIndex(e.X, e.Y, C1.Win.C1Chart.CoordinateFocusEnum.XandYCoord, si, pi, d)) { seriesIndex = si; pointIndex = pi; } } private void // ERROR: Handles clauses are not supported in C# C1Chart1_MouseClick(System.Object sender, System.Windows.Forms.MouseEventArgs e) { Interaction.MsgBox(C1Chart1.ChartGroups(0).ChartData(seriesIndex).Y(pointIndex)); } |