Page 1 of 1

About certain features

Posted: Thu Nov 01, 2007 5:47 pm
by 6927799
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

Posted: Mon Nov 05, 2007 11:59 am
by Pep
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