VerticalAxes.Right and Show Left Axes Range

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

VerticalAxes.Right and Show Left Axes Range

Post by martinx » Fri Mar 02, 2007 8:08 pm

Hi, i have the following Problem .
I have for example the following Values (show in the bottom Axes Dates)
100,200,300,400,500 .. 1000

100 are 0 percent and 1000 are 100 percent. I wanna now show in the left Scale Values from 100 to 1000

and on the right Axes i wanna Percent Values from 0 to 100

Now when i say .Styles.VerticalAxes.Right the Left Axes are not shown.
and the (fastline) is scalled to the right Axes.

How can i solve this Problem ?

Greetings Martin

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Mon Mar 05, 2007 10:26 am

Hi Martinx

If you want the Right and Left Axes you have to say "both" as below code:

Code: Select all

fastLine1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;
You can calculate the %, in the "_GetAxisLabel" event as below code:

Code: Select all

private void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
        {
            string fmt = "{0:##,##0.##} %";

            if (sender==tChart1.Axes.Right)               
            {
                double Value = Convert.ToDouble(e.LabelText);
                double percent = Value * 100 / fastLine1.MaxYValue();
                e.LabelText = string.Format(fmt, percent);

            }   
}
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

Hi Edu

Post by martinx » Tue Mar 06, 2007 6:34 pm

>fastLine1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;
that i have already done.
but my values are always orientated to the left . remember i want habe on the left values from
0 to 1000
and on the right percents from 0 to 100

now a fastline should display i have values 200,500,1000

the maxvalue is 1000 so i have values
(200/1000)*100 =20
(500/1000)*100 =50
(1000/1000)*100 =100
but when i show the fastline
they always scale the values to the left axes and not really show.

i want to scale it to the right axes (0-100)

can you help me ?

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Wed Mar 07, 2007 12:07 pm

Hi martinx

You can fix, that Chart begins to 0 with "SetMinMax" property as below code:

Code: Select all

 private void Form1_Load(object sender, EventArgs e)
        {
            tChart1.Aspect.View3D = false;
            tChart1.Axes.Left.SetMinMax(0, 1000);
            tChart1.Axes.Right.Grid.Visible = false;
            tChart1.Axes.Right.SetMinMax(0, 1000);

            for (int i=1;i<=10;i++)
            {
                fastLine1.Add(i, 100 * i);
            }
            fastLine1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both;
        }

        private void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
        {
            string fmt = "{0:##,##0.##} %";

            if (sender==tChart1.Axes.Right)               
            {
                double Value = Convert.ToDouble(e.LabelText);
                double percent = Value * 100 / fastLine1.MaxYValue();
                e.LabelText = string.Format(fmt, percent);
            }    
        }
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

Post by martinx » Sat Mar 10, 2007 8:00 pm

Hi edu,
> private void tChart1_GetAxisLabel(object sender, >Steema.TeeChart.GetAxisLabelEventArgs e)

i have not the problem with the labels i have the problem with the axes. (sorry iam german, and i am not sure to really to explain it)
i have on the left axes set min 0 max value 1000 ( an example) values
on the right axes i wanna have min 0 and max 100 (percent)
for example i have a value 500 the maxvalue is 1000
so i calculate the following value
(500/1000)*100 = 50 so i set tchart1.series(0).add(date,50)
(the series is a fastline)

(i set fastLine1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Both)

but the added values are not really visible i scaled always to the left and not to the right (0 to 100)

normally the line should go from the left side (500) to the right side (50)
but it always seems that he gets only the 50


i hope you understand what i want ?

greetings

martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

Post by martinx » Sat Mar 10, 2007 8:12 pm

Hi Edu, again me :)

i tested now serveral things. it only works when i say
fastLine1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.RIGHT !!

then it shows the correct values (for example (1000/1000)*100=100

but now the left axes is not displayed (with the values from 0 to 1000)
i also cannot show the left axes. is there a property that it will be displayed ?

Greetings

martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

Post by martinx » Sat Mar 10, 2007 8:24 pm

Hi , and again.
I have now tryed the following.
fastLine1.VertAxis = Steema.TeeChart.Styles.VerticalAxis.both
and scaled the left axes from 0 to 100 and the right axes from 0 to 1000 (the opposite of the last message)
then it works it shows me the correct axes and the correct values . but why it doesn't work when i wanna have on the left 0 to 1000 (minimum and maximum) and on the right axis (0 to 100)
greetings again :lol:

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Mon Mar 12, 2007 9:24 am

Hi Martinx

Here It's working fine using the last release (Build 2.0.2586.24038) and the code that I posted the last day. Which TeeChart version are you using? Could you please try with the last version?

If the problem persist could you please send us a simple example project we can run "as-is" to reproduce the issue here?

You can post your files either at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup or at our upload page
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

Post by martinx » Mon Mar 12, 2007 10:31 am

hi edu, thanks for your reply. i use the current version 2.0.2586.24039 (from the lastest update)
i sent you know my sample code where you can take a look on it.

greetings martin

martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

Post by martinx » Mon Mar 12, 2007 10:34 am

Okay i have sent it now :)

martinx
Newbie
Newbie
Posts: 13
Joined: Wed Apr 12, 2006 12:00 am

Post by martinx » Mon Mar 12, 2007 10:35 am

i have upload. because in the newsgroup it doesn't work

Betreff '@edu->vertical axes problem', Konto: 'www.steema.net', Server: 'www.steema.net', Protokoll: NNTP, Serverantwort: '437 (648) Transfer Failed - Do Not Try Again -- The Article is too large', Port: 119, Secure (SSL): Nein, Serverfehler: 437, Fehlernummer: 0x800CCCA9

Edu
Advanced
Posts: 206
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia

Post by Edu » Tue Mar 13, 2007 9:01 am

Hi Martinx

To achieve what you request you need to do something as in the code snippet I previously posted.

In your example you are adding in the serie the value of % and not the real value. You have to add the value and then calculate the % in the "GetAxisLabel" event as I told you.
Best Regards,
Edu

Steema Support Central
http://support.steema.com/

Post Reply