我正在尝试使用ZedGraphControl来创建饼图。我可以使用
添加饼图切片zedGraphControl.GraphPane.AddPieSlice (30, Color.Red, Color.White, 45f, .0, "Data");
方法,但似乎没有任何
RemovePieSlice
或所有方法中的任何删除对象。我错过了一些简单的东西,或者这个库不允许删除切片?
答案 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()