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

TeeChart for ActiveX, COM and ASP
Post Reply
psc
Newbie
Newbie
Posts: 16
Joined: Wed May 05, 2004 4:00 am

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

Post by psc » Wed Dec 13, 2006 4:42 pm

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.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Dec 18, 2006 8:58 am

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

psc
Newbie
Newbie
Posts: 16
Joined: Wed May 05, 2004 4:00 am

Post by psc » Mon Dec 18, 2006 9:44 am

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.

Post Reply