DevExpress ChartControl控件---饼图
1、设置饼图显示样式
//设置Legend的样式
_pieSeries.LegendPointOptions.PointView = PointView.ArgumentAndValues;
_pieSeries.LegendPointOptions.Pattern = "{A}: {VP:P2}";
//设置Label的样式
label.Position = PieSeriesLabelPosition.Inside;
label.TextPattern = "{A}: {VP:P2}";
2、设置饼图显示百分比或者数值
public static class ExtensionClass
{
/// <summary>
/// 设置饼状Series显示方式(值/百分比)
/// </summary>
/// <param name="series">Series</param>
public static void SetPiePercentage(this Series series)
{
if (series.View is PieSeriesView)
{
//设置为值
//((PiePointOptions)series.PointOptions).PercentOptions.ValueAsPercent = false;
//((PiePointOptions)series.PointOptions).ValueNumericOptions.Format = NumericFormat.Number;
//((PiePointOptions)series.PointOptions).ValueNumericOptions.Precision = 0;
//设置为百分比
((PiePointOptions)series.PointOptions).PercentOptions.ValueAsPercent = true;
((PiePointOptions)series.PointOptions).ValueNumericOptions.Format = NumericFormat.Percent;
((PiePointOptions)series.PointOptions).ValueNumericOptions.Precision = 0;
}
}
}