About certain features

TeeChart for ActiveX, COM and ASP
Post Reply
Hermes
Newbie
Newbie
Posts: 54
Joined: Tue Feb 04, 2003 5:00 am
Location: Montevideo, Uruguay

About certain features

Post by Hermes » Thu Nov 01, 2007 5:47 pm

In a bar chart with a serie and some points, to represent one more measure we want to color bars by density (as in the polygons of a map) there is that possibility? Or in the same chart, adjust the width of the bars with this second measure?
Another, instead a bar serie, with a point serie? color or size with a second measure?

thank you

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

Post by Pep » Mon Nov 05, 2007 11:59 am

Hi Hermes,

for Bar Series, the only way would be to change the Color for specific bars, by using the OnGetBarStyle event (as in the following code). The size of the bars cannot be changed (it's on our wish list for further releases).

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scBar
    .Aspect.View3D = False
    .Series(0).AddXY 0, 10, "", clTeeColor
    .Series(0).AddXY 1, 5, "", clTeeColor
    .Series(0).AddXY 2, 14, "", clTeeColor
    .Series(0).AddXY 3, 11, "", clTeeColor
End With
TChart1.Environment.InternalRepaint
End Sub

Private Sub TChart1_OnGetSeriesBarStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, BarStyle As TeeChart.EBarStyle)
If TChart1.Series(0).YValues.Value(ValueIndex) > 10 Then
    TChart1.Series(0).PointColor(ValueIndex) = vbGreen
End If
End Sub
For Point Series both (size and color) can be changed manually by using the OnGetSeriesPointerStyle event. See the code below :

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scPoint
    .Aspect.View3D = False
    .Series(0).AddXY 0, 10, "", clTeeColor
    .Series(0).AddXY 1, 5, "", clTeeColor
    .Series(0).AddXY 2, 14, "", clTeeColor
    .Series(0).AddXY 3, 11, "", clTeeColor
End With
TChart1.Environment.InternalRepaint
End Sub

Private Sub TChart1_OnGetSeriesPointerStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, AStyle As TeeChart.EPointerStyle)
With TChart1.Series(0)
If .YValues.Value(ValueIndex) > 10 Then
    .PointColor(ValueIndex) = vbGreen
    .asPoint.Pointer.HorizontalSize = 10
    .asPoint.Pointer.VerticalSize = 10
Else
    .asPoint.Pointer.HorizontalSize = 5
    .asPoint.Pointer.VerticalSize = 5
End If
End With
End Sub

Post Reply