how to change marks position through code

TeeChart for ActiveX, COM and ASP
Post Reply
Aravind
Newbie
Newbie
Posts: 75
Joined: Fri Nov 15, 2002 12:00 am

how to change marks position through code

Post by Aravind » Thu Sep 21, 2006 11:48 am

how to change marks position through code ...

how to set marks to my coordinates

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

Post by Narcís » Thu Sep 21, 2006 12:06 pm

Hi Aravind,

You can do something like this:

Code: Select all

Private Sub Form_Load()
    TeeCommander1.Chart = tc
    tc.Axis.Left.SetMinMax 50, 130
    
    For i = 0 To tc.SeriesCount - 1
        With tc.Series(i)
            For j = 0 To 20
                'We populate the series with random values ranging from 40 to 150
                .Add ((150 - 40 + 1) * Rnd + 40), "", clTeeColor
            Next j
            
            For ii = 0 To .Count - 1
                If (.YValues.Value(ii) > tc.Axis.Left.Maximum) Then
                    tc.Environment.InternalRepaint
                    yValue = .CalcYPosValue(tc.Axis.Left.Maximum - 5)
                    .Marks.Positions.Position(ii).Custom = True
                    .Marks.Positions.Position(ii).LeftTop.Y = yValue
                    .Marks.Arrow.Visible = False
                Else
                    If (.YValues.Value(ii) < tc.Axis.Left.Minimum) Then
                        tc.Environment.InternalRepaint
                        yValue = .CalcYPosValue(tc.Axis.Left.Minimum + 5)
                        .Marks.Positions.Position(ii).Custom = True
                        .Marks.Positions.Position(ii).LeftTop.Y = yValue
                        .Marks.Arrow.Visible = False
                    End If
                End If
            Next ii
'            .Marks.Clip = True
        End With
    Next i
    
    tc.Repaint
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

Aravind
Newbie
Newbie
Posts: 75
Joined: Fri Nov 15, 2002 12:00 am

this does not work for requirement

Post by Aravind » Fri Sep 22, 2006 8:28 am

i want to read the existing marks positions ( because i have given user option to move the marks int he chart).

i need to get the marks positions and redraw on the same position ..

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 Sep 22, 2006 8:53 am

Hi Aravind,

You can easily place your marks with a position relative to the original one doing something like this:

Code: Select all

                    .Marks.Positions.Position(ii).LeftTop.Y = .Marks.Positions.Position(ii).LeftTop.Y - 10
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