示例#1
0
        private void DrawPoisson(Graphics g)
        {
            if (Poisson != null)
            {
                PoissonExperiments = Poisson.GeneratePoissonExperiments();
                float all = PoissonExperiments.Length;
                for (int i = 40; i < 10000; i += 20)
                {
                    int   count      = ArrayHelper.CountNumber(PoissonExperiments, (i / 20 - 2));
                    float percantage = (count / all) * 200;
                    g.FillRectangle(blackBrush, i, 206 - percantage, 10, percantage);
                    g.DrawString((i / 20 - 2) + "", font, blackBrush, i, 216);
                }
                for (int i = 206; i >= 6; i -= 40)
                {
                    g.FillRectangle(verticalLineBrush, 40, i, pb.Width - 40, 1);
                    g.DrawString(((206 - i) / 2) + "%", font, blackBrush, 0, i - 6);
                }

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