Page 1 of 2

how to find the x-axis position ?

Posted: Mon Mar 19, 2007 12:30 pm
by 9524108
how to find the x-axis position ?

when we plot any graph x and y -axis , i would lik to know the x-axis coordinates drawn in the tchart (say x=530,y=120 where tchart height =650 and 700)

and also when we insert the legend on the bottom / changing the label in the x-axis to 90% is moving the x-axis little bit up , but i would like to know the exact value of the x-axis .

reply asap

Posted: Mon Mar 19, 2007 2:22 pm
by narcis
Hi daryl,
when we plot any graph x and y -axis , i would lik to know the x-axis coordinates drawn in the tchart (say x=530,y=120 where tchart height =650 and 700)
You can obtain pixel screen coordinates from values using this:

Code: Select all

    X = TChart1.Axis.Bottom.CalcXPosValue(530)
    Y = TChart1.Axis.Left.CalcYPosValue(120)
Values from screen coordinates like this:

Code: Select all

    XVal = TChart1.Axis.Bottom.CalcPosPoint(650)
    YVal = TChart1.Axis.Left.CalcPosPoint(700)
and also when we insert the legend on the bottom / changing the label in the x-axis to 90% is moving the x-axis little bit up , but i would like to know the exact value of the x-axis .
You can obtain axis positions like this:

Code: Select all

    TChart1.Axis.Bottom.Position
    TChart1.Axis.Bottom.StartPosition
    TChart1.Axis.Bottom.EndPosition

posted word document with details inside

Posted: Mon Mar 19, 2007 3:57 pm
by 9524108
posted word document pls go through and reply me asap

Posted: Mon Mar 19, 2007 4:01 pm
by narcis
Hi daryl,

I think that you should use CalcXPosValue method. All methods are fully described in TeeChart's documentation.

Posted: Mon Mar 19, 2007 4:07 pm
by 9524108
if you plot the graph and check the calcposxvalue it is not returning the huge value

Posted: Mon Mar 19, 2007 4:09 pm
by narcis
Hi daryl,

Sorry but I don't understand what do you exactly mean. Could you please give us some more details about your problem?

Thanks in advance.

Posted: Mon Mar 19, 2007 4:36 pm
by 9524108
i have posted in the word document

for 2004 series in the graph y value is 202 and 752 for 2 points
in order to place/move the marks in the middle

for point 1 = (202- XAXIS.XVALUE )/2 + 202 so that it moves to the middle

similarly for point 2in 2004 =(752-202)/2 + 752

NOW SERIES ONE AND POINT 1 ONLY I HAVE issue because starting value is unknown but where as rest of the points i have 2 values .


so i need to find this starting value

Note: moving this marks to centre for stacked graph

Posted: Tue Mar 20, 2007 8:28 am
by narcis
Hi daryl,

Sorry but I still don't understand what are you exactly trying to achieve here. I'm afraid you are mixing X and Y coordinates here. Could you please send us a simple example project we can run "as-is" to reproduce the problem here and let us know how would you expect marks to be drawn?

Thanks in advance.

Posted: Tue Apr 03, 2007 10:00 am
by 9524108
Sample vb application is enclosed which replicates the Moving the marks into centre for stackgraph .

Once you go through the app ,you will be able to get an idea of wat my requirement , how ever requirement is achieved with an assumed x-axis position but to be precise , i need to know how to find the x-axis position


. Could you Pls reply ASAP

Posted: Tue Apr 03, 2007 11:11 am
by narcis
Hi daryl,

As I told you in previous messages, you can calculate bottom axis position much easily using TChart1.Axis.Bottom.Position. Have you tried using this?

Posted: Tue Apr 03, 2007 11:14 am
by 9524108
i tried but it is not giving exact value, if you open the sample application which i sent , and using yourmethod find the value and compare with my value in the app ,

Posted: Tue Apr 03, 2007 12:07 pm
by narcis
Hi daryl,

I've made a little modification to your project for calculation marks position. You can see the code below and this should be independent of legend's position or labels angle. I've also attached modified project at the newsgroups.

Code: Select all

       With TChart1.Series(i).Marks
        'MarkHeight = ((.ShapeBounds.Bottom - .ShapeBounds.Top))
        MarkHeight = 10

        .Arrow.Visible = False
        If i = 0 Then
            .Positions.Position(j).LeftTop.Y = TChart1.Axis.Bottom.Position + ((TChart1.Series(i).CalcYPos(j) - TChart1.Axis.Bottom.Position) / 2) - MarkHeight
        Else
            .Positions.Position(j).LeftTop.Y = TChart1.Series(i - 1).CalcYPos(j) + ((TChart1.Series(i).CalcYPos(j) - TChart1.Series(i - 1).CalcYPos(j)) / 2) - MarkHeight
        End If
       End With
Is this solution acceptable for you?

Posted: Tue Apr 03, 2007 12:55 pm
by 9524108
Hi Narcis ,

Thanks for the code

I have another kind of graph i.e. scArea with stacked 100% and stairs for this I want to keep the marks in centre how can I do , I am enclosed the sample project in the mail

Pls check and respond

Thanks
aravind

"NarcĂ­s Calvet" <support@steema.com> wrote in message news:<cesp0jedHHA.408@TEEPC.Steema.local>...
> Hi aravind,
>
> Please find attached your project modified as I told you in the forums.
>
>
> --
> Best Regards,
>
> Narcis Calvet
> Steema Support Central
> http://support.steema.com
>
> "Important note: If you are a TeeChart registered customer, please post your
> support questions at Steema's Support monitored Forums for customers:
> http://support.steema.com for a prompter reply."
>
> aravind wrote:
> > Sample vb application is enclosed . Could you Pls reply ASAP
>
>
>
>

Posted: Tue Apr 03, 2007 1:22 pm
by narcis
Hi daryl,

The same code I posted before works fine for this example. Have you tried using it there? If it is not what are you exactly looking for a similar approach should be used.

Posted: Tue Apr 03, 2007 1:46 pm
by 9524108
like in the stack graph , marks has to be moved in thecentre .when i use this code ,it stays on the to and does not move