Problem with stacked bars

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Perdurabo
Newbie
Newbie
Posts: 2
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Problem with stacked bars

Post by Perdurabo » Wed Apr 21, 2004 9:26 am

I have a problem with stacked bars and missing values.
My data is a set of tables resulting from a database query.
Each table has two columns (Week and Amount)
For each table I create a bar series with the MutliBar property set to Stacked, the table is the DataSource and DataMember for XValues and YValues are "Week" and "Amount" resp. BarWidthPercent is set to 100.

The problem is that not every table has rows for each week. The result is that the bar width is pretty variable. A bar for - let's say - week 12 in a series where all other weeks are missing extends horizontally until it hits another bar.

Does anyone have a solution other than creating a lot of null values manually?

Daniel

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Apr 21, 2004 11:53 am

Hi, Daniel.
The problem is that not every table has rows for each week.
In this case the solution is to manually populate each series with data and use "null" points for missing data. By "manually" I mean cycling through all points in dataset and using Add method to add points to series. I'd first make a list of all available "weeks" and then compare each record week value with this list. If there is a match, use regular Add method, otherwise add null point to series by using Add(xval,0,Color.Empty); method
Marjan Slatinek,
http://www.steema.com

Perdurabo
Newbie
Newbie
Posts: 2
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Post by Perdurabo » Wed Apr 21, 2004 12:56 pm

Thank you very much. I hoped I could avoid manual coding.
Instead of Color.Empty I use Color.Transparent for the missing points to avoid line drawing.

Daniel

Post Reply