Page 1 of 1

Bar chart with gaps and overlaps

Posted: Mon Jan 15, 2007 11:58 pm
by 9045841
I am programatically building a chart with a number of Tbarseries each of which is set to mbStacked.
The points are being added with addXY(x,y,'label').
3d is turned off.

However while the rectangles have the correct colour, x-axis value and height (from the y-value). The base of many of the rectangles seems to be incorrectly calculated. This means that my bars have gaps and overlaps.

Any suggestions?

Posted: Tue Jan 16, 2007 7:16 am
by Marjan
Hi, Chris.

The stacking algorithm will work correctly *only* if all series have the same number of points and point x values coincide. If this is not the case, you'll have to use AddNullXY method to add "missing points". I'd use the following approach:

1) Make a list of all available (pool) of x values.
2) For individual series, cycle through (1) and use AddXY if point (x,y) exists and AddNullXY if specific point (x,y) does not exist for this series.

Posted: Tue Jan 16, 2007 7:31 am
by 9045841
Thanks Marjan,

worked like a charm :)