예제 #1
0
        private void searchBtn_Click(object sender, EventArgs e)
        {
            DateTime startDate = Convert.ToDateTime(startDayText.Text);
            DateTime endDate   = Convert.ToDateTime(endDayText.Text);

            GanttDiagram myDiagram = (GanttDiagram)chartControl.Diagram;

            myDiagram.AxisY.WholeRange.SetMinMaxValues(startDate, endDate);

            startDayText.Text = "";
            endDayText.Text   = "";
        }
예제 #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var facilityList = Clients.Facilities.GetFacilitiesAsync().Result;

            var region = Clients.Regions.GetRegionsAsync().Result;
            var query  = from x in facilityList
                         join y in region on x.RegionId equals y.RegionId
                         select y;
            var queryList = query.ToList();

            for (int i = 0; i < facilityList.Count; i++)
            {
                comboFacility.Properties.Items.Add(queryList[i].Town);
            }

            comboFacility.Text = queryList[0].Town;

            startChart();

            GanttDiagram myDiagram = (GanttDiagram)chartControl.Diagram;

            myDiagram.AxisX.Title.Visible = true;
            myDiagram.AxisX.Title.Text    = "보관함 번호";

            myDiagram.AxisY.Interlaced                   = true;
            myDiagram.AxisY.GridSpacing                  = 10;
            myDiagram.AxisY.Label.Angle                  = -30;
            myDiagram.AxisY.DateTimeOptions.Format       = DateTimeFormat.Custom;
            myDiagram.AxisY.DateTimeOptions.FormatString = "yy/MM/dd hh:mm";
            //myDiagram.AxisY.WholeRange.Auto = false;

            DateTime nowDate = DateTime.Now;

            myDiagram.AxisY.WholeRange.SetMinMaxValues(nowDate.AddDays(-2), nowDate);

            XYDiagram xYDiagram = (XYDiagram)chartControl.Diagram;

            xYDiagram.AxisY.WholeRange.Auto = false;
            //xYDiagram.AxisY.WholeRange.SetMinMaxValues =
        }
예제 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Create a new chart.
            ChartControl overlappedGanttChart = new ChartControl();

            // Create two Gantt series.
            Series series1 = new Series("Planned", ViewType.Gantt);
            Series series2 = new Series("Completed", ViewType.Gantt);

            // Set the date-time values scale type for both series,
            // as it is qualitative, by default.
            series1.ValueScaleType = ScaleType.DateTime;
            series2.ValueScaleType = ScaleType.DateTime;

            // Add points to them.
            series1.Points.Add(new SeriesPoint("Market analysis", new DateTime[] {
                new DateTime(2006, 8, 16), new DateTime(2006, 8, 23)
            }));
            series1.Points.Add(new SeriesPoint("Feature planning", new DateTime[] {
                new DateTime(2006, 8, 23), new DateTime(2006, 8, 26)
            }));
            series1.Points.Add(new SeriesPoint("Implementation", new DateTime[] {
                new DateTime(2006, 8, 26), new DateTime(2006, 9, 26)
            }));
            series1.Points.Add(new SeriesPoint("Testing & bug fixing", new DateTime[] {
                new DateTime(2006, 9, 26), new DateTime(2006, 10, 10)
            }));

            series2.Points.Add(new SeriesPoint("Market analysis", new DateTime[] {
                new DateTime(2006, 8, 16), new DateTime(2006, 8, 23)
            }));
            series2.Points.Add(new SeriesPoint("Feature planning", new DateTime[] {
                new DateTime(2006, 8, 23), new DateTime(2006, 8, 26)
            }));
            series2.Points.Add(new SeriesPoint("Implementation", new DateTime[] {
                new DateTime(2006, 8, 26), new DateTime(2006, 9, 10)
            }));

            // Add both series to the chart.
            overlappedGanttChart.Series.AddRange(new Series[] { series1, series2 });

            // Access the view-type-specific options of the series.
            ((GanttSeriesView)series1.View).BarWidth = 0.6;
            ((GanttSeriesView)series2.View).BarWidth = 0.3;

            // Access the type-specific options of the diagram.
            GanttDiagram myDiagram = (GanttDiagram)overlappedGanttChart.Diagram;

            myDiagram.AxisY.Interlaced = true;
            myDiagram.AxisY.DateTimeScaleOptions.GridSpacing = 2;
            myDiagram.AxisY.Label.TextPattern = "{V:MMMM dd}";

            // Add task links for the first Gantt series.
            ((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]);
            }

            // Add a progress line.
            ConstantLine progress =
                new ConstantLine("Current progress", new DateTime(2006, 9, 10));

            progress.ShowInLegend    = false;
            progress.Title.Alignment = ConstantLineTitleAlignment.Far;
            myDiagram.AxisY.ConstantLines.Add(progress);

            // Adjust the legend.
            overlappedGanttChart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;

            // Add a title to the chart (if necessary).
            overlappedGanttChart.Titles.Add(new ChartTitle());
            overlappedGanttChart.Titles[0].Text = "R&D Schedule";

            // Add the chart to the form.
            overlappedGanttChart.Dock = DockStyle.Fill;
            this.Controls.Add(overlappedGanttChart);
        }
