0

How can we Provide pattern only to a single Bar of the Series.Say Suppose my Series has 4 Bars On click on a Bar it pattern should be change. I know the functionality of changing Color of a Particular Point.

4

1 回答 1

0

您可以将模式存储在数组中并在OnGetSeriesBarStyle事件中设置它们。这里有一个例子:

Dim myPatterns() As Integer

Private Sub Form_Load()      
  TChart1.AddSeries scBar
  TChart1.Series(0).FillSampleValues

  ReDim myPatterns(TChart1.Series(0).Count)
  Dim i As Integer
  For i = LBound(myPatterns) To UBound(myPatterns)
    myPatterns(i) = 0
  Next i
End Sub


Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  If SeriesIndex > -1 And ValueIndex > -1 Then
    myPatterns(ValueIndex) = (myPatterns(ValueIndex) + 1) Mod 20
  End If

  TChart1.Repaint
End Sub

Private Sub TChart1_OnGetSeriesBarStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, BarStyle As TeeChart.EBarStyle)
  If SeriesIndex > -1 And ValueIndex > -1 Then
    TChart1.Series(SeriesIndex).asBar.BarBrush.ClearImage
    TChart1.Series(SeriesIndex).asBar.BarBrush.Style = myPatterns(ValueIndex)
  End If
End Sub
于 2013-08-08T11:36:49.913 回答