Selecting Lines
Selecting Lines
Is it possible to select multiple lines with the mouse, drawn with the line tool?
Re: Selecting Lines
Hello lilo,
I think you can achieve as you want, using DrawLine and DrawLineItems tools that you allow select more of one DrawLines. I recomend take a look in this thread, where you find an example that can serve you to achieve as you want.
I hope will helps.
Thanks,
I think you can achieve as you want, using DrawLine and DrawLineItems tools that you allow select more of one DrawLines. I recomend take a look in this thread, where you find an example that can serve you to achieve as you want.
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 |
Re: Selecting Lines
Next question...if I have the start and end point coordinates for each line, will I be able to add a smoothing function for all the selected lines and draw the result?
Re: Selecting Lines
Hello lilo,
Would be very greatful if you could explain exactly, step to step or with a graphic example, as you want achieve so we can try to find a good solution for you.
Thanks,
Would be very greatful if you could explain exactly, step to step or with a graphic example, as you want achieve so we can try to find a good solution for you.
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 |
Re: Selecting Lines
What I want to do is:
1.Draw some lines on a Teechart programatically
2. Select some of the lines with a mouse
3. Apply smoothing, such as BSpline, so I get a smooth curve.
4. Be ably to apply line thickness, color etc to the final curve
5. Be able to select the curve and/or its line segments with the mouse.
1.Draw some lines on a Teechart programatically
2. Select some of the lines with a mouse
3. Apply smoothing, such as BSpline, so I get a smooth curve.
4. Be ably to apply line thickness, color etc to the final curve
5. Be able to select the curve and/or its line segments with the mouse.
Re: Selecting Lines
Hello lilo,
Ok. In your case I suggest take a look in next example and do something as do in it. How you be able to see in the code is selected more of one series using Control key and mouse and I think will be helpful for you to try to achieve as you want.
Can you tell us if previous code works as you want?
I hope will helps.
Thanks,
Ok. In your case I suggest take a look in next example and do something as do in it. How you be able to see in the code is selected more of one series using Control key and mouse and I think will be helpful for you to try to achieve as you want.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.FastLine series1, series2,series3;
int HandleSize = 5;
Color oldBrushColor;
Color oldPenColor;
bool oldGradient;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
series1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
series2 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
series3 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
series1.FillSampleValues();
series2.FillSampleValues();
series3.FillSampleValues();
series1.Color= Color.Blue;
series2.Color = Color.Orange;
series3.Color = Color.Red;
tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
}
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
Steema.TeeChart.ChartClickedPart p;
Point pp = new Point();
if (tChart1.Series.Count != 0)
{
foreach (Steema.TeeChart.Styles.Series s in tChart1.Series)
{
if (s.Clicked(e.X, e.Y) != -1 && ModifierKeys == Keys.Control)
{
tChart1.AutoRepaint = false;
pp.X = e.X;
pp.Y = e.Y;
tChart1.Chart.CalcClickedPart(pp, out p);
if (p.Part == Steema.TeeChart.ChartClickedPartStyle.Series)
{
DrawSelection(p);
}
}
else
{
tChart1.AutoRepaint = true;
}
}
}
}
private void DrawSelection(Steema.TeeChart.ChartClickedPart Part)
{
int t, X, Y;
int tmpStep, tmpLast, tmpCount;
Steema.TeeChart.Styles.Series tmpSeries = Part.ASeries;
Steema.TeeChart.Drawing.Graphics3D g = tChart1.Chart.Graphics3D;
if (Part.ASeries != null)
{
tmpCount = tmpSeries.LastVisibleIndex - tmpSeries.FirstVisibleIndex;
if (tmpCount == 0) tmpCount = Part.ASeries.Count;
if (tmpCount > 20)
{
tmpStep = tmpCount/ 20;
}
else
{
tmpStep = 1;
}
t = tmpSeries.FirstVisibleIndex;
if (t == -1)t = 0;
tmpLast = tmpSeries.LastVisibleIndex;
if (tmpLast == -1) tmpLast = Part.ASeries.Count - 1;
oldBrushColor = g.Brush.Color;
oldPenColor = g.Pen.Color;
oldGradient = g.Gradient.Visible;
g.Gradient.Visible = false;
g.Brush.Color = Color.Black;
g.Pen.Color = Color.Black;
while (t < tmpLast)
{
X = tmpSeries.CalcXPos(t);
Y = tmpSeries.CalcYPos(t);
g.Rectangle(RectFormPoint1(X, Y), tmpSeries.MiddleZ);
t += tmpStep;
}
g.Brush.Color = oldBrushColor;
oldPenColor = g.Pen.Color = oldBrushColor;
g.Gradient.Visible = oldGradient;
series1.Color = Color.Blue;
series2.Color = Color.Orange;
series3.Color = Color.Red;
}
}
private Rectangle RectFormPoint1(int X, int Y)
{
//return a rectangle few pixels around XY point }
return Steema.TeeChart.Utils.FromLTRB(X - HandleSize, Y - HandleSize, X + HandleSize, Y + HandleSize);
}
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 |
Re: Selecting Lines
Thanks Sandra,
This solution should work best for me:
"I think you can achieve as you want, using DrawLine and DrawLineItems tools that you allow select more of one DrawLines. I recomend take a look in this thread, where you find an example that can serve you to achieve as you want. "
This solution should work best for me:
"I think you can achieve as you want, using DrawLine and DrawLineItems tools that you allow select more of one DrawLines. I recomend take a look in this thread, where you find an example that can serve you to achieve as you want. "
Re: Selecting Lines
Also, if I select more than one line with the mouse, the handles are only displayed for the currently selected item. Is there a property that will allow the handles to remain visible for all selected lines?
Re: Selecting Lines
Hello lilo,
I would be very helpful if you can send us a simple project, so we can see what you want do and try to find a good solution for you.
Thanks,
I would be very helpful if you can send us a simple project, so we can see what you want do and try to find a good solution for you.
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 |