亲宝软件园·资讯

展开

DevExpress之饼状图突出(Explode)设置 DevExpress之饼状图突出(Explode)设置实例

人气:4
想了解DevExpress之饼状图突出(Explode)设置实例的相关内容吗,在本文为您仔细讲解DevExpress之饼状图突出(Explode)设置的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:DevExpress,饼状图,突出,Explode,设置,下面大家一起来学习吧。

本文实例讲述了DevExpress之饼状图突出(Explode)设置方法,分享给大家供大家参考。具体实现方法如下:

关键代码如下:

复制代码 代码如下:
/// <summary>
/// 饼状图突出设置
/// </summary>
/// <param name="chart">ChartControl</param>
/// <param name="pieSeries">Series【仅仅适用于PieSeriesView】</param>
/// <param name="explodeMode">突出模式【枚举】</param>
/// <param name="explodedValue">突出间距</param>
/// <param name="dragPie">是否可以拖动突出饼状</param>
public static void SetPieExplode(this ChartControl chart, Series pieSeries, PieExplodeMode explodeMode, int explodedValue, bool dragPie)
{
    if (pieSeries.View is PieSeriesView)
    {
 //bool _hitTesting = chart.RuntimeHitTesting;
 if (!chart.RuntimeHitTesting)
     chart.RuntimeHitTesting = true;

 PieSeriesView _pieView = pieSeries.View as PieSeriesView;
 _pieView.ExplodeMode = explodeMode;
 _pieView.ExplodedDistancePercentage = explodedValue;
 _pieView.RuntimeExploding = dragPie;

 // chart.RuntimeHitTesting = _hitTesting;
    }
}

代码使用:

复制代码 代码如下:
private void BuilderDevChart()
{
    Series _pieSeries = new Series("Series 1", ViewType.Pie);
    _pieSeries.ValueDataMembers[0] = "Value";
    _pieSeries.ArgumentDataMember = "Name";
    _pieSeries.DataSource = CreateChartData();
    chartControl1.Series.Add(_pieSeries);
    //----------------------------------------
    _pieSeries.LegendPointOptions.PointView = PointView.ArgumentAndValues;
    _pieSeries.SetPiePercentage(NumericFormat.Percent, PointView.ArgumentAndValues);
    chartControl1.SetAxisXTitle("test", Color.Red);
    _pieSeries.SetLablePosition(PieSeriesLabelPosition.TwoColumns);
    chartControl1.SetPieExplode(_pieSeries, PieExplodeMode.MinValue, 5, true);
}

运行效果如下图所示:

希望本文所述对大家的C#程序设计有所帮助。

加载全部内容

相关教程
猜你喜欢
用户评论