Example #1
0
        private void LoadQueueHistogramGraph()
        {
            //// For Histogram ..

            //// -- Begin Plotting ..
            List <double> xDataQueueHisto = new List <double>();
            List <double> yDataQueueHisto = new List <double>();

            int MaxGraphQueueHisto = 0;

            GraphPane QueueHistoGraphPane = QueueSizeHistogramPanel.GraphPane;

            // Set the Titles
            QueueHistoGraphPane.Title.Text       = "Queue Size Histogram";
            QueueHistoGraphPane.XAxis.Title.Text = "Delay Value";
            QueueHistoGraphPane.YAxis.Title.Text = "Numbers Of Customers";

            QueueHistoGraphPane.XAxis.Scale.Min = -1;
            QueueHistoGraphPane.YAxis.Scale.Min = 0;

            QueueHistoGraphPane.XAxis.Scale.MajorStep = 1;


            DataGridView HistoData = Program.simulationTableForm.outputDataGrid;

            double[] HistoList = new double[QueuingSystem.maxDelay + 1];

            int MaxHisto = 0;

            for (int i = 0; i < HistoData.Rows.Count; i++)
            {
                HistoList[Convert.ToInt32(HistoData.Rows[i].Cells[9].Value)]++;
                if (HistoList[Convert.ToInt32(HistoData.Rows[i].Cells[9].Value)] >= MaxHisto)
                {
                    MaxHisto = (int)HistoList[Convert.ToInt32(HistoData.Rows[i].Cells[9].Value)];
                }
            }

            QueueHistoGraphPane.XAxis.Scale.Max = HistoList.Length;
            QueueHistoGraphPane.YAxis.Scale.Max = Convert.ToInt32(MaxHisto);

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


            double[] xAxisForQueueHisto = new double[HistoList.Length];
            for (int i = 0; i < HistoList.Length; i++)
            {
                xAxisForQueueHisto[i] = i;
            }

            BarItem b = QueueHistoGraphPane.AddBar("", xAxisForQueueHisto, HistoList, Color.Red);

            QueueHistoGraphPane.AxisChange();
            QueueSizeHistogramPanel.Invalidate();
            //// -- End Plotting
        }
Example #2
0
        private void LoadQueueHistogramGraph()
        {
            //// For Histogram ..

            //// -- Begin Plotting ..
            List <double> xDataQueueHisto = new List <double>();
            List <double> yDataQueueHisto = new List <double>();

            int MaxGraphQueueHisto = 0;

            GraphPane QueueHistoGraphPane = QueueSizeHistogramPanel.GraphPane;

            // Set the Titles
            QueueHistoGraphPane.Title.Text       = "Queue Size Histogram";
            QueueHistoGraphPane.XAxis.Title.Text = "Delay Value";
            QueueHistoGraphPane.YAxis.Title.Text = "Numbers Of Customers";

            QueueHistoGraphPane.XAxis.Scale.Min = -1;
            QueueHistoGraphPane.YAxis.Scale.Min = 0;

            //QueueHistoGraphPane.XAxis.Scale.MajorStep = 0.1;
            //QueueHistoGraphPane.YAxis.Scale.MajorStep = 0.1;


            DataGridView             HistoData = Program.simulationTableForm.outputDataGrid;
            Dictionary <double, int> HistoList = new Dictionary <double, int>();

            double MaxHisto = 0;

            for (int i = 0; i < HistoData.Rows.Count; i++)
            {
                if (!HistoList.ContainsKey(Convert.ToDouble(HistoData.Rows[i].Cells[9].Value)))
                {
                    HistoList.Add(Convert.ToDouble(HistoData.Rows[i].Cells[9].Value), 0);
                }
                HistoList[Convert.ToDouble(HistoData.Rows[i].Cells[9].Value)]++;
                if (HistoList[Convert.ToDouble(HistoData.Rows[i].Cells[9].Value)] >= MaxHisto)
                {
                    MaxHisto = (int)HistoList[Convert.ToDouble(HistoData.Rows[i].Cells[9].Value)];
                }
            }
            QueueHistoGraphPane.XAxis.Scale.Max = HistoList.Count;
            QueueHistoGraphPane.YAxis.Scale.Max = Convert.ToInt32(MaxHisto);

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

            int idx = 0;

            double[] xAxisForQueueHisto = new double[HistoList.Count];
            double[] yAxisForQueueHisto = new double[HistoList.Count];
            foreach (KeyValuePair <double, int> v in HistoList)
            {
                xAxisForQueueHisto[idx]   = v.Key;
                yAxisForQueueHisto[idx++] = v.Value;
            }

            BarItem b = QueueHistoGraphPane.AddBar("", xAxisForQueueHisto, yAxisForQueueHisto, Color.Red);

            QueueHistoGraphPane.AxisChange();
            QueueSizeHistogramPanel.Invalidate();
            //// -- End Plotting
        }