ZedGraph删除馅饼切片?

时间:2009-09-18 15:10:36

标签: .net zedgraph

我正在尝试使用ZedGraphControl来创建饼图。我可以使用

添加饼图切片
zedGraphControl.GraphPane.AddPieSlice (30, Color.Red, Color.White, 45f, .0, "Data");

方法,但似乎没有任何

RemovePieSlice

或所有方法中的任何删除对象。我错过了一些简单的东西,或者这个库不允许删除切片?

1 个答案:

答案 0 :(得分:1)

AddPieSlice返回PieItem个对象; PieItem类继承自CurveItem。这意味着您可以通过PieItem属性(CurveList对象的集合)删除CurveItem

只删除一个PieItem对象:

Dim zgc As ZedGraph.ZedGraphControl = Me.ZedGraphControl1

Dim zgPane As ZedGraph.GraphPane = zgc.GraphPane

Dim zgPieItem As ZedGraph.PieItem = zgPane.CurveList("PieItemLabel")
zgPane.CurveList.Remove(zgPieItem)

删除所有PieItem个对象:

Dim zgc As ZedGraph.ZedGraphControl = Me.ZedGraphControl1

Dim zgPane As ZedGraph.GraphPane = zgc.GraphPane

zgPane.CurveList.Clear()