我正在尝试使用 ZedGraphControl 创建饼图。我可以使用
zedGraphControl.GraphPane.AddPieSlice (30, Color.Red, Color.White, 45f, .0, "Data");
方法,但是好像没有
RemovePieSlice
或所有方法中的任何删除对象。我错过了一些简单的东西,还是这个库不允许删除切片?
AddPieSlice
返回一个PieItem
对象;该类PieItem
继承自CurveItem
. 这意味着您可以删除PieItem
viaCurveList
属性(它是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()