0
目前,我有叫tChart一個tChart控制形式:..在堆積的條形圖中,如何查找點擊了哪個欄?
Private Sub txtChart1_Click(sender As System.Object, e As System.EventArgs) Handles txtChart1.Click
TChart1.Series.Clear()
Dim series1 As New Steema.TeeChart.Chart
Dim FirstLabel = New Label()
FirstLabel.Name = "FirstLabel.Name"
FirstLabel.Text = " FirstLabel.Text"
Dim SecondLabel = New System.Windows.Forms.Label()
Dim GridBand = New Steema.TeeChart.Tools.GridBand()
'Main bar 1
Dim BarSeries1 = New Steema.TeeChart.Styles.Bar()
BarSeries1.Brush.Color = System.Drawing.Color.FromArgb(192, 255, 48)
BarSeries1.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked
BarSeries1.Pen.Color = Color.FromArgb(48, 255, 192)
BarSeries1.Title = "barSeries1"
BarSeries1.XValues.DataMember = "X"
BarSeries1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending
BarSeries1.YValues.DataMember = "Bar"
BarSeries1.Add({123, 123, 123, 123, 123})
TChart1.Series.Add(BarSeries1)
'Main bar 2
Dim BarSeries2 = New Steema.TeeChart.Styles.Bar()
BarSeries2.Brush.Color = System.Drawing.Color.FromArgb(48, 255, 192)
BarSeries2.MultiBar = Steema.TeeChart.Styles.MultiBars.Stacked
BarSeries2.Pen.Color = Color.FromArgb(48, 255, 192)
BarSeries2.Title = "barSeries2"
BarSeries2.XValues.DataMember = "X"
BarSeries2.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending
BarSeries2.YValues.DataMember = "Bar"
BarSeries2.Add({123, 123, 123, 123, 123})
TChart1.Series.Add(BarSeries2)
TChart1.Aspect.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
End Sub
...在同一個窗體類我有這樣的事件處理程序...
Private Sub TChart1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles TChart1.MouseDown
mouseX.Text = e.X
mouseY.Text = e.Y
If TChart1.Series.Count > 0 Then
Dim CollectionOfBars As New List(Of String)
For idxSeries As Integer = 0 To TChart1.Series.Count - 1
Dim srs As Steema.TeeChart.Styles.Bar = TChart1.Series(idxSeries)
If srs.BarBounds.Contains(e.X, e.Y) Then
CollectionOfBars.Add(srs.TitleOrName)
End If
Next
txtCollisions.Text = Join(CollectionOfBars.ToArray, ", ")
End If
End Sub
..但它所做的只是最後一堆酒吧的工作。我需要一些適用於所有酒吧的東西。
請幫忙。
看看下面... http://stackoverflow.com/questions/11316319/finding-series-item-clicked-in-a-chart-in-vb-2008/11317283 #11317283 – APrough