ZedGraph在winform下绘制饼形图,如何显示百分比的问题
今天在winform下使用ZedGraph绘制统计图形,绘制饼形图时,想让数据和百分比都显示在统计图形上,网上搜索看设置哪个属性可实现此功能,未果。后来自己找到,设置添加的每个PieItem的LabelType属性即可。
枚举LabelType定义如下:
// 摘要:
// Enumeration that determines the type of label that is displayed for each
// pie slice (see ZedGraph.PieItem.LabelType).
public enum PieLabelType
{
// 摘要:
// Displays ZedGraph.CurveItem.Label and ZedGraph.PieItem.Value for a slice
// in a Pie Chart.
Name_Value = 0,
//
// 摘要:
// Displays ZedGraph.CurveItem.Label and ZedGraph.PieItem.Value (as % of total)
// for a slice in a Pie Chart.
Name_Percent = 1,
//
// 摘要:
// Displays a ZedGraph.CurveItem.Label containing the ZedGraph.PieItem.Value
// both as an absolute number and as percentage of the total.
Name_Value_Percent = 2,
//
// 摘要:
// Displays ZedGraph.PieItem.Value for a slice in a Pie Chart.
Value = 3,
//
// 摘要:
// Displays ZedGraph.PieItem.Value (as % of total) for a slice in a Pie Chart.
Percent = 4,
//
// 摘要:
// Displays ZedGraph.CurveItem.Label for a slice in a Pie Chart.
Name = 5,
//
// 摘要:
// No label displayed.
None = 6,
}
以飨后人!
枚举LabelType定义如下:
// 摘要:
// Enumeration that determines the type of label that is displayed for each
// pie slice (see ZedGraph.PieItem.LabelType).
public enum PieLabelType
{
// 摘要:
// Displays ZedGraph.CurveItem.Label and ZedGraph.PieItem.Value for a slice
// in a Pie Chart.
Name_Value = 0,
//
// 摘要:
// Displays ZedGraph.CurveItem.Label and ZedGraph.PieItem.Value (as % of total)
// for a slice in a Pie Chart.
Name_Percent = 1,
//
// 摘要:
// Displays a ZedGraph.CurveItem.Label containing the ZedGraph.PieItem.Value
// both as an absolute number and as percentage of the total.
Name_Value_Percent = 2,
//
// 摘要:
// Displays ZedGraph.PieItem.Value for a slice in a Pie Chart.
Value = 3,
//
// 摘要:
// Displays ZedGraph.PieItem.Value (as % of total) for a slice in a Pie Chart.
Percent = 4,
//
// 摘要:
// Displays ZedGraph.CurveItem.Label for a slice in a Pie Chart.
Name = 5,
//
// 摘要:
// No label displayed.
None = 6,
}
以飨后人!
浙公网安备 33010602011771号