Overlapping marks for a line series
Posted: Wed Mar 28, 2012 6:02 am
This is a recurring issue I see. I have attempted to implement the code as referenced at http://www.teechart.net/support/viewtopic.php?t=560.
So, in my test project, I have this code:
However, it seems to make no difference at all. See attached screen capture. The code seems to be getting into the parts editing the Mark position - but it is like the changes are being ignored. Is there a setting I am missing?
So, in my test project, I have this code:
Code: Select all
__fastcall TFormMain::TFormMain(TComponent* Owner)
: TForm(Owner)
{
Chart1->AddSeries(new TLineSeries(Chart1));
Chart1->Series[0]->Marks->Visible = true;
for(int i(0); i < 50; ++i) {
Chart1->Series[0]->AddXY(i,i);
}
Chart1->Draw();
TRect R1,R2,DummyRect;
for (int i=0; i<Chart1->Series[0]->Marks->Positions->Count-1; i++)
{
for (int j=0; j<Chart1->Series[0]->Marks->Positions->Count-1; j++)
{
if (j!=i)
{
TSeriesMarkPosition *mp1 = new TSeriesMarkPosition;
TSeriesMarkPosition *mp2 = new TSeriesMarkPosition;
mp1=Chart1->Series[0]->Marks->Positions->Position[i];
mp2=Chart1->Series[0]->Marks->Positions->Position[j];
R1=mp1->Bounds();
R2=mp2->Bounds();
while (IntersectRect(DummyRect, R1, R2))
{
mp1->Custom=true;
mp1->LeftTop.x=mp1->LeftTop.x+2;
mp1->LeftTop.y=mp1->LeftTop.y+2;
mp1->ArrowTo.x=mp1->LeftTop.x+2;
mp1->ArrowTo.y=mp1->LeftTop.y+2;
R1=mp1->Bounds();
R2=mp2->Bounds();
}
Chart1->Refresh();
}
}
}
}