The axis tends to jump when a series is being added

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

The axis tends to jump when a series is being added

Post by usc » Tue Sep 11, 2007 6:50 am

Hi

The problem that i am facing is that whenever i add a series to chart dynamically, all the axes name left, right and custom(second left) axis tens to jump side ways.

Also based on the series visible or invisible, I want to show or hide the corresponding axes. Is there a way by which i can check which all axes needs to be made visible.

can u send me a link where I can attach the screen shots related to the problem specification for a better understanding.

Regards,
uday(usc)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 12, 2007 9:38 am

Hi Uday,

I'm not able to reproduce the problem here. Also, if no series associated to an axis are visible the axis won't be visible too.

You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

It would also be very helpful if you included a simple example project we can run "as-is" to reproduce the problem here.

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

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Wed Sep 12, 2007 11:34 am

Hi Narcis,

Please find the following document which illustrates the problem that I am facing currently.

Issues with plotting changes for Reservoir Plots.doc

I could not explain to you the problem correctly.
let be make myself clear.I have different plot groups and number of series associated with each plot group.If I select a plot group, then the series associated with the corresponding plot groups should be made visible and vice-versa.

The series are plotted with respect to three different axes.Some are with respect to the LeftAxis, some with Right Axis and other with Second Left axis(i.e., Custom axis).


My requirement is to check if no series corresponding to a particular axis belonging to any of the selected plotgroups is visible, then the correponding axis should also be made invisible.

Aso when I elect a plot group and make the series(as well as axes) visible or invisible, the axes tend to jump sideways.

i hope I have made myself clear,

regards,
uday(usc)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 12, 2007 11:56 am

Hi Uday,

Thanks for the document, it helped me understand your exact problem.
My requirement is to check if no series corresponding to a particular axis belonging to any of the selected plotgroups is visible, then the correponding axis should also be made invisible.
As I told you before, this should be default behavior and it seems to me it is in the screenshots you posted, isn't it?
Aso when I elect a plot group and make the series(as well as axes) visible or invisible, the axes tend to jump sideways.
Would you be so kind to arrange a simple example project we can run "as-is" to reproduce the problem here and see how do you use custom axes?

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

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Wed Sep 12, 2007 1:29 pm

Hi Narcis
My requirement is to check if no series corresponding to a particular axis belonging to any of the selected plotgroups is visible, then the correponding axis should also be made invisible.


As I told you before, this should be default behavior and it seems to me it is in the screenshots you posted, isn't it?
I am having problem achieving this I was trying to use the following code

private void tChart1_BeforeDrawAxes(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
//Loop through each of the series in the series collection of the chart.
//If the series is visible then make the corresponding vertical axis visible.
foreach (Series ser in g.Chart.Series)
{
if (ser.Visible)
{
ser.GetVertAxis.Visible = true;
}
}
}

and also looping through the series and making the series visible or invisible based on the checked state of thecheck box in the plot groups.

I will try to prepare a sample and upload it to you but it would be helpful if you can clarify whether my approach is proper or not .

thanks and Regards,
uday

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 12, 2007 1:34 pm

Hi Uday,

Thanks for the information.

Yes, this seems fine to me but you may also need to enable custom axes so I'd add the line below to your code as well.

Code: Select all

ser.CustomVertAxis.Visible = true;
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

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Tue Sep 18, 2007 1:02 pm

Hi Narcis

The piece of code which you had mentioned for enabling the custom axis:

Code: Select all

ser.CustomVertAxis.Visible = true;
The value of CustomVertAxis is coming to be null in my case.

Do we have to set this value anywhere?

Regards,
uday

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Sep 18, 2007 1:27 pm

Hi uday,

In that case you can try using something like the code below when you set which series are visible or not

Code: Select all

			if (ser.CustomVertAxis == null)
				ser.GetVertAxis.Visible = true;
			else
				ser.CustomVertAxis.Visible = true;
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

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Wed Sep 19, 2007 1:24 pm

Hi Narcis,

Please find the file
test.zip
in your upload page.
I have uploaded a sample application indicating the problems mentioned above.Also find in the zip file a document
TeeChart Series issue

