Пример #1
0
        private void IDs_SelectedIndexChanged(object sender, EventArgs e)
        {
            ServerBusyChartPanel.GraphPane.CurveList.Clear();
            ServerBusyChartPanel.GraphPane.GraphObjList.Clear();

            // -- Begin Plotting ..
            List <double> xData = new List <double>();
            List <double> yData = new List <double>();

            DataGridView data = Program.simulationTableForm.outputDataGrid;

            int MaxGraphValue = Convert.ToInt32(Program.simulationTableForm.outputDataGrid.Rows[Program.simulationTableForm.outputDataGrid.Rows.Count - 1].Cells[8].Value);

            GraphPane myPane = ServerBusyChartPanel.GraphPane;

            // Set the Titles
            myPane.Title.Text       = "Server Busy Time for Server #" + IDs.Items[IDs.SelectedIndex].ToString();
            myPane.XAxis.Title.Text = "Busy Time In Hours";
            myPane.YAxis.Title.Text = "Occurrence";

            myPane.XAxis.Scale.Min = 0;
            myPane.YAxis.Scale.Min = 0;

            myPane.XAxis.Scale.Max = MaxGraphValue;
            myPane.YAxis.Scale.Max = MaxGraphValue;

            ServerBusyChartPanel.ZoomOut(myPane);

            myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F);
            myPane.Fill       = new Fill(Color.FromArgb(250, 250, 255));

            for (int i = 0; i < data.Rows.Count; i++)
            {
                if (data.Rows[i].Cells[4].Value.ToString() == IDs.Items[IDs.SelectedIndex].ToString())
                {
                    int begin = Convert.ToInt32(data.Rows[i].Cells[5].Value), end = Convert.ToInt32(data.Rows[i].Cells[8].Value);

                    BoxObj box = new BoxObj(begin, MaxGraphValue / 4, end - begin, MaxGraphValue / 4, Color.Empty, Color.Red);
                    box.IsVisible = true;
                    box.Location.CoordinateFrame = CoordType.AxisXYScale;
                    box.ZOrder = ZOrder.A_InFront;
                    ServerBusyChartPanel.GraphPane.GraphObjList.Add(box);
                }
            }

            ServerBusyChartPanel.AxisChange();
            ServerBusyChartPanel.Invalidate();
            // -- End Plotting
        }
Пример #2
0
        private void Charts_Load(object sender, EventArgs e)
        {
            // Loading the first chart ..
            ServerBusyChartPanel.Invalidate();
            ServerBusyChartPanel.GraphPane.CurveList.Clear();
            ServerBusyChartPanel.GraphPane.GraphObjList.Clear();

            for (int i = 0; i < Server.counter; i++)
            {
                IDs.Items.Add(i);
            }

            // -- Begin Plotting .. //////////////////
            List <double> xData = new List <double>();
            List <double> yData = new List <double>();

            DataGridView data = Program.simulationTableForm.outputDataGrid;

            // We want the max length of the X axis, it can be the maximum value of end service (the end service of the last customer)
            int MaxGraphValue = Convert.ToInt32(Program.simulationTableForm.outputDataGrid.Rows[Program.simulationTableForm.outputDataGrid.Rows.Count - 1].Cells[8].Value);

            GraphPane myPane = ServerBusyChartPanel.GraphPane;

            // Set the Pane Title
            myPane.Title.Text       = "Server Busy Time for Server #0";
            myPane.XAxis.Title.Text = "Busy Time In Hours";
            myPane.YAxis.Title.Text = "Occurrence";

            myPane.XAxis.Scale.Min = 0;
            myPane.YAxis.Scale.Min = 0;

            myPane.XAxis.Scale.Max = MaxGraphValue;
            myPane.YAxis.Scale.Max = MaxGraphValue; // We don't care for the Y axis, but we need to do that to expand the chart

            myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 90F);
            myPane.Fill       = new Fill(Color.FromArgb(250, 250, 255));

            for (int i = 0; i < data.Rows.Count; i++)
            {
                if (data.Rows[i].Cells[4].Value.ToString() == "0")
                {
                    // Eventually :@  ..
                    int begin = Convert.ToInt32(data.Rows[i].Cells[5].Value);
                    int end   = Convert.ToInt32(data.Rows[i].Cells[8].Value);

                    BoxObj box = new BoxObj(begin, MaxGraphValue / 4, end - begin, MaxGraphValue / 4, Color.Empty, Color.Red);
                    box.IsVisible = true;
                    box.Location.CoordinateFrame = CoordType.AxisXYScale;
                    box.ZOrder = ZOrder.A_InFront;
                    ServerBusyChartPanel.GraphPane.GraphObjList.Add(box);
                }
            }

            // Tell ZedGraph to refigure the
            // axes since the data have changed
            ServerBusyChartPanel.GraphPane.YAxis.IsVisible = false;
            ServerBusyChartPanel.AxisChange();
            ServerBusyChartPanel.Invalidate();
            // -- End Plotting

            LoadCustomerQueueGraph();

            LoadQueueHistogramGraph();
        }