Page 1 of 1

Problem with stacked bars

Posted: Wed Apr 21, 2004 9:26 am
by 8120536
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

Posted: Wed Apr 21, 2004 11:53 am
by Marjan
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

Posted: Wed Apr 21, 2004 12:56 pm
by 8120536
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