Failed to add Marks manually

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Failed to add Marks manually

Post by elmec » Mon Dec 23, 2013 7:40 am

I want to add Marks at some index of series, but failed..
please help me!

Find the attachment for the example project!
Add mark.png
Add mark.png (58.97 KiB) Viewed 23393 times
Attachments
AddMarks.zip
(95.97 KiB) Downloaded 811 times

Yeray
Site Admin
Site Admin
Posts: 9552
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Failed to add Marks manually

Post by Yeray » Mon Dec 23, 2013 11:19 am

Hello,

Looking at your project, you have two series, named SeriesMark and SeriesData. Only SeriesData has points:

Code: Select all

__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
	// Data series
	SeriesData->FillSampleValues(10);

}
Then, the button does this:

Code: Select all

void __fastcall TForm2::Button1Click(TObject *Sender)
{
	double max = Chart1->LeftAxis->Maximum;

	// Mark sereis which is used to show some mark.
	SeriesMark->Marks->Visible = true;
	SeriesMark->Marks->Transparent = true;

	// Tried to add a mark at index of 3 .
	SeriesMark->AddXY(3, max);
	SeriesMark->Marks->Item[3]->Text->Text = "N";
}
So you are adding a single point to the SeriesMark series, and then accessing to the point with index=3 to set its label.
Note that, if you are going to add the point and set the label at the same time, you can just pass the label in the same AddXY call:

Code: Select all

void __fastcall TForm2::Button1Click(TObject *Sender)
{
	double max = Chart1->LeftAxis->Maximum;

	// Mark sereis which is used to show some mark.
	SeriesMark->Marks->Visible = true;
	SeriesMark->Marks->Transparent = true;

	// Tried to add a mark at index of 3 .
	SeriesMark->AddXY(3, max, "N");
	//SeriesMark->Marks->Item[3]->Text->Text = "N";
}
If you need to set the label in a separate instruction, you can use "Labels->Labels[0]" (0 for the first point in the series).

Code: Select all

void __fastcall TForm2::Button1Click(TObject *Sender)
{
	double max = Chart1->LeftAxis->Maximum;

	// Mark sereis which is used to show some mark.
	SeriesMark->Marks->Visible = true;
	SeriesMark->Marks->Transparent = true;

	// Tried to add a mark at index of 3 .
	SeriesMark->AddXY(3, max);
	SeriesMark->Labels->Labels[0]="N";
}
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to add Marks manually

Post by elmec » Wed Dec 25, 2013 2:28 am

Thanks for your reply.

I know that the mark could be added directly by the code below,
but the grid also disapeared...

Code: Select all

SeriesMark->AddXY(3, max, "N");
Before.png
Before.png (74.93 KiB) Viewed 23325 times
After.png
After.png (51.36 KiB) Viewed 23327 times
So I have tried to use the following code to modify mark manually.

Code: Select all

SeriesMark->Marks->Item[3]->Text->Text = "N";
But it didn't work well...

Pep
Site Admin
Site Admin
Posts: 3278
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Failed to add Marks manually

Post by Pep » Fri Dec 27, 2013 11:14 am

Hello,
I know that the mark could be added directly by the code below,
but the grid also disapeared...
In the case you want to continue displaying all the axis grid lines and bottom axis labels you have to set the bottom axis style to Value :

Code: Select all

  Chart1.Axes.Bottom.LabelStyle := talValue;
elmec wrote:So I have tried to use the following code to modify mark manually.

Code: Select all

SeriesMark->Marks->Item[3]->Text->Text = "N";
But it didn't work well...
Here you're correct, this is a bug, you should be able to set a specific mark text but using the code above, I testing it here the mark appear without text on it.
Could you please add it to bugzilla ? Doing so you'll be identified as the creator of the issue and therefore notified about its evolution.

Thanks in advance.

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to add Marks manually

Post by elmec » Mon Dec 30, 2013 4:14 am

So is there any way to fix the problem...
We are going to release our software...

Pep
Site Admin
Site Admin
Posts: 3278
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Failed to add Marks manually

