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#法式設計有所贊助。