예제 #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Create a new chart.
            ChartControl ganttChart = new ChartControl();

            // Create two Gantt series.
            Series series1 = new Series("Estimation", ViewType.SideBySideGantt);
            Series series2 = new Series("Implementation", ViewType.SideBySideGantt);

            // Specify the date-time value scale type,
            // because it is qualitative by default.
            series1.ValueScaleType = ScaleType.DateTime;
            series2.ValueScaleType = ScaleType.DateTime;

            // Add points to them.
            series1.Points.Add(new SeriesPoint("Task 1", new DateTime[] {
                new DateTime(2006, 8, 16), new DateTime(2006, 8, 31)
            }));
            series1.Points.Add(new SeriesPoint("Task 2", new DateTime[] {
                new DateTime(2006, 8, 31), new DateTime(2006, 9, 15)
            }));
            series1.Points.Add(new SeriesPoint("Task 3", new DateTime[] {
                new DateTime(2006, 9, 15), new DateTime(2006, 9, 30)
            }));
            series1.Points.Add(new SeriesPoint("Task 4", new DateTime[] {
                new DateTime(2006, 9, 30), new DateTime(2006, 10, 15)
            }));

            series2.Points.Add(new SeriesPoint("Task 1", new DateTime[] {
                new DateTime(2006, 8, 16), new DateTime(2006, 9, 5)
            }));
            series2.Points.Add(new SeriesPoint("Task 2", new DateTime[] {
                new DateTime(2006, 9, 5), new DateTime(2006, 9, 22)
            }));
            series2.Points.Add(new SeriesPoint("Task 3", new DateTime[] {
                new DateTime(2006, 9, 22), new DateTime(2006, 10, 10)
            }));
            series2.Points.Add(new SeriesPoint("Task 4", new DateTime[] {
                new DateTime(2006, 10, 10), new DateTime(2006, 10, 23)
            }));

            // Add both series to the chart.
            ganttChart.Series.AddRange(new Series[] { series1, series2 });

            // Access the view-type-specific options of the second series.
            SideBySideGanttSeriesView myView2 = (SideBySideGanttSeriesView)series2.View;

            myView2.MaxValueMarkerVisibility      = DefaultBoolean.True;
            myView2.MaxValueMarker.Kind           = MarkerKind.Star;
            myView2.MaxValueMarker.StarPointCount = 5;
            myView2.MaxValueMarker.Size           = 10;

            myView2.MinValueMarkerVisibility = DefaultBoolean.True;
            myView2.MinValueMarker.Kind      = MarkerKind.Circle;
            myView2.MinValueMarker.Size      = 10;

            myView2.BarWidth = 0.5;

            // Customize the chart (if necessary).
            GanttDiagram myDiagram = (GanttDiagram)ganttChart.Diagram;

            myDiagram.AxisX.Title.Visibility = DefaultBoolean.True;
            myDiagram.AxisX.Title.Text       = "Tasks";
            myDiagram.AxisY.Interlaced       = true;
            myDiagram.AxisY.DateTimeScaleOptions.GridSpacing = 2;
            myDiagram.AxisY.Label.Angle = -30;
            myDiagram.AxisY.Label.EnableAntialiasing = DefaultBoolean.True;
            myDiagram.AxisY.Label.TextPattern        = "{V:MMMM dd}";

            // Customize the legend (if necessary).
            ganttChart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;
            ganttChart.Legend.AlignmentVertical   = LegendAlignmentVertical.TopOutside;
            ganttChart.Legend.Direction           = LegendDirection.LeftToRight;

            // Add a constant line.
            ConstantLine deadline = new ConstantLine("Deadline", new DateTime(2006, 10, 15));

            deadline.ShowInLegend    = false;
            deadline.Title.Alignment = ConstantLineTitleAlignment.Far;
            deadline.Color           = Color.Red;
            myDiagram.AxisY.ConstantLines.Add(deadline);

            // Add a title to the chart (if necessary).
            ganttChart.Titles.Add(new ChartTitle());
            ganttChart.Titles[0].Text = "A Side-by-Side Gantt Chart";

            // Add the chart to the form.
            ganttChart.Dock = DockStyle.Fill;
            this.Controls.Add(ganttChart);
        }