Bar chart showing positive and negative values on x-Axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Bar chart showing positive and negative values on x-Axis

Post by Neelam » Tue Aug 14, 2007 10:37 am

I want to plot a bar graph which will display positive values on the right side and negative values on the left hand side.The positive and negative values will appear on the horizontal axis.I am new to Teechart So kindly help me to solve my problem.

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 Aug 14, 2007 11:24 am

Hi Tina,

Sorry but I don't fully understand what you are trying to achieve exactly. However, reading Tutorial 4 - Axis Control may be really helpful. You'll find the tutorials at TeeChart's program group.

If this doesn't help please give us some more details about what are you trying to achieve.

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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Fri Aug 17, 2007 6:44 am

is there any way to send a screenshot or attachment so that it will be more clear. Also do you have any helpline phone no. where we can call you guys and describe it.

Basically I have a data

radio 30
tv -50
paper 60

Now when i plot a bar graph i get a graph in which on X axis i can see radio,tv and paper and on Y axis i can see -60 to 60 values. Now what i want is that on X axis I should be able to see -60 to 60 and Y axis should cut X axis at 0. Thus the resultant bars will be either on right or on left of Y axis.Please let me know how to achieve it preferably by some sample code. Its highly highly urgent requirement and we need v urgent support on this.Many thanks in advance.[/img]

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 Aug 17, 2007 8:00 am

Hi Tina,

Yes, it would be very helpful if you could send us an image of your requirements or even also a simple example project. You can send your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

We don't have a support phone line. If you are looking for priority support you may be interested in our Pro-Support program described 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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Y AXIS SHOULD CUT x AXIS AT ZERO

Post by Neelam » Fri Aug 17, 2007 10:41 am

I have uploaded the screen shoot . I want my Y axis to cut x axis always on zero.Also x axis scale may change everytime the application runs. We have tried doing this by settinng position % of Y axis to 50% but it does not set it accurately(ie it does not erxacly cut x axis at zero). How to achieve this?

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 Aug 17, 2007 11:06 am

Hi Tina,

Thanks for the image.

You can find an example of what you request here. This example always positions horizontal and vertical axes on zero position. This is a TeeChart Pro ActiveX example but the same should be applied to TeeChart for .NET.
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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Mon Aug 20, 2007 10:13 am

Thanks I tried using this code in my .NET program
tChart1.Axes.Left.PositionUnits=puPercent;
tChart1.Axes.Left.PositionPercent = 50;

but it gives these errors:

1. pupercent does not exist in the class or namespace 'test_teechart.Form1".
2.
steema.teechart.axis does not contain definiotion for PositionPercent

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

Post by Narcís » Mon Aug 20, 2007 10:23 am

Hi Tina,

Please find below the answers to your questions:

1. You should use this:

Code: Select all

tChart1.Axes.Left.PositionUnits == Steema.TeeChart.PositionUnits.Percent
2. Try using:

Code: Select all

teeChart.Axes.Left.RelativePosition = 50;
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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Mon Aug 20, 2007 10:45 am

Thanks this does not give synax error, but also it does not cut exactly at zero at X axis(it cuts somewhere near zero).I am uploading screenshot of same.

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

Post by Narcís » Mon Aug 20, 2007 11:29 am

Hi Tina,

Would you be so kind to also send an 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

Neelam
Advanced
Posts: 193
Joined: Fri Jun 08, 2007 12:00 am

Post by Neelam » Tue Aug 21, 2007 8:25 am

I have uploaded the same.

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 Aug 21, 2007 8:50 am

Hi Tina,

Thanks for your example project. It almost has nothing to do with the example I pointed you at. However this works fine like this:

Code: Select all

		private void button1_Click(object sender, System.EventArgs e)
		{
			horizBar1.Add(-3,"Pears",Color.Red); 
			horizBar1.Add(4,"Apples",Color.Blue);       
			horizBar1.Add(2,"Oranges",Color.Green);
			
			Bitmap bmp = tChart2.Bitmap;

			tChart2.Axes.Left.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
			tChart2.Axes.Left.RelativePosition = tChart2.Axes.Bottom.CalcXPosValue(0) - tChart2.Axes.Left.Position;
		}
Please notice that you'd better implement the axis positioning code at the AfterDraw event so that every time the chart is scrolled or zoomed the axes will be automatically repositioned. Also, to have valid axes positions to set up left axis I used the Bitmap call to have the chart being internally drawn and axes positions have valid values.
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