Page 1 of 1

Area series null points

Posted: Tue Jun 03, 2008 1:01 pm
by 9231211
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?

Posted: Tue Jun 03, 2008 1:21 pm
by narcis
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.

Posted: Tue Jun 03, 2008 1:38 pm
by 9231211
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.

Posted: Tue Jun 03, 2008 1:57 pm
by narcis
Hi jhhd,

Ok, in that case you should use AddXY adding X DateTime values and a constant Y value.

Posted: Tue Jun 03, 2008 2:09 pm
by 9231211
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);

Posted: Tue Jun 03, 2008 2:20 pm
by narcis
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);

Posted: Tue Jun 03, 2008 2:30 pm
by 9231211
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.