Page 1 of 1

Weird stacked BarSeries behaviour (V8.05.50522 Win32)

Posted: Thu Nov 18, 2010 11:22 am
by 10054198
Hello,

I´m encountering a weird BarSeries behaviour when using BarSeries in mbStacked mode. The chart shows holes when there is no data for a given position, let´s say I have 3 series with the following data:

Code: Select all

// no data for Y-Position 2
Series1->AddXY( 0, 1 );
Series1->AddXY( 1, 2 );

// no data for Y-Position 0
Series2->AddXY( 1, 3 );
Series2->AddXY( 2, 4 );

// no data for Y-Position 1
Series3->AddXY( 0, 5 );
Series3->AddXY( 2, 6 );
then the result looks like this:

Screenshot

Any suggestions how to eliminate these "holes?

Re: Weird stacked BarSeries behaviour (V8.05.50522 Win32)

Posted: Thu Nov 18, 2010 12:33 pm
by 10054198
It´s X-Position, of course.

Re: Weird stacked BarSeries behaviour (V8.05.50522 Win32)

Posted: Fri Nov 19, 2010 5:09 pm
by yeray
Hi OCS,

The problem is that the "stacked" feature expects the same X value for all the series in a given ValueIndex. You could work around this adding a null point where you don't want a bar, but adding it:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  Series1.MultiBar:=mbStacked;

  Series1.AddXY(0, 1);
  Series1.AddXY(1, 2);
  Series1.AddNullXY(2, 0);

  Series2.AddNullXY(0, 0);
  Series2.AddXY(1, 3);
  Series2.AddXY(2, 4);

  Series3.AddXY(0, 5);
  Series3.AddNullXY(1, 0);
  Series3.AddXY(2, 6);

  Series1.Marks.Visible:=false;
  Series2.Marks.Visible:=false;
  Series3.Marks.Visible:=false;

  Series1.Pen.Visible:=false;
  Series2.Pen.Visible:=false;
  Series3.Pen.Visible:=false;
end;

Re: Weird stacked BarSeries behaviour (V8.05.50522 Win32)

Posted: Mon Nov 22, 2010 7:56 am
by 10054198
Thanks for clarifying this, Yeray. I´m already doing that, I was just wondering if the observed behaviour was a bug.
In my scenario I don´t know how many series I have and I need to create them dynamically, which lead to some lines of code I want to get rid of.

Re: Weird stacked BarSeries behaviour (V8.05.50522 Win32)

Posted: Mon Nov 22, 2010 8:35 am
by yeray
Hi,

This is a behaviour by design so I'm afraid you'll have to continue using the code to "homogenize" the XValues.