Page 1 of 1
Problem with the DragMarks Tool
Posted: Tue Apr 03, 2007 11:24 pm
by 9643227
After the Mark of a series point is dragged with a DragMarks Tool, it won't be able to follow the series point correctly - or in another word, the Mark is kind of detached from the series point - if the user scroll the chart (by setting TChart.Panning.Allow = ScrollModes.Both in code). Any comments?
Thanks.
Jeff
Posted: Thu Apr 05, 2007 9:59 am
by 9348258
Hi Jeff
I could reproduce the issue here and this seems to be a bug. I've added it (TF02012156) to our defect list to be fixed for future releases.
You can't set a custom position for marks callout. An alternative is using Annotation tools, but they don't support dragging, so we have arranged and example where we also implemented dragging support for annotation tools. This is the example's code:
Code: Select all
private bool IsDragging;
private int Fitem;
private bool IsScrolling=false;
private double MinX0;
private double MinY0;
private void Form1_Load(object sender, EventArgs e)
{
tChart1.Aspect.View3D = false;
line1.FillSampleValues();
Bitmap bmp = tChart1.Bitmap;
//After populating series, Create Annotation Tools
for (int i = 0; i < line1.Count; i++)
{
Steema.TeeChart.Tools.Annotation AnnotationTool = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
AnnotationTool.Callout.Arrow.Visible = true;
AnnotationTool.Text = line1.YValues[i].ToString();
MoveAnnotation(AnnotationTool, i);
}
}
private void tChart1_MouseDown(object sender, MouseEventArgs e)
{
int i = 0;
if (e.Button != tChart1.Panning.MouseButton)
{
foreach (Steema.TeeChart.Tools.Annotation at in tChart1.Tools)
{
if (at.Shape.ShapeBounds.Contains(e.X, e.Y))
{
IsDragging = true;
Fitem = i;
tChart1.Zoom.Active = false;
break;
}
i++;
}
}
MinX0 = tChart1.Axes.Bottom.Minimum;
MinY0 = tChart1.Axes.Left.Minimum;
}
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if ((IsDragging))
{
MoveAnnotation(((Steema.TeeChart.Tools.Annotation)tChart1.Tools[Fitem]), Fitem, e.X, e.Y);
}
else if (IsScrolling)
{
int i = 0;
foreach (Steema.TeeChart.Tools.Annotation at in tChart1.Tools)
{
int HOffset = tChart1.Axes.Bottom.CalcXPosValue(tChart1.Axes.Bottom.Minimum) - tChart1.Axes.Bottom.CalcXPosValue(MinX0);
int VOffset = tChart1.Axes.Left.CalcYPosValue(tChart1.Axes.Left.Minimum) - tChart1.Axes.Left.CalcYPosValue(MinY0);
MoveAnnotation(at, i, at.Shape.Left - HOffset, at.Shape.Top - VOffset);
i++;
}
}
MinX0 = tChart1.Axes.Bottom.Minimum;
MinY0 = tChart1.Axes.Left.Minimum;
}
private void tChart1_MouseUp(object sender, MouseEventArgs e)
{
IsDragging = false;
IsScrolling = false;
tChart1.Zoom.Allow = true;
}
private void tChart1_Scroll(object sender, EventArgs e)
{
IsScrolling = true;
}
private void tChart1_UndoneZoom(object sender, EventArgs e)
{
SetAnnotationsPosition();
}
private void tChart1_Zoomed(object sender, EventArgs e)
{
SetAnnotationsPosition();
}
private void SetAnnotationsPosition()
{
Bitmap bmp = tChart1.Bitmap;
int i = 0;
foreach (Steema.TeeChart.Tools.Annotation at in tChart1.Tools)
{
MoveAnnotation(at, i);
i++;
}
}
private void MoveAnnotation(Steema.TeeChart.Tools.Annotation a, int index)
{
a.Left = line1.CalcXPos(index) - 15;
a.Top = line1.CalcYPos(index) - 20;
a.Callout.XPosition = line1.CalcXPos(index);
a.Callout.YPosition = line1.CalcYPos(index);
}
private void MoveAnnotation(Steema.TeeChart.Tools.Annotation a, int index, int HOffset, int VOffset)
{
a.Left = HOffset;
a.Top = VOffset;
a.Callout.XPosition = line1.CalcXPos(index);
a.Callout.YPosition = line1.CalcYPos(index);
}
Posted: Wed Feb 13, 2008 4:22 pm
by 9233315
Is there still a plan to resolve this issue in a future build? I'm still experiencing the exact same problem using TeeChart Pro 8.02.
Andrew
Posted: Thu Feb 14, 2008 10:40 am
by narcis
Hi Andrew,
Yes, this is a common issue to all TeeChart versions and it is still an open issue at the defect list to be fixed for future releases.