0

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

zedGraphControl.GraphPane.AddPieSlice (30, Color.Red, Color.White, 45f, .0, "Data");

方法,但是好像没有

RemovePieSlice

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

4

1 回答 1

1

AddPieSlice返回一个PieItem对象;该类PieItem继承自CurveItem. 这意味着您可以删除PieItemviaCurveList属性(它是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()
于 2009-09-18T15:14:09.140 回答