zoukankan      html  css  js  c++  java
  • Devexpress Gantt 应用

    甘特图属于甘特系列浏览次数(也称为时间或时间轴图表)。此视图显示横条沿时间轴。每个条形代表一个单独的事件的开始和结束的值,

    因此,这些图是用来跟踪各种活动的时间范围内(例如计划,利用各种资源,审查该项目的完成项目管理等)。这种图表类型是非常有用的,

    当有必要从不同系列上面显示。

      protected override void OnLoad(EventArgs e)
            {
                ChartControl overlappedGanttChart = new ChartControl();
    
                var series1 = new Series("计划", ViewType.Gantt);
                var series2 = new Series("进度", ViewType.Gantt);
    
               //设置值的类型为 时间
                series1.ValueScaleType = ScaleType.DateTime;
                series2.ValueScaleType = ScaleType.DateTime;
    
                // 添加数据
                series1.Points.Add(new SeriesPoint("市场分析", new DateTime[] { 
        new DateTime(2006, 8, 16), new DateTime(2006, 8, 23) }));
                series1.Points.Add(new SeriesPoint("功能规划", new DateTime[] { 
        new DateTime(2006, 8, 23), new DateTime(2006, 8, 26) }));
                series1.Points.Add(new SeriesPoint("开发规划", new DateTime[] { 
        new DateTime(2006, 8, 26), new DateTime(2006, 9, 26) }));
                series1.Points.Add(new SeriesPoint("测试与Bug维护", new DateTime[] { 
        new DateTime(2006, 9, 26), new DateTime(2006, 10, 10) }));
    
                series2.Points.Add(new SeriesPoint("市场分析", new DateTime[] { 
        new DateTime(2006, 8, 16), new DateTime(2006, 8, 23) }));
                series2.Points.Add(new SeriesPoint("功能规划", new DateTime[] { 
        new DateTime(2006, 8, 23), new DateTime(2006, 8, 26) }));
                series2.Points.Add(new SeriesPoint("开发规划", new DateTime[] { 
        new DateTime(2006, 8, 26), new DateTime(2006, 9, 10) }));
    
                overlappedGanttChart.Series.AddRange(new Series[] { series1, series2 });
    
                // 访问视图类型特定的选项的系列
                ((GanttSeriesView)series1.View).BarWidth = 0.6;
                ((GanttSeriesView)series2.View).BarWidth = 0.3;
    
                // 访问特定类型的选项 diagram.
                GanttDiagram myDiagram = (GanttDiagram)overlappedGanttChart.Diagram;
                myDiagram.AxisY.Interlaced = true;
                myDiagram.AxisY.GridSpacing = 10;
                myDiagram.AxisY.Label.Angle = -30;
                myDiagram.AxisY.DateTimeOptions.Format = DateTimeFormat.MonthAndDay;
                ((GanttSeriesView)series1.View).LinkOptions.ArrowHeight = 7;
                ((GanttSeriesView)series1.View).LinkOptions.ArrowWidth = 11;
                for (int i = 1; i < series1.Points.Count; i++)
                {
                    series1.Points[i].Relations.Add(series1.Points[i - 1]);
                }
    
                // 添加进度线.
                ConstantLine progress =
                new ConstantLine("当前的进度", new DateTime(2006, 9, 10));
                progress.ShowInLegend = false;
                progress.Title.Alignment = ConstantLineTitleAlignment.Far;
                myDiagram.AxisY.ConstantLines.Add(progress);
    
                // 调整 legend.
                overlappedGanttChart.Legend.AlignmentHorizontal =
                    LegendAlignmentHorizontal.Right;
    
                // 添加标题
                overlappedGanttChart.Titles.Add(new ChartTitle());
                overlappedGanttChart.Titles[0].Text = "项目计划";
    
                overlappedGanttChart.Dock = DockStyle.Fill;
                this.Controls.Add(overlappedGanttChart);
            }
     //设置进度        
    void SetProgressState(DateTime dateTime) { if (dateTime > rightAxisLimit) dateTime = rightAxisLimit; if (CompletedSeries != null && PlannedSeries != null) { CompletedSeries.Points.BeginUpdate(); CompletedSeries.Points.Clear(); foreach (SeriesPoint point in PlannedSeries.Points) { DateTime plannedStartDate = point.DateTimeValues[0]; if (DateTime.Compare(plannedStartDate, dateTime) >= 0) continue; DateTime plannedFinishDate = point.DateTimeValues[1]; DateTime completedFinishDate; if (DateTime.Compare(dateTime, plannedFinishDate) > 0) completedFinishDate = plannedFinishDate; else completedFinishDate = dateTime; CompletedSeries.Points.Add(new SeriesPoint(point.Argument, new DateTime[] { plannedStartDate, completedFinishDate })); } CompletedSeries.Points.EndUpdate(); } if (HasConstantLine) ProgressLine.AxisValue = dateTime; }

    部分代码来自于官网、在这里做个备注

  • 相关阅读:
    面试题目整理(MySQL系列-调优)
    面试题目整理(MySQL系列-事务)
    面试题目整理(MySQL系列-索引)
    MySQL遇到问题
    Gorm的高级用法
    Gorm的初步使用(使用频率排序)
    MySQL索引详解
    SSH命令行上传/下载文件
    SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation 'like' 。。。
    Redis 缓存穿透、缓存雪崩、缓存击穿解决方案
  • 原文地址:https://www.cnblogs.com/w2011/p/3196206.html
Copyright © 2011-2022 走看看