Page 1 of 1

problems with stacked series

Posted: Thu Nov 08, 2007 3:07 pm
by 10546565
I've never quite understood how to work with stacked area series--everything I have tried, and the chart does strange things.

Here is an example with two different types of events:

http://www.trakcentral.com/files/stackedseries.zip

The two methods here produce holes in the chart, and the series goes all over the place.

What should the code look like?

In case it is not obvious, let me explain.


1) In Test 1, datapoint 10, the chart should show 1/2 of the value from Series 1 and 1/2 of the value from series 2--that works--but it shows the hole in the chart. How do I remove that?

2) In Test 2, the chart should show a smooth transition between the datapoinnts, but it does not--series 2 goes way out of the way and leaving a large hole.

If there is a white paper on how to work wiht stacked series, please let me know.

Posted: Fri Nov 09, 2007 11:29 am
by yeray
Hi TestAlways,

Once you set the property "Stacked", when you have two series in the same X their Y values are automatically added.
And the Area Series draws a line from one up position of the area to the next up position and the same for the down positions. And thats why you encounter holes.

So the easiest solution should be to add another point where you encounter a hole to force the "bar" to start where you want.

So for your test2, you don't need a null point at -100, but your hole is painted adding a point at the same x=0 and with value 0:

Code: Select all

    if I = 10 then
    begin
      Series1.AddXY(I, lValue);
//      Series1.AddNullXY(I, -100);
      Series2.AddXY(I, 0);
      Series2.AddXY(I, lValue);
    end
And for your test1, you only need to add a point at the same x=10 and with the value you want it to have:

Code: Select all

    if I = 10 then
    begin
      Series1.AddXY(I, lValue * 0.5);
      Series2.AddXY(I, lValue * 0.5);
      Series2.AddXY(I, lValue);
    end
I hope it helps you to understand how stacked works.