Area series null points

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jhhd
Newbie
Newbie
Posts: 17
Joined: Tue Mar 09, 2004 5:00 am

Area series null points

Post by jhhd » Tue Jun 03, 2008 1:01 pm

I am trying to create a timeline using the TAreaSeries. Its aim is to show what regions data is present for, and as such the Y-axis is not applicable.

I am trying to add data through the use of regions:

Code: Select all

for (int i = 0; i < iNumRegions; ++i)
{
  pSeries->AddX(pRegions[i].dStart);
  pSeries->AddX(pRegions[i].dEnd);
  pSeries->AddNull();
}
with the intention being that if my regions array has two items, one which is 10->20, and one which is 40->50, I would get two areas with a blank gap inbetween.

The above code causes one area from start to end (10->50 in this case), with lines at the boundaries.

Am I missng something?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 03, 2008 1:21 pm

Hi jhhd,

Code below does what you request using TeeChart Pro v8.02 VCL. Which TeeChart version are you using? Could you please check if this code works fine at your end?

Code: Select all

  Series1.Add(10);
  Series1.Add(20);
  Series1.AddNull('');
  Series1.Add(40);
  Series1.Add(50);
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

jhhd
Newbie
Newbie
Posts: 17
Joined: Tue Mar 09, 2004 5:00 am

Post by jhhd » Tue Jun 03, 2008 1:38 pm

That works, but the figure in the Add() function refers to the Y-value, auto-incrementing the X-value, does it not? I have X-data, and don't care for Y-values.

If I could attempt to illustrate what I want:

Code: Select all

 #######     ################           ############################
 .     .     .     .     .     .     .     .     .     .     .     .
Jan   Feb   Mar   Apr   May   Jun   Jul   Aug   Sep   Oct   Nov   Dec
DateTime values are stored as doubles, so using simply Add() wouldn't work (as far as I could tell).

I am using TChart Pro v7.05.

Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 03, 2008 1:57 pm

Hi jhhd,

Ok, in that case you should use AddXY adding X DateTime values and a constant Y value.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

jhhd
Newbie
Newbie
Posts: 17
Joined: Tue Mar 09, 2004 5:00 am

Post by jhhd » Tue Jun 03, 2008 2:09 pm

For me, the following code doesn't work (there are no gaps):

Code: Select all

Series1.AddXY(10, 1);
Series1.AddXY(20, 1);
Series1.AddNull('');
Series1.AddXY(40, 1);
Series1.AddXY(50, 1);

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jun 03, 2008 2:20 pm

Hi jhhd,

Sorry, yes, this is because AddNull adds a point to X position being Series1.Count, you shoud do something like this:

Code: Select all

  Series1.AddXY(10, 1);
  Series1.AddXY(20, 1);
  Series1.AddNullXY(30,0);
  Series1.AddNullXY(35,0);
  Series1.AddXY(40, 1);
  Series1.AddXY(50, 1);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

jhhd
Newbie
Newbie
Posts: 17
Joined: Tue Mar 09, 2004 5:00 am

Post by jhhd » Tue Jun 03, 2008 2:30 pm

Ah ha!

And it appears possible to simply do:

Code: Select all

for (int i = 0; i < iNumRegions; ++i)
{
  pSeries->AddXY(pRegions[i].dStart, 1);
  pSeries->AddXY(pRegions[i].dEnd, 1);
  pSeries->AddNullXY(pRegions[i].dEnd, 1);
}
Thanks for the quick help.

Post Reply