zoukankan      html  css  js  c++  java
  • DevExpress 通过WebChartControl 制作饼图的代码

    前台代码:

    <dxchartsui:WebChartControl ID="wccBrowserStatistics" runat="server" Width="600px"
                        ClientInstanceName="chart" Height="368px" >
                       
                    </dxchartsui:WebChartControl>

    后台代码: 

      wccBrowserStatistics.Series.Clear();
                DataTable dt = analytics.GetBrowserCount();
                wccBrowserStatistics.DataSource = dt;
                wccBrowserStatistics.DataBind();
                Series series1 = new Series("浏览器统计", ViewType.Pie);
                wccBrowserStatistics.Series.Add(series1);
                series1.ArgumentScaleType = ScaleType.Qualitative;
                series1.ValueScaleType = ScaleType.Numerical;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string name = dt.Rows[i]["IEType"].ToString();
                    double browser = Convert.ToDouble(dt.Rows[i]["browser"].ToString());
                    series1.Points.Add(new SeriesPoint(IEType, new double[] { browser }));
                }

                SeriesPointFilter filter = new SeriesPointFilter(SeriesPointKey.Value_1,
                DataFilterCondition.LessThanOrEqual, 10);
                //普通饼图
                ((PieSeriesView)series1.View).ExplodedPointsFilters.Add(filter);
                ((PieSeriesView)series1.View).ExplodeMode = PieExplodeMode.UseFilters;
                series1.SeriesPointsSorting = SortingMode.Ascending;
                series1.SeriesPointsSortingKey = SeriesPointKey.Value_1;
                ((PieSeriesView)series1.View).Rotation = 90;
                ((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.Radial;
                ((PieSeriesLabel)series1.Label).Font = new Font("Tahoma", 8);
                ((PiePointOptions)series1.PointOptions).PointView = PointView.ArgumentAndValues;
                //定义chart标题
                ChartTitle CT1 = new ChartTitle();
                CT1.Text = "浏览器统计";
                wccBrowserStatistics.Titles.Add(CT1);

  • 相关阅读:
    context-annotation
    bean-annotation
    K-means算法
    基于概率的分类-贝叶斯分类
    Application
    ConfigurableApplicationContext
    相关性分析
    方差分析
    Java 大写金额转换成数字
    linux 遍历文件添加index
  • 原文地址:https://www.cnblogs.com/tangjianglan/p/2232024.html
Copyright © 2011-2022 走看看