describing the software details and the issues facde by us.

The values are hardcoded and the code is definitely not perfect due to time constraint but I hope it would be helpful.

I would request you to kindly have a look at the issues along with the previous screen shots sent across by me and help me out in solving them.

Thanks and regards,
Uday

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 19, 2007 3:08 pm

Hi Uday,

Thank you very much for the example project. I had to remove all Infragistics components references and rearrange it a little bit but finally could reproduce your issues here. Please find below the answers to your questions:

1. This is because you initialize the custom vertical axis to RelativePostion=-5. As the property self explains it is a percentage relative position to the size of the chart. You have 2 options, either increase the value of the property or set it to a fix pixel value using the line below before setting its position:

Code: Select all

						axisV.PositionUnits = PositionUnits.Pixels;
2. This is as designed. ChartRect (area where the chart is drawn and delimited by default axes) resizes itself to fit the axes and corresponding labels for the series visible at every moment.

3. This is the same as in 2. If series associated to right axis are displayed then the chart resizes to fit the right axis or not.

4. This is because in the OnBeforeDrawAxes event you show or hide axes according series visibility. However, since the custom axis has several series associated, corresponding to different groups, it is finally hidden because the last series corresponds to a group which is not being displayed and therefore the axes isn't displayed. To solve this I'd recommend you to remove the event and use the code below at the end of the listView1_ItemCheck method.

Code: Select all

//rest of the method above

						foreach (Steema.TeeChart.Styles.Series s in tChart1.Series)
						{
								s.GetVertAxis.Visible = HasOneVisibleSeries(s.GetVertAxis);
						}

						if (tChart1.Axes.Left.Visible)
						{
							tChart1.Axes.Custom[0].RelativePosition = -15;
						}
						else
						{
							tChart1.Axes.Custom[0].RelativePosition = 0;
						}

        }

			private bool HasOneVisibleSeries(Axis axis)
			{			
				foreach (Steema.TeeChart.Styles.Series s in tChart1.Series)
				{
					if ((s.Visible) && (s.GetVertAxis == axis)) return true;
				}

				return false;
			}
5. This is also because you intialized the custom axis to RelativePosition=-5 and therefore it is always drawn on that position. However, the if statement in the code I posted above changes this position depending if the left axis is visible or not.

Hope this helps!
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

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Thu Sep 20, 2007 7:34 am

Thanks Narcis,

I appologise for missing out on the Infragistics controls.

Your comments were really helpful in the problems especially the problem with Custom axis.

I just need one more help, I guess there is no way to stack multiple series in TeeChart. But our client is looking forward to some kind of an approach to create Stacked Lines for multiple lines as is done in the case of Stacked bars.

it would be helpful if you could suggest some approach that we can work upon for creating stacked lines for multiple series.

Thanks and Regards,
Uday

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Sep 20, 2007 9:09 am

Hi Uday,

You're welcome.

Yes, lines can also be stacked. You can do something like this:

Code: Select all

			Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line1.Stacked = Steema.TeeChart.Styles.CustomStack.Stack;
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

usc
Newbie
Newbie
Posts: 29
Joined: Thu Mar 09, 2006 12:00 am
Contact:

Post by usc » Fri Sep 21, 2007 11:10 am

Hi Narcis,

Is it possible to stack groups of Lines as is the case with bars.

Regards,
Uday

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 Sep 21, 2007 11:26 am

Hi Uday,

This is not possible for now. However this is already on our wish-list to be considered for inclusion in future releases.
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

JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

Post by JayG » Fri Sep 21, 2007 3:30 pm

Uday,

I have been able to force 3D line series to stack, but not in an additive manner. For example, if there is a line at 3 and a line at 5, they would be vertically above and below each other, but they would be at 3 and 5, not 3 and 8.

I don't know if it may cause other problems or if you will have to manually code some other things that are done automatically now, but here is what I do (in Visual Basic).

Tchart1.Series.ApplyZOrder = true
Tchart1.Series(0).ZOrder = 0
Tchart1.Series(1).ZOrder = 0

I guess you could create a third series that is the sum of the first two and then show the first one and the third one using the same ZOrder.

Jay

Post Reply