Function Pen Style

TeeChart for ActiveX, COM and ASP
Post Reply
Rossmc
Newbie
Newbie
Posts: 27
Joined: Wed Jul 28, 2004 4:00 am
Location: South Africa

Function Pen Style

Post by Rossmc » Fri Jul 22, 2005 2:32 pm

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jul 22, 2005 2:53 pm

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
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply