Help with Bar series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Help with Bar series

Post by westacotta » Mon Jul 14, 2008 2:28 pm

Hi,

I'm having a problem with getting a Bar series chart to display as expected with a certain set of data and would like a little help.

I've uploaded the file TeeChartBugTest.zip to your upload area.

This contains a sample app with data and some bitmaps.

The bitmap in expected.jpg is what i would like and the bitmap in actual.jpg is what i get. it seems to be chopping off the first 2 x points and several of the end x points.

The data I'm adding using the Add(double,double) method is effectivly this:

x, y
3, -0.0375
4, -0.0275
5, -0.0225
6, -0.0200
7, -0.0225
8, -0.0200
9, -0.0175
10, -0.0175
11, -0.0175
12, -0.0175
13, -0.0175
14, -0.0175
15, -0.0175
16, -0.0175
17, -0.0175
18, -0.0175
19, -0.0175
20, -0.0175
21, -0.0175
22, -0.0175
23, -0.0175
24, -0.0175
25, -0.0175
26, -0.0175
27, -0.0175
28, -0.0175
29, -0.0175
30, -0.0175
40, -0.0175
50, -0.0125
60, -0.0125
80, -0.0125
100, -0.0125
120, -0.0125
130, -0.0125

Any ideas about what i'm doing wrong

Thanks
Andy

westacotta
Newbie
Newbie
Posts: 10
Joined: Mon Nov 05, 2007 12:00 am

Post by westacotta » Mon Jul 14, 2008 2:30 pm

I should also mention that if I don't set the Bar.MultiBar property to MultiBars.SideAll I get all of the data I expect but the bars are overlaid and the later x series points have huge gaps between them.

Thanks
Andy

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 Jul 14, 2008 3:02 pm

Hi Andy,

To achieve what you request you have 2 options:

1. Removing MultiBars setting and set BarWidthPercent, for example:

Code: Select all

			//bar1.MultiBar = MultiBars.SideAll;
			bar1.BarWidthPercent = 10;
2. Ignore given x values and let TeeChart add them sequentially setting series like this:

Code: Select all

			//bar1.MultiBar = MultiBars.SideAll;
			bar1.BarWidthPercent = 60;
and populating it this way:

Code: Select all

			for (int i = 0; i <= vals.GetUpperBound(0); i++)
			{
				double yearFrac = TenorAsYearFraction( vals[i, 1] );
				Debug.WriteLine( yearFrac );
				//bar1.Add(yearFrac, double.Parse(vals[i, 2]));
				bar1.Add(double.Parse(vals[i, 2]));
			}
which would be the equivalent to this:

Code: Select all

			for (int i = 0; i <= vals.GetUpperBound(0); i++)
			{
				double yearFrac = TenorAsYearFraction( vals[i, 1] );
				Debug.WriteLine( yearFrac );
				//bar1.Add(yearFrac, double.Parse(vals[i, 2]));
				bar1.Add(i, double.Parse(vals[i, 2]));
			}
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