zoukankan      html  css  js  c++  java
  • DevExpress Util HelpV3

    using System; using System.Drawing; using DevExpress.XtraCharts;

    namespace DevExpressUtilHelpV3

    {

        public static class ChartToolV3   

      {     

        /// <summary>   

          /// 创建Series     

        /// </summary>  

           /// <param name="chat">ChartControl</param>     

        /// <param name="seriesName">Series名字『诸如:理论电量』</param>   

          /// <param name="seriesType">seriesType『枚举』</param>   

          /// <param name="dataSource">数据源</param>  

           /// <param name="xBindName">ChartControl的X轴绑定</param>     

        /// <param name="yBindName">ChartControl的Y轴绑定</param>  

           public static void CreateSeries(this ChartControl chat, string seriesName, ViewType seriesType, object dataSource, string xBindName, string yBindName)   

          {        

         CreateSeries(chat, seriesName, seriesType, dataSource, xBindName, yBindName, null);   

          }   

          /// <summary>   

          /// 创建Series     

        /// </summary>      

       /// <param name="chat">ChartControl</param>     

        /// <param name="seriesName">Series名字『诸如:理论电量』</param>    

         /// <param name="seriesType">seriesType『枚举』</param>   

          /// <param name="dataSource">数据源</param>  

           /// <param name="xBindName">ChartControl的X轴绑定</param>   

          /// <param name="yBindName">ChartControl的Y轴绑定</param>    

         /// <param name="createSeriesRule">Series自定义『委托』</param>    

         public static void CreateSeries(this ChartControl chat, string seriesName, ViewType seriesType, object dataSource, string xBindName, string yBindName, Action<Series> createSeriesRule)  

           {       

          if (chat == null)    

                 throw new ArgumentNullException("chat");        

         if (string.IsNullOrEmpty(seriesName))         

            throw new ArgumentNullException("seriesType");   

              if (string.IsNullOrEmpty(xBindName))  

                   throw new ArgumentNullException("xBindName");     

            if (string.IsNullOrEmpty(yBindName))        

             throw new ArgumentNullException("yBindName");

                Series _series = new Series(seriesName, seriesType);     

            _series.ArgumentScaleType = ScaleType.Qualitative;

                _series.ArgumentDataMember = xBindName;   

              _series.ValueDataMembers[0] = yBindName;

                _series.DataSource = dataSource;     

            if (createSeriesRule != null)        

             createSeriesRule(_series);     

            chat.Series.Add(_series);    

         }

        }

    } 代码示例:

            public Form1()    

         {         

        InitializeComponent();  

           }  

           private void Form1_Load(object sender, EventArgs e)    

         {      

           DataTable _dt = CreateTestDB();  

               chartControl1.CreateSeries("理论功率", ViewType.Spline, _dt, "time", "Power");   

              chartControl1.CreateSeries("实际功率", ViewType.Spline, _dt, "time", "ActulPower");

            }        

    /// <summary>  

           /// 准备数据源

            /// </summary>      

       /// <returns>DataTable</returns>    

         private DataTable CreateTestDB()     

        {          

       DataTable _testData = new DataTable();   

              _testData.Columns.Add(new DataColumn("time", typeof(string)));   

              _testData.Columns.Add(new DataColumn("Power", typeof(decimal)));   

              _testData.Columns.Add(new DataColumn("ActulPower", typeof(decimal)));   

              Random _rm = new Random();  

               for (int i = 0; i < 24; i++)     

            {                

    DataRow _drNew = _testData.NewRow();   

                  _drNew["time"] = string.Format("{0}点", i);   

                  _drNew["Power"] = 250;        

             _drNew["ActulPower"] = _rm.Next(220, 245);    

                 _testData.Rows.Add(_drNew);      

           }        

         return _testData;    

         }

  • 相关阅读:
    drug targets | genetic | 遗传 | 药物靶点
    Cistrome数据库挖掘转录因子靶基因 | TF | target
    Gene-Regulatory Networks (GRNs) | 进阶分析
    PTBP1 | Polypyrimidine Tract Binding Protein | 聚嘧啶区结合蛋白 | 关键调控因子
    HDAC1 | histone deacetylases | 组蛋白脱乙酰基酶 | 关键调控因子
    免疫反应 | Immune Response
    干细胞疗法 | 抗衰老
    生物信息ID大全 | rsid | Ensembl | HGNC | Entrez | Refseq | Uniprot | OMIM
    (转)解药 | AI发现一罕见病新靶点 投资界谨慎乐观
    genome browser | ggplot | 基因组可视化 | R | transcript | isoform
  • 原文地址:https://www.cnblogs.com/zhangruisoldier/p/4737265.html
Copyright © 2011-2022 走看看