Page 1 of 1

How to change the ZOrder of Marks?

Posted: Thu Jul 03, 2014 7:41 am
by 16566869
I tried to switch Marks zorder by changing the property of ZOrder of series,
but nothing happened.
Do you have any advice?

Code: Select all


__fastcall TForm12::TForm12(TComponent* Owner)
   : TForm(Owner)
{
	// Add two Point series
	Series1 = new TPointSeries(NULL);
	Series1->ParentChart = Chart1;
	Series1->Marks->Visible = true;

	Series2 = new TPointSeries(NULL);
	Series2->ParentChart = Chart1;
	Series2->Marks->Visible = true;

	for (int n = 0; n < 5; n++)
	{
		Series1->Add(n + 1, "Marks1");
		Series2->Add(n + 1, "Marks2");
    }
}


void __fastcall TForm12::btnChangeZOrderClick(TObject *Sender)
{

	// I tried to bring Series1 to front by changing it's ZOrder,
	//  but the marks of Series1 is still behind Series2
	Series1->ZOrder = 100;


}

Re: How to change the ZOrder of Marks?

Posted: Thu Jul 03, 2014 11:42 am
by yeray
Hello,

The drawing order is determined by the index of the series in the Chart SeriesList.
As you create the series, Series1 has the index 0 and Series2 has the index 1. So Series2 is drawn after Series1.
You can change this with:

Code: Select all

Chart1->SeriesUp(Series2);
SeriesUp and SeriesDown methods are calling ExchangeSeries internally. So another way to do the same in your case:

Code: Select all

Chart1->ExchangeSeries(0, 1);