TLineSeries Stairs type - Mark Point control

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

TLineSeries Stairs type - Mark Point control

Post by timhamel » Thu Aug 28, 2008 9:53 am

Hi!

I am using TChart Pro 8.02 and in the current product TLineseries, Stairs type...

The Mark Text seems to be always placed at the end of the line drawn, pretty much where the x/y coordinates are for the point.

Is there a way to tell TChart that you want the marks to identify the beginning of the line and point to the initial point drawn?

Thanks,
Tim

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

Post by Narcís » Thu Aug 28, 2008 10:10 am

Hi Tim,
I am using TChart Pro 8.02 and in the current product TLineseries, Stairs type...

The Mark Text seems to be always placed at the end of the line drawn, pretty much where the x/y coordinates are for the point.
Yes, that's right.
Is there a way to tell TChart that you want the marks to identify the beginning of the line and point to the initial point drawn?


Sorry but I don't understand what do you exactly mean here. Would you be so kind to give us some more details of what you are trying to achieve? An image would be helpful.

You may post your files at news://www.steema.net/stema.public.attachments newsgroup or at our upload page.

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

timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

Post by timhamel » Thu Aug 28, 2008 10:36 am

Yes, I can. e.g. If I have a time line (X) and a temperature (Y) and lets say the first step in some array of stpes says that something should run for e.g. 5 minutes, currently the Mark text is marked at e.g. 70C and 05:00...

Instead of marking 00:00 as the 1st Step... meaning it is pointing to the end of the line...

Is this better?

/Tim

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

Post by Narcís » Thu Aug 28, 2008 11:03 am

Hi Tim,

Thanks for the info.

I'm using this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.Clear;
  Series1.Stairs:=true;
  Series1.Marks.Visible:=true;

  Series1.AddXY(0,5);
  Series1.AddXY(1,7);
  Series1.AddXY(2,6);
  Series1.AddXY(10,8);
  Series1.AddXY(11,4);
end;
With v8.03 I get this chart:

Image

So, if I understood correctly, instead of getting the "6" mark at X=2 you get it at X=10?

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

timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

Post by timhamel » Thu Aug 28, 2008 1:05 pm

Hi,

try using time... as the x axis... and using minute + second display only...

e.g.

Chart1->Series[0]->AddXY(tAxisTime1.Val,70.7,sStep,clRed)

/Tim

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

Post by Narcís » Thu Aug 28, 2008 1:55 pm

Hi Tim,

Sorry but I'm still unable to reproduce the issue here. Could you please send us a simple example project we can run "as-is" to reproduce the problem here?

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

timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

Post by timhamel » Thu Aug 28, 2008 2:07 pm

Will do. I'll mail it to you next week.

THANKS for your help.

There is always the possibility that I am doing something wrong!

/Tim

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

Post by Narcís » Thu Aug 28, 2008 2:27 pm

Hi Tim,

Thanks. I'd prefer if you posted the files at the upload area I pointed you earlier in the thread. That way my colleagues can make their contributions to the discussion.

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

timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

Post by timhamel » Thu Aug 28, 2008 2:35 pm

OK!

timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

Post by timhamel » Mon Sep 01, 2008 7:48 am

Hi!

The sample project TimGraph is now at your upload site...

You will see that Step 0 draws at 05:00 minutes... what we need is that the Mark/Draw shows that the Step starts at 00:00 and last 05:00 minutes...

Meaning it should show the start of the items, then the line showing duration, then a new step...

Tim

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

Post by Narcís » Mon Sep 01, 2008 9:17 am

Hi Tim,

Thanks for the example project.

In that case you should add a value at 00:00, for example, modifying this part of your code:

Code: Select all

		 if(i==0)
		 {
			Chart1->Series[0]->AddXY(tAxisTime1.Val,60.7,"",clRed);
		   tAxisTime1 = tAxisTime+EncodeTime(0,5,0,0);
		 }
		 else
		 {
		   tAxisTime1 = tAxisTime1+EncodeTime(iHour,iMin,iSec+45,0);
		 }
and adding OnGetMarkText event like this:

Code: Select all

void __fastcall TForm1::Series1GetMarkText(TChartSeries *Sender, int ValueIndex,
	  AnsiString &MarkText)
{
	if (ValueIndex == 0) {
		MarkText="";
	}
}
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

timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

Post by timhamel » Mon Sep 01, 2008 12:29 pm

Hi!

Adding a step to point to 00:00 and hiding the mark solves the starting time.

But that still leaves me with the problem that the Step Marks always point to the end of the step...not at the beginning of the step line.

If I have a task with a duration of 5 minutes than it should point to 00:00->05:00... or a task from 05:00->10:00... should point at start not end... Would I need to add invisible points to all stairs, if yes, than it might be either to make a line chart and connect the points and control the marks that way... meaning each line would have 2 points marking start and end... and only start showing the mark...

Do you have some better solution?

Thanks,
Tim

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

Post by Narcís » Mon Sep 01, 2008 1:34 pm

Hi Tim,

In that case you can change your code like this:

Code: Select all

void __fastcall TForm1::DrawProtoGraph(void)
{
	int iHour=0;
	int iMin=0;
	int iSec=0;
	AnsiString sStep;

	TDateTime tAxisTime = Now();
	ReplaceTime(tAxisTime,EncodeTime(0,0,0,0)); //we want time to start at 00:00
	TDateTime tAxisTime1 = tAxisTime;

	Chart1->MaxPointsPerPage = 5;
	ChartTool2->Active = true;

	for(int i=0;i<10;i++)
	{
		sStep="Step "+IntToStr(i+1);

		if(i==0)
		{
			sStep = "Step "+IntToStr(i);
			Chart1->Series[0]->AddXY(tAxisTime1.Val,60.7,sStep,clRed);
			tAxisTime1 = tAxisTime+EncodeTime(0,5,0,0);
		}
		else
		{
			tAxisTime1 = tAxisTime1+EncodeTime(iHour,iMin,iSec+45,0);
		}

		if(i==3)
		{
			sStep = "Step "+IntToStr(i);
			Chart1->Series[0]->AddXY(tAxisTime1.Val,25.7,sStep,clRed);
		}
		else
		if(i==4)
		{
			sStep = sStep+" Loop";
			tAxisTime1 = tAxisTime1+EncodeTime(iHour,iMin+5,iSec,0);//just an offset to show step
			Chart1->Series[0]->AddXY(tAxisTime1.Val,70.0,sStep,clGreen);
		}
		else
		{
			if (i!=0)
			{
				sStep = "Step "+IntToStr(i);
				Chart1->Series[0]->AddXY(tAxisTime1.Val,60.7,sStep,clRed);
			}
		}
	}
}
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

timhamel
Newbie
Newbie
Posts: 34
Joined: Mon Dec 31, 2007 12:00 am

Post by timhamel » Mon Sep 01, 2008 3:57 pm

thanks. I'll check this tomorrow.

Br, Tim

Post Reply