Пример #1
0
        private void DrawExponential(Graphics g)
        {
            if (Exponential != null)
            {
                ExponentialDistribution = Exponential.GenerateExponentialDistribution();
                float all = ExponentialDistribution.Length;
                for (int i = 40; i < 10000; i += 20)
                {
                    int   count      = ArrayHelper.CountNumbersBetween(ExponentialDistribution, 0.1 * (i / 20 - 2), 0.1 * (i / 20 - 1));
                    float percantage = (count / all) * 200;
                    g.FillRectangle(blackBrush, i, 456 - percantage, 10, percantage);
                    g.DrawString(Math.Round(0.1 * (i / 20 - 2), 1) + "", font, blackBrush, i, 466);
                }
                for (int i = 456; i >= 256; i -= 40)
                {
                    g.FillRectangle(verticalLineBrush, 40, i, pb.Width - 40, 1);
                    g.DrawString(((456 - i) / 2) + "%", font, blackBrush, 0, i - 6);
                }

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