Greetings and salutations,
I have the need to draw a free form triangle on a chart, and have a drag handle at each vertex.
Is there any way to do such a shape, I thought of using 3 Drawlines but they will overlap at the vertices and one handle will never be clicked and my triangle will come apart when dragged at a vertex.
Is there an existing tool that has 3 "handles " in which case I could make a copy of that class and adapt it to draw what I need, as I have done with the Drawline.cs class.
The drawing of a triangle I am not bothered with its getting a decent interaction with the mouse, i.e. selecting and dragging the points on the chart.
Regards Phil.
Drawign a triangle
Drawign a triangle
--------------------
Cheers Phil.
Cheers Phil.
Re: Drawign a triangle
Hello Phil,
I have made a simple example using a line series and Drag Point Tool and you can use it as do in below line:
Could you please, tell us if previous code works as you want?
I hope will helps.
Thanks,
I have made a simple example using a line series and Drag Point Tool and you can use it as do in below line:
Code: Select all
Steema.TeeChart.Styles.Line line1;
Steema.TeeChart.Tools.DragPoint drag;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
chartController1.Chart = tChart1;
drag = new Steema.TeeChart.Tools.DragPoint(tChart1.Chart);
line1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
line1.Pointer.Visible = true;
line1.Add(1, 1);
line1.Add(2, 2);
line1.Add(3, 1);
line1.Add(1, 1);
drag.Series = line1;
tChart1.Axes.Left.SetMinMax(0, 4);
tChart1.Axes.Bottom.SetMinMax(0, 6);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
drag.Drag += new Steema.TeeChart.Tools.DragPointEventHandler(drag_Drag);
}
void drag_Drag(Steema.TeeChart.Tools.DragPoint sender, int index)
{
int index1 = line1.Count - 1;
if (line1.Clicked(X, Y) != -1)
{
drag.Series.XValues.Value[0] = drag.Series.XScreenToValue(X);
drag.Series.YValues.Value[0] = drag.Series.XScreenToValue(Y);
drag.Series.XValues.Value[index1] = drag.Series.XScreenToValue(X);
drag.Series.YValues.Value[index1] = drag.Series.XScreenToValue(Y);
}
}
int X;
int Y;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
X = e.X;
Y = e.Y;
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |