码迷,mamicode.com
首页 > 其他好文 > 详细

[DevExpress]饼状图突出(Explode)设置

时间:2014-10-23 16:00:02      阅读:456      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   使用   for   

关键代码:

        /// <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);
          
        }

运行效果:

bubuko.com,布布扣

bubuko.com,布布扣

[DevExpress]饼状图突出(Explode)设置

标签:style   blog   http   color   io   os   ar   使用   for   

原文地址:http://www.cnblogs.com/Yan-Zhiwei/p/4045883.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!