zoukankan      html  css  js  c++  java
  • DevExpress.chartControt画趋势图

     1  private void DrawLine(DataTable dt)
     2         {
     3             Myalysis.Series.Clear();
     4             //图标位置
     5             Myalysis.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;
     6             Myalysis.Legend.AlignmentVertical = LegendAlignmentVertical.Top;
     7             ChartTitle chartTitle = new ChartTitle();    
     8             chartTitle.TextColor = System.Drawing.Color.Black;//字体颜色
     9             chartTitle.Font = new Font("Tahoma", 12);//字体类型字号
    10             chartTitle.Dock = ChartTitleDockStyle.Bottom;//标题对齐方式
    11             chartTitle.Alignment = StringAlignment.Far;
    12             Myalysis.Titles.Clear();//清理标题         
    13             Series s_Series = new Series("血糖总览", ViewType.Line);
    14             s_Series.ArgumentScaleType = ScaleType.Qualitative;//x轴类型
    15             s_Series.ValueScaleType = ScaleType.Numerical;//y轴类型
    16             s_Series.PointOptions.PointView = PointView.Values;//显示表示的信息和数据
    17             //X轴的数据字段
    18             s_Series.ArgumentDataMember = "reporttime";           
    19             //Y轴的数据字段
    20             s_Series.ValueDataMembers[0] = "RESULT";
    21             //定义线条上点的标识形状是否需要
    22             ((LineSeriesView)s_Series.View).LineMarkerOptions.Visible = true;          
    23             //定义线条上点的标识形状
    24             ((LineSeriesView)s_Series.View).LineMarkerOptions.Kind = MarkerKind.Circle;
    25             //定义线条上点的标识颜色
    26             s_Series.View.Color = ColorTranslator.FromHtml("#f90");
    27             //不显示X、Y轴上面的交点的值
    28             ((PointSeriesLabel)s_Series.Label).Visible = true;
    29             //线条的类型,虚线,实线
    30             ((LineSeriesView)s_Series.View).LineStyle.DashStyle = DashStyle.Solid;
    31             s_Series.DataSource = dt;
    32             Myalysis.Series.Add(s_Series);
    33             foreach (DataRow item in dt.Rows)
    34             {
    35                 if (item["diagcode"].ToString() == "1111".ToString())
    36                 {
    37                     Series ss_series = new Series("", ViewType.Line);
    38                     ss_series.View.Color = Color.Blue;
    39                     ((LineSeriesView)ss_series.View).LineMarkerOptions.Kind = MarkerKind.Circle;
    40                     //X轴的数据字段
    41                     s_Series.ArgumentDataMember = "reporttime";
    42                     //Y轴的数据字段
    43                     s_Series.ValueDataMembers[0] = "RESULT";
    44 
    45                     ss_series.Points.Add(new SeriesPoint(item["reporttime"], item["result"].ToString()));
    46                     Myalysis.Series.Add(ss_series);
    47                 }
    48             }
    49             //增加水平警戒线
    50             ConstantLine constantLine1 = new ConstantLine();
    51             ConstantLine constantLine2 = new ConstantLine();
    52             constantLine2.AxisValue = 3.9;
    53             constantLine1.AxisValue = 10;
    54             constantLine2.LegendText = "正常下限(3.9)";
    55             constantLine1.LegendText = "正常上限(10.0)";
    56             constantLine1.Title.TextColor = Color.Red;
    57             constantLine1.Color = Color.Red;
    58             constantLine2.Color = Color.Green;
    59             constantLine1.LineStyle.DashStyle = DashStyle.Solid;
    60             constantLine2.LineStyle.DashStyle = DashStyle.Solid;
    61             XYDiagram labDiagram = (XYDiagram)Myalysis.Diagram;
             //去掉曲线图中的线条
    62 labDiagram.AxisY.GridLines.Visible = false;64 labDiagram.AxisY.ConstantLines.Clear(); 65 labDiagram.AxisY.ConstantLines.Add(constantLine1); 66 labDiagram.AxisY.ConstantLines.Add(constantLine2); 67 68 }
  • 相关阅读:
    VS2017试用期到期后登录微软账户出现错误解决方法
    Unable to start process "dotnet-projectmodel-server" while starting VS2015 问题
    如何写.gitignore只包含指定的文件扩展名
    Win7 通过Smb共享CentOS文件步骤
    Linux下用sudo 命令时出现 is not in the sudoers file
    ubuntu下安装chorme浏览器
    qt for ios扫描二维码功能实现
    ubuntu14.04登陆后只显示桌面文件,快速启动栏不显示,终端不能打开
    编译 Qt with Openssl for IOS
    sql print原理
  • 原文地址:https://www.cnblogs.com/WangJunZzz/p/5684119.html
Copyright © 2011-2022 走看看