TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
OCS
- Newbie
- Posts: 13
- Joined: Wed Sep 02, 2009 12:00 am
Post
by OCS » Thu Nov 18, 2010 11:22 am
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?
-
OCS
- Newbie
- Posts: 13
- Joined: Wed Sep 02, 2009 12:00 am
Post
by OCS » Thu Nov 18, 2010 12:33 pm
It´s X-Position, of course.
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Nov 19, 2010 5:09 pm
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;
-
OCS
- Newbie
- Posts: 13
- Joined: Wed Sep 02, 2009 12:00 am
Post
by OCS » Mon Nov 22, 2010 7:56 am
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.
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Mon Nov 22, 2010 8:35 am
Hi,
This is a behaviour by design so I'm afraid you'll have to continue using the code to "homogenize" the XValues.