Page 1 of 2

error occured while moving marks manually

Posted: Mon Sep 25, 2006 10:28 am
by 6925851
enclosing error image while moving marks and this code i used to move

TeeCommander1.Chart = TChart1
For i = 0 To TChart1.SeriesCount - 1
For J = 0 To TChart1.Series(i).count - 1
TChart1.Environment.InternalRepaint
TChart1.Series(i).marks.Positions.POSITION(J).custom = True
TChart1.Series(i).marks.Positions.POSITION(J).LeftTop.Y = 100
Next J
Next i

Posted: Mon Sep 25, 2006 10:37 am
by narcis
Hi Aravind,

I'm not able to reproduce the problem here using v7.0.1.1 which is the latest version available at the client area. Which TeeChart version are you using?

version 7.0.07

Posted: Mon Sep 25, 2006 10:43 am
by 6925851
version 7.0.07

Posted: Mon Sep 25, 2006 10:48 am
by narcis
Hi Aravind,

Could you please download the version I told you and check if it works at your end?

Thanks in advance.

Posted: Mon Sep 25, 2006 10:57 am
by 6925851
i have download the latest version which is shown on the customer download page

version 7.1.1 but my activex shows after download 7.0.8

and also when i move the marks how to move the marks associ

Posted: Mon Sep 25, 2006 11:00 am
by 6925851
version 7.0.8 is working but marks are moved to 100,100 but the lines pointing from bar to marks are not moved , just the marks moved , linesconnected to bar to the marks does not moved ...? how can i move those lines ...

Posted: Mon Sep 25, 2006 11:24 am
by narcis
Hi Aravind,
i have download the latest version which is shown on the customer download page version 7.1.1 but my activex shows after download 7.0.8
Yes, it seems we forgot to change that.
version 7.0.8 is working but marks are moved to 100,100 but the lines pointing from bar to marks are not moved , just the marks moved , linesconnected to bar to the marks does not moved ...? how can i move those lines ...
Yes, marks arrows are not moved and I'm afraid they cannot be moved as marks can. However you can do something similar using annotation tools:

Code: Select all

Private Sub Form_Load()
    TeeCommander1.Chart = TChart1
    
    TChart1.Series(0).FillSampleValues 10
    
    For i = 0 To TChart1.SeriesCount - 1
        For j = 0 To TChart1.Series(i).Count - 1
            TChart1.Environment.InternalRepaint
            TChart1.Tools.Add tcAnnotate
            
            With TChart1.Tools.Items(TChart1.Tools.Count - 1).asAnnotation
                .Text = TChart1.Series(i).YValues.Value(j)
                .Shape.CustomPosition = True
                .Shape.Left = TChart1.Series(i).Marks.Positions.Position(j).LeftTop.X
                .Shape.Top = 100
                .Callout.Arrow.Visible = True
                .Callout.XPosition = TChart1.Series(i).CalcXPos(j)
                .Callout.YPosition = TChart1.Series(i).CalcYPos(j)
            End With
            
        Next j
        TChart1.Series(i).Marks.Visible = False
    Next i
End Sub

Posted: Mon Sep 25, 2006 12:09 pm
by 6925851
How about moving this annotation tool with mouse ..? can you send me code for moviing with mouse .....

Posted: Mon Sep 25, 2006 12:11 pm
by 6925851
and also if marks are able to move and how can marks line cannot be moved ....? is this a bug ..

Posted: Tue Sep 26, 2006 1:14 pm
by narcis
Hi Aravind,
and also if marks are able to move and how can marks line cannot be moved ....? is this a bug ..
No, this is not a bug, you can move the marks arrows using something like this:

Code: Select all

Public Sub fix_mark_position()
Dim i As Integer
Dim xval As Double, yval As Double
Dim x As Double, y As Double
Dim x_pos As Double, y_pos As Double
Dim XSerie As TeeChart.ISeries 

  Set XSerie = TChart1.Series(0)  

  For i = 0 To XSerie.Count - 1
     x = XSerie.CalcXPos(i)
     y = XSerie.CalcYPos(i)
     With XSerie.Marks.Positions.Position(i)
       xval = .ArrowFrom.x - x
       yval = .ArrowFrom.y - y
       .ArrowFrom.x = x
       .ArrowFrom.y = y 

       .LeftTop.x = .LeftTop.x - xval
       .LeftTop.y = .LeftTop.y - yval       

       .ArrowTo.x = .ArrowTo.x - xval
       .ArrowTo.y = .ArrowTo.y - yval
     End With
  Next i
End Sub
How about moving this annotation tool with mouse ..? can you send me code for moviing with mouse .....
You can also move annotation with the mouse as shown here:

Code: Select all

Option Explicit

Dim fdragging As Boolean
Dim fitem As Integer
Dim text As String

Private Sub Form_Load()
With TChart1
    .Aspect.View3D = False
    .AddSeries scLine
    .Series(0).FillSampleValues (50)
    .Zoom.Enable = False
End With
End Sub

Private Sub Command1_Click()
    TChart1.Tools.Add (tcAnnotate)
    With TChart1.Tools.Items(TChart1.Tools.Count - 1).asAnnotation
        .text = "hello"
        .Shape.CustomPosition = True
        .Shape.Left = 100
        .Shape.Top = 100
    End With
End Sub

Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
Dim i
    With TChart1.Tools
        For i = 0 To .Count - 1
            With .Items(i).asAnnotation.Shape
                If X >= .Left And X <= (.Left + TChart1.Canvas.TextWidth(TChart1.Tools.Items(i).asAnnotation.text)) Then
                    If Y >= .Top And Y <= (.Top + 15) Then
                        fdragging = True
                        fitem = i
                    End If
                End If
            End With
        Next i
    End With
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
If fdragging Then
    With TChart1.Tools.Items(fitem).asAnnotation
        .Shape.CustomPosition = True
        .Shape.Left = X
        .Shape.Top = Y
    End With
End If
End Sub

Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    fdragging = False
End Sub
Another alternative to annotation tool is using rectangle tool which can be dragged by default.

Posted: Wed Sep 27, 2006 8:59 am
by 6925851
i have posted the vb sample prg along with test.tee file
in this tee file i have multiple series .

once the form is loaded ,click on the move marks which will move the marks to the position to y=100 and then click on fix marks( code which is given to me for moving mark arrow )....

you can see the marks moved to y=100 but the lines connecting marks and bars does not moved properly

pls check
aravind

Posted: Wed Sep 27, 2006 10:22 am
by narcis
Hi Aravind,

Yes, you are right. Try changing the "fix marks" button code for this:

Code: Select all

Private Sub Command3_Click()
Dim i As Integer
Dim XSerie As TeeChart.ISeries

TChart1.Environment.InternalRepaint

For j = 0 To TChart1.SeriesCount - 1
  Set XSerie = TChart1.Series(j)

  For i = 0 To XSerie.Count - 1
     With XSerie.Marks.Positions.Position(i)
       .ArrowFrom.x = .LeftTop.x + (.Width / 2)
       .ArrowFrom.y = XSerie.CalcYPos(i)

       .ArrowTo.x = .ArrowFrom.x
       .ArrowTo.y = .LeftTop.y + .Height
     End With
  Next i
Next j
End Sub

Posted: Thu Oct 19, 2006 3:08 pm
by 9524108
i have inserted code , line are connecting to marks to the bar (straight )

if we move the marks again and excecute your code , lines are drawn straight not the custom position ..

is there any way we can draw the line as per the marks positions (where marks are moved user on random basis ) ...

aravind

Posted: Fri Oct 20, 2006 7:31 am
by narcis
Hi aravind,

Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

Posted: Fri Oct 20, 2006 10:25 am
by 9524108
sample app posted in newsgroup
issue 1:
steps

1. click on the move marks
2. move the marks using cursor
3.now click the fix marks
4. check how the lines are formed (lines are hanging)




issue 2;

reload the form
1.click on the move marks
2.click on the fix marks (lines connect from bar to mark)
3.now move the marks using mouse
4.now click on the move marks(reassing the positions), lines did not move
5.now i click again the fix marks , you can see lines are hanging from marks but no connectivity to the bars



aravind