Post by Pep » Mon Dec 30, 2013 10:06 am

Hello,

yes, a workaround would be to set the axis label style to "talValue", like :

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
var max : double;
begin
   max := Chart1.LeftAxis.Maximum;
   // Tried to add a mark at index of 3 .
   Series1.AddXY(3, max);
   Series1.Labels.Labels[0]:='N';
   Chart1.Axes.Bottom.LabelStyle := talValue;
end;

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to add Marks manually

Post by elmec » Sat Jan 18, 2014 9:58 am

Hello,

Thanks for your advice.

But would you please tell us how to fix the Marks problem.
We cannt wait for the next release.
Pep wrote:
elmec wrote:So I have tried to use the following code to modify mark manually.

Code: Select all

SeriesMark->Marks->Item[3]->Text->Text = "N";
But it didn't work well...
Here you're correct, this is a bug, you should be able to set a specific mark text but using the code above, I testing it here the mark appear without text on it.
Could you please add it to bugzilla ? Doing so you'll be identified as the creator of the issue and therefore notified about its evolution.

Thanks in advance.

Yeray
Site Admin
Site Admin
Posts: 9552
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Failed to add Marks manually

Post by Yeray » Tue Jan 21, 2014 8:28 am

Hello,
elmec wrote:But would you please tell us how to fix the Marks problem.
Isn't the workaround Pep suggested valid for you? Why?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Pep
Site Admin
Site Admin
Posts: 3278
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Failed to add Marks manually

Post by Pep » Tue Jan 21, 2014 9:10 am

Hello elmec,

as you can see at the bug resolution, it was my mistake when I say you were correct about the issue. It's not a bug. As you only have added one point to the Series, to be able to set a specific mark text for that point you have to use the 0 index for the item, like :

Code: Select all

	// Tried to add a mark at index of 3 .
	SeriesMark->AddXY(3, max);
	SeriesMark->Marks->Item[0]->Text->Text = "N";
        SeriesMark->Marks->Item[0]->Font->Size=18;

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to add Marks manually

Post by elmec » Wed Jan 22, 2014 9:04 am

OK , I'd like to repeat the problem again.
---------Code-----------

Code: Select all

	Series1->Marks->Visible = true;

	// Add 5 points to Series
	int xpoints[5] = {10, 20, 30, 40, 50};
	int y = 100;

	for (int i = 0; i < 5; i++)
	{
		Series1->AddXY(xpoints[i], y, IntToStr(i + 1));
	}


	Series1->Marks->Item[0]->Text->Text = "test";
---------Code-----------

But the result is as the attachment! There is no text on mark!
Attachments
marks.png
marks.png (48.89 KiB) Viewed 23160 times

Pep
Site Admin
Site Admin
Posts: 3278
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Failed to add Marks manually

Post by Pep » Wed Jan 22, 2014 12:04 pm

Hello elmec,

It's strange, it's working fine here with the latest TeeChart Pro v2013.09.131217 version usign the code you posted.
Could you please check which TeeChart version appears into your About box ?

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to add Marks manually

Post by elmec » Thu Jan 23, 2014 12:33 am

Hello Pep,

Find the attachment for the Teechart version and example project.
Attachments
Marks.zip
(163.29 KiB) Downloaded 750 times
teechart version.png
teechart version.png (115.41 KiB) Viewed 23123 times

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to add Marks manually

Post by elmec » Thu Jan 23, 2014 12:35 am

Hello Pep,

Find the attachment for the Teechart version and example project.
teechart version.png
teechart version.png (115.41 KiB) Viewed 23150 times
Attachments
Marks.zip
(163.29 KiB) Downloaded 783 times

Yeray
Site Admin
Site Admin
Posts: 9552
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Failed to add Marks manually

Post by Yeray » Fri Jan 24, 2014 12:44 pm

Hello,

Since you are a source code customer, I'll send you a link to private beta version just built to the mail account you have registered in this forum.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Failed to add Marks manually

Post by elmec » Mon Feb 10, 2014 12:27 pm

Thanks,
I'll try it and tell you the result.

Post Reply