Marks Overlapping
Posted: Thu Sep 08, 2016 8:25 am
Hi Guys,
I have a chart with 3 bar groups:
My problem is that the marks on top of the bars are overlapping. Making some of them unreadable.
I have tried applying this solution:
http://www.teechart.net/support/viewtopic.php?t=5160
Similarly I created my own method to reposition the marks which I triggered AfterDraw:
(Not optimised, simple implementation just to serve its purpose)
Initially it looked like it was working:
However if you scroll it horizontally, the repositioned marks stays stuck on the right bound of the chart. Please see image below:
I have tried to trigger the mark reposition method also on Scroll Event but still the same issue persists.
I'm setting AutoPosition property but doesn't seem to have any effect.
Thanks in advance!
I have a chart with 3 bar groups:
My problem is that the marks on top of the bars are overlapping. Making some of them unreadable.
I have tried applying this solution:
http://www.teechart.net/support/viewtopic.php?t=5160
Similarly I created my own method to reposition the marks which I triggered AfterDraw:
(Not optimised, simple implementation just to serve its purpose)
Code: Select all
private void repositionMarks ()
{
Rectangle zero = new Rectangle();
for (int k = 0; k < bar1.Marks.Positions.Count
&& k < bar2.Marks.Positions.Count
&& k < bar3.Marks.Positions.Count; k++)
{
SeriesMarks.Position pos1 = bar1.Marks.Positions[k];
SeriesMarks.Position pos2 = bar2.Marks.Positions[k];
SeriesMarks.Position pos3 = bar3.Marks.Positions[k];
Rectangle rect1 = pos1.Bounds;
Rectangle rect2 = pos2.Bounds;
Rectangle rect3 = pos3.Bounds;
while (Rectangle.Intersect(rect1, rect2) != zero)
{
pos2.Custom = true;
pos2.LeftTop.Y = pos2.LeftTop.Y + 2;
pos2.LeftTop.X = pos2.LeftTop.X;
rect2 = pos2.Bounds;
}
while (Rectangle.Intersect(rect1, rect3) != zero
|| Rectangle.Intersect(rect2, rect3) != zero)
{
pos3.Custom = true;
pos3.LeftTop.Y = pos3.LeftTop.Y + 2;
rect3 = pos3.Bounds;
}
}
}
However if you scroll it horizontally, the repositioned marks stays stuck on the right bound of the chart. Please see image below:
I have tried to trigger the mark reposition method also on Scroll Event but still the same issue persists.
I'm setting AutoPosition property but doesn't seem to have any effect.
Code: Select all
_bar1.Marks.AutoPosition = true;