Page 1 of 1

More than one line style for serie?

Posted: Wed Feb 01, 2006 11:40 am
by 9529394
It is possible to have more than one line style for a serie or it is necessary to create a serie for each style.
For instance:
I need to show an horitzonal line and every time that the Y values are <0 the line will be dashed and when Y values >=0 the line will be dotted.

It is possible to do this using the same serie?

Thanks.

Posted: Thu Feb 02, 2006 1:17 pm
by narcis
Hi PocJoc,

Yes, this is possible doing something like:

Code: Select all

Private Sub Form_Load()
    With TChart1
        .AutoRepaint = False
        .Series(0).Add 100, "", clTeeColor
        .Series(0).Add 50, "", clTeeColor
        .Series(0).Add 40, "", clTeeColor
        .Series(0).Add 44, "", clTeeColor
        .Series(0).Add 33, "", clTeeColor
        .Series(0).Add 13, "", clTeeColor
        .Series(0).Add 10, "", clTeeColor
        .Series(0).Add -10, "", clTeeColor
        .Series(0).Add -11, "", clTeeColor
        .Series(0).Add -19, "", clTeeColor
        .Series(0).Add -22, "", clTeeColor
        .Series(0).Add -30, "", clTeeColor
        .Series(0).Add -50, "", clTeeColor
        .Series(0).Add -45, "", clTeeColor
        .Series(0).Add -42, "", clTeeColor
        .Series(0).asLine.LinePen.Style = psDot
        .Series(0).asLine.Pointer.Visible = True
        .Series(0).asLine.Pointer.Brush.Style = bsClear
        .Series(0).asLine.Pointer.Pen.Visible = False
    End With
End Sub
 

Private Sub TChart1_OnGetSeriesPointerStyle(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, AStyle As TeeChart.EPointerStyle)
    If TChart1.Series(0).YValues.Value(ValueIndex) < 0 Then
        TChart1.Series(0).asLine.LinePen.Style = psDash
    Else
        TChart1.Series(0).asLine.LinePen.Style = psDot
    End If
End Sub