Page 1 of 1

How do I add a pattern to only 1 bar in a bar chart

Posted: Wed Dec 13, 2006 4:42 pm
by 9082339
I have a bar chart and would like to be able to assign a pattern to one or more bars in the chart at runtime using vb6. If I use .asBar.BarBrush.Style = bsBDiagonal then all the bars have the pattern but I can't figure out how to assign a given pattern to only one bar.

Thanks

I am using v6.0.0.5.

Posted: Mon Dec 18, 2006 8:58 am
by Pep
Hi,

using the latest TeeChart Pro v7.013, available at the private customers download page, you coud use similar code to the following :

Code: Select all

Private Sub TChart1_OnGetSeriesBarStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, BarStyle As TeeChart.EBarStyle)
If ValueIndex = 1 Then
    TChart1.Series(0).asBar.BarBrush.Style = bsBDiagonal
Else
    TChart1.Series(0).asBar.BarBrush.Style = bsSolid
End If
End Sub

Posted: Mon Dec 18, 2006 9:44 am
by 9082339
Dear Josep,

Kind thanks for your response. It is shame that there is no way to access any point of series and assign it individual properties rather than through events. Reason I say this is that I have built a small wrapper class around Tchart and don't necessarily want the behaviour via the event for all bar charts I draw. As a workaround in the meantime I plotted two bar series and got the behaviour I wanted by setting the bar I want patterned as AddNullXY and the second series only contains the patterned bar whilst all other in the second series are Null points.