程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> DevExpress之餅狀圖凸起(Explode)設置實例

DevExpress之餅狀圖凸起(Explode)設置實例

編輯:C#入門知識

DevExpress之餅狀圖凸起(Explode)設置實例。本站提示廣大學習愛好者:(DevExpress之餅狀圖凸起(Explode)設置實例)文章只能為提供參考,不一定能成為您想要的結果。以下是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#法式設計有所贊助。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved