tags:

views:

27

answers:

2

I have a program that adds LineItems to a ZedGraph pane whenever data parameters are set and a submit button is pressed.

LineItem myCurve = Pane.AddCurve(Title, Data, Color.FromArgb(Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255)), SymbolType.Diamond);

So that's all well and good. My problem is that I want to allow my users to remove specific curves one by one.

My only thought on this is to create a list of LineItems, remove a specific LineItem from the list, and replot all remaining LineItems.

My problem is that I don't know how I would be able to specify which LineItem I want to remove from my list.

+1  A: 

If you're talking about List<LineItem>, then you can do list.Remove(lineItem) or list.RemoveAt(index).

Nelson
A: 
pane.CurveList.Remove(myCurve);

and then

zg1.Refresh();

or

zg1.Invalidate();

(assuming zg1 is your ZedGraphControl)

Gacek