Page 1 of 1

Function Pen Style

Posted: Fri Jul 22, 2005 2:32 pm
by 9083304
I add a basic function as follows:
.AddSeries scLine
.Series(.SeriesCount - 1).Name = "MA"
.Series(.SeriesCount - 1).VerticalAxis = aRightAxis
.Series(.SeriesCount - 1).SetFunction tfMovavg
.Series(.SeriesCount - 1).DataSource = .Series(0)
.Series(.SeriesCount - 1).FunctionType.Period = 21
.Series(.SeriesCount - 1).Color = vbRed

I want user to be able to change the pen style to, for example psDash or psDotDash but this doesn't appear to work?

Posted: Fri Jul 22, 2005 2:53 pm
by narcis
Hi Rossmc,

The code below does what you request. However it can be better seen in 2D as in 3D series brush is solid but you can also change LineBrush as shown in the example

Code: Select all

Private Sub Command1_Click()
    With TChart1.Series(TChart1.SeriesCount - 1)
        .Pen.Style = psDot
        .asLine.LineBrush = bsBDiagonal
    End With
End Sub

Private Sub Form_Load()
    With TChart1
        With .Series(0)
            .FillSampleValues 100
            .Marks.Visible = False
        End With
        
        .Aspect.View3D = True
        .AddSeries scLine
        
        With .Series(.SeriesCount - 1)
            .Name = "MA"
            .VerticalAxis = aRightAxis
            .SetFunction tfMovavg
            .DataSource = TChart1.Series(0)
            .FunctionType.Period = 21
            .Color = vbRed
            .Pen.Style = psDashDot
            .asLine.LineBrush = bsVertical
        End With
    End With
End Sub