Axis and Origin

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
gs
Newbie
Newbie
Posts: 84
Joined: Mon Mar 20, 2006 12:00 am
Location: US

Axis and Origin

Post by gs » Thu Jan 15, 2009 5:21 pm

Hi,

I have two area series in a chart. I have added custom axis for left of first series and bottom of second series. There is no other axis displayed. I have couple of questions:

- When there is no data, the axis are moving to the middle ( looking like '+' ). I want the origin to be at left bottom always ( like 'L'). How do I achieve this?
- I move the left axis (programatically) to the last point plotted on the chart. But user should not be able to move the axis on the chart. How do I restrict that?

Thanks.

Regards
Kiran

gs
Newbie
Newbie
Posts: 84
Joined: Mon Mar 20, 2006 12:00 am
Location: US

Post by gs » Thu Jan 15, 2009 5:44 pm

Forgot to mention. I am using TeeChart v2 and for winforms.

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 Jan 16, 2009 9:33 am

Hi Kiran,
- When there is no data, the axis are moving to the middle ( looking like '+' ). I want the origin to be at left bottom always ( like 'L'). How do I achieve this?
The only solution I can think of is that you manually set axes minimum and maximum values before populating your series:

Code: Select all

			tChart1.Axes.Bottom.SetMinMax(0, 1);
			tChart1.Axes.Left.SetMinMax(0, 1);
			axis1.SetMinMax(0, 1);
			axis2.SetMinMax(0, 1);
When populating them you can set them back to automatic:

Code: Select all

			tChart1.Axes.Bottom.Automatic = true;
			tChart1.Axes.Left.Automatic = true;
			axis1.Automatic = true;
			axis2.Automatic = true;
- I move the left axis (programatically) to the last point plotted on the chart. But user should not be able to move the axis on the chart. How do I restrict that?
Do you give access to the chart editor to your users? If so the only options is hidding the axes tab as shown in the What's New?\Welcome !\New in Components\Commander\Custom Editor example in the features demo, available at TeeChart's program group.
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

gs
Newbie
Newbie
Posts: 84
Joined: Mon Mar 20, 2006 12:00 am
Location: US

Post by gs » Fri Jan 16, 2009 3:01 pm

Hi,

By custom axis, I mean, I am adding two ColorLines and setting their axis to Left and Bottom. Programatically I am setting their values:

tool1.Value = chart.Series[ seriesIndex ].XValues.Maximum;
tool2.Value = chart.Series[ seriesIndex ].YValues.Maximum;

I am not exposing any chart editor to the user. But the user is able to relocate these colorlines in the chart by using the mouse. I want to restrict this.

Setting min/max does not solve my problem. Y values can still be all 0s with all valid X values and in which case the bottom axis moves to the middle. I do not want this happen. The axis origin should be at left bottom always.

I think this clarifies my issues. Kindly help. Thanks.

Regards
Kiran

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 Jan 16, 2009 3:12 pm

Hi Kiran,
By custom axis, I mean, I am adding two ColorLines and setting their axis to Left and Bottom. Programatically I am setting their values:

tool1.Value = chart.Series[ seriesIndex ].XValues.Maximum;
tool2.Value = chart.Series[ seriesIndex ].YValues.Maximum;

I am not exposing any chart editor to the user. But the user is able to relocate these colorlines in the chart by using the mouse. I want to restrict this.
Ok, in that case you can prevent your users from dragging ColorLine tools like this:

Code: Select all

			colorLine1.AllowDrag = false;
BTW: You may also be interested in knowing of TeeChart's built-in custom axes feature. You'll find information at Tutorial 4 - Axis Control and examples at All Features\Welcome!\Axes in the features demo. Tutorials and demo can be found at TeeChart's program group.
Setting min/max does not solve my problem. Y values can still be all 0s with all valid X values and in which case the bottom axis moves to the middle. I do not want this happen. The axis origin should be at left bottom always.
I may not be understanding your problem but in the chase that all Y values are zero than you may also need to set left axis min. and max. values (e.g.: tChart1.Axes.Left.SetMinMax(-1,1);).

If this doesn't help please send us a simple example project we can run "as-is" to reproduce the problem here. You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
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