目前我有一个名为 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
...但它的作用只适用于最后一堆酒吧。我需要适用于所有酒吧的东西。
请帮忙。