Exemplo n.º 1
0
        private void DrawSimulation(Graphics g)
        {
            if (Simulation != null)
            {
                float all = Simulation.Length;
                for (int i = 40; i < 10000; i += 20)
                {
                    int   count      = ArrayHelper.CountNumber(Simulation, (i / 20 - 2));
                    float percantage = (count / all) * 200;
                    g.FillRectangle(blackBrush, i, 706 - percantage, 10, percantage);
                    g.DrawString((i / 20 - 2) + "", font, blackBrush, i, 716);
                }
                for (int i = 706; i >= 506; i -= 40)
                {
                    g.FillRectangle(verticalLineBrush, 40, i, pb.Width - 40, 1);
                    g.DrawString(((706 - i) / 2) + "%", font, blackBrush, 0, i - 6);
                }

                float[] points = new float[2];
                for (int i = 40; i < 10000; i += 20)
                {
                    double count      = Poisson.CalculatePoissonSimulation((i / 20 - 2));
                    float  percantage = (float)count * 200;
                    points[1] = points[0];
                    points[0] = 706 - percantage;
                    if (percantage >= 1)
                    {
                        if (i != 40)
                        {
                            g.DrawLine(PDFLinePen, i + 4, 706 - percantage, i - 16, points[1]);
                        }
                        g.FillRectangle(pointsBrush, i + 2, 704 - percantage, 4, 4);
                    }
                }
            }
        }