Page 1 of 1

Marks position restoring @ various resolution

Posted: Thu May 17, 2007 3:38 pm
by 9524108
for functionality reason ,i cannot be able to use the save and reloading of tee file , so i am storing the the chart contents in separate file as template
and storing the marks positions too
marks are moved ...
example :
With TChart1.Series(i).marks.Positions.Position(j)
A1 = .ArrowFrom.X
b1 = .ArrowFrom.Y
c1= .ArrowTo.X
d1= .ArrowTo.Y
e1 = LeftTop.X
f1= LeftTop.Y
end with

these are created and stored @ resolution 1024 x1280

now when i change the resolution to 800* 680 or some other resolution

i load the saved file and need to draw the marks @specified location with respect to the new resolution .. how can i calilbrate the new values from old values with respect to resolution ....

Could you Pls respond asap

Posted: Fri May 18, 2007 9:13 am
by 9524108
this sample1.tee file is created @ screen height=1024(15360) and screen width=1280(19200)
when i load on the sample resolution , no issues , marks load good as saved location
but when i load with different resolution , i change my tchart height and width (in original functionality fit all objects
inside the screen) then my marks does not show in the saved location..
i would definitely see the marks at the saved position irrespective of resolution and irrespective of height and width of the chart



Enclosed : sample project along with samplee teefile

Could you pls respond asap

Posted: Fri May 18, 2007 9:33 am
by narcis
Hi daryl,

To achieve what you request you should make a relative positioning of the marks. It should be relative to any dynamic chart element: axes, series, ChartRect, etc.

Routine setting custom marks position may also need to be executed after loading .tee file.

Posted: Fri May 18, 2007 11:07 am
by 9524108
Is there sample code available to start of with ..?

Posted: Fri May 18, 2007 11:13 am
by narcis
Hi Daryl,

Yes, the example I posted here on 3rd April 2007.

Posted: Mon May 21, 2007 3:01 pm
by 9524108
There are many parameters to consider for example ,
axis.left.position,axis,bottom.position ,height ,width ..

i have been working on this for the couple of days , still not able to sort out .

if you can send me sample program for simple tchart1.height/tchart.width change . then it will be really helpful

issue : for example i saved the tee file @ tchart- height =5000 & width =5000, with marks moved to specifi positions a,b then
i open the same file with different height and width of the tchart then my points are not drawn @ the same positions ..

Your help is needed asap ..

Posted: Tue May 22, 2007 8:32 am
by yeray
Hi Daryl,

We've made some tests using the following code and we found no differences between importing @1280x1024 and importing @800x600 a teefile from a chart exported @1280x1024:

Code: Select all

Private Sub Command1_Click()
    With CommonDialog1
        .Filter = "TeeFile (.tee)|*.tee"
        .ShowSave
        If .FileName <> "" Then
            TChart1.Export.asNative.SaveToFile .FileName, True
        End If
    End With
End Sub

Private Sub Command2_Click()
    With CommonDialog1
      .Filter = "Images (.tee)|*.tee"
      .ShowOpen
      If .FileName <> "" Then
        TChart1.Import.LoadFromFile .FileName
        'PositionMarks
      End If
    End With
End Sub

Private Sub Form_Load()
  TeeCommander1.Chart = TChart1
  TChart1.Aspect.View3D = False
  
  TChart1.AddSeries scLine
  TChart1.Series(0).FillSampleValues 10
  TChart1.Series(0).Pen.Width = 2
  TChart1.Series(0).Marks.Visible = True
  TChart1.Series(0).Marks.Arrow.Visible = False
  
  TChart1.Environment.InternalRepaint
  PositionMarks
End Sub

Private Sub PositionMarks()
    Dim i As Integer
    
    With TChart1.Series(0)
        For i = 0 To .Count - 1
            .Marks.Positions.Position(i).Custom = True
            .Marks.Positions.Position(i).LeftTop.Y = TChart1.Axis.Top.Position
        Next i
    End With
End Sub
If this code doesn't work for you, try uncommenting line 'PositionMarks at method Command2_Click() to recalculate marks positions.

Posted: Tue May 22, 2007 1:26 pm
by 9524108
chart height and width are dynamically ,
i have designed controls int he form to resize for the dynamic height and chart , when the chart height and width changes ... marks are not shown at ll ( this is for less height and width , if it is greater than original height and width,then all marks are visible )

Posted: Fri May 25, 2007 9:01 am
by yeray
We've made a project where you can resize the chart (width and height), save as .tee file, load from .tee file.

We coudn't reproduce the problem here so, please, test this project and feel free to modify it to obtain a project where we can see the issue.

But we think you should do something similar than what we do.

The project I'm talking about is posted at news://www.steema.net/steema.public.attachments newsgroup

Posted: Tue May 29, 2007 3:38 pm
by 9524108
coulnot able to find the reply @newgroup

Posted: Wed May 30, 2007 7:29 am
by yeray
Look for a post with the following subject:

To Daryl: relative to http://www.teechart.net/support/viewtopic.php?t=6024

At date: Friday, 25th of May of 2007 at 11:01

It could also be a possibility that there was a synchronization problem between the newsgroup server and your news reader. If you still don't see the message mentioned please reset the newsgroups messages and load them again.

Posted: Wed May 30, 2007 9:14 am
by 9524108
thx for theproject ,

in the sample project the , try to use dragmarks tool and put the marks in the middle , save the lt @x height then loaded the lt @ y height

marks moved ..?

Posted: Thu May 31, 2007 10:14 am
by yeray
Hi Daryl,

As you can see in the method called PositionMarks, we use relative positions to calculate each mark position. I mean a mark is positioned in relation with left axis top/bottom and in relation with the coresponding x position point.

Note that when you move a mark with DragMarks Tool, you are positioning the mark using absolute positions.

Also, if you take a look at the "load from tee file button", you can see that we call the method PositionMarks to re-position them according to a possible new chart size.