
Rectangle R1,R2;
System.Drawing.Rectangle DummyRect = new System.Drawing.Rectangle();
for (int i=0; i<pie1.Marks.Positions.Count-1; i++)
{
for (int j=0; j<pie1.Marks.Positions.Count-1; j++)
{
if (j!=i)
{
Steema.TeeChart.Styles.SeriesMarks.Position mp1 = pie1.Marks.Positions[i];
Steema.TeeChart.Styles.SeriesMarks.Position mp2 = pie1.Marks.Positions[j]; R1 = mp1.Bounds;
R2 = mp2.Bounds;
while (Rectangle.Intersect(R1,R2)!=DummyRect )
{
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;
}
tChart1.Refresh();
}
}
}


pie1.Marks.Positions.Count is zero when there are actually marks drawn. Sometime later when I execute the code the value is the correct value. So what event sets the count to the right value?
The code doesn't work when the marks are drawn at an angle of 90. This is because the bounds rectangles are for the unrotated marks. How can I fix this?
A third related problem is that when the Angle is 90 degrees drag marks uses the unrotated rectangles for its boundary - this makes it somewhat confusing to use.



void __fastcall TForm4::FormCreate(TObject *Sender)
{
Series1->FillSampleValues(20);
Chart1->Draw();
TRect R1,R2,DummyRect;
for (int i=0; i<Series1->Marks->Positions->Count-1; i++)
{
for (int j=0; j<Series1->Marks->Positions->Count-1; j++)
{
if (j!=i)
{
TSeriesMarkPosition *mp1 = new TSeriesMarkPosition;
TSeriesMarkPosition *mp2 = new TSeriesMarkPosition;
mp1=Series1->Marks->Positions->Position[i];
mp2=Series1->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();
}
}
}
}

Users browsing this forum: No registered users and 0 guests