Plotter.Draw C# (CSharp) Method

Draw() public method

public Draw ( Graphics g ) : void
g Graphics
return void
    public void Draw(Graphics g)
    {
        Point [] poly = new Point [data.Count + 2];

        for (int i = 0; i < poly.Length; i ++)
            poly [i].Y = ysize;

        poly [0] = new Point (0, 0);
        poly [poly.Length - 1] = new Point (xsize, 0);
        poly [poly.Length - 2] = new Point (xsize, ysize);

        for (int i = -1; i <  tl.TypeIndexes.Length; i ++) {
            Brush b;
            if (i == -1)
                b = Brushes.DarkGray;
            else
                b = tl.TypeBrushes [i];

            g.FillPolygon (b, poly);
            int j = 1;
            foreach (TimePoint tp in data) {
                int psize;

                if (i == -1)
                    psize = tp.OtherSize;
                else
                    psize = tp.TypeData [i];

                poly [j].X = tp.X;
                poly [j].Y -= checked ((int)((long)psize * (long) ysize / (long)Profile.MaxSize));
                j ++;
            }
        }

        g.FillPolygon (Brushes.White, poly);

        {
            Point [] line = new Point [data.Count];

            int j = 0;
            foreach (TimePoint tp in data) {

                int psize = tp.HeapSize;
                line [j].X = tp.X;
                line [j].Y = ysize - checked ((int)((long)psize * (long) ysize / (long)Profile.MaxSize));
                j ++;
            }

            g.DrawLines (Pens.Black, line);
        }

        #if DEBUG_GRAPH_SIZE
        {
            Point [] line = new Point [data.Count];

            int j = 0;
            foreach (TimePoint tp in data) {

                int psize = tp.Data.TotalSize;
                line [j].X = tp.X;
                line [j].Y = ysize - checked ((int)((long)psize * (long) ysize / (long)Profile.MaxSize));
                j ++;
            }

            g.DrawLines (Pens.Black, line);
        }
        #endif
    }

Usage Example

Ejemplo n.º 1
0
        private void PerfectFilterButton_Click(object sender, EventArgs e)
        {
            var flag = true;

            flag &= double.TryParse(FilterstextBox.Text.Replace('.', ','), out var alpha);

            if (!flag)
            {
                MessageBox.Show("Не все данные в правильном формате!", "Ошибка", MessageBoxButtons.OK);
                return;
            }

            var ppl   = Analyser.GetH();
            var curve = _controlZgcList[(int)numericUpDownGraphNo.Value - 1].GraphPane.CurveList[0];
            var x     = new PointPairList();

            for (var i = 0; i < curve.Points.Count; i++)
            {
                x.Add(curve.Points[i]);
            }
            Plotter.Clear(_controlZgcList[(int)numericUpDownGraphNo.Value - 1]);
            if (alpha == 0)
            {
                var result = Analyser.PerfectFilter(x, ppl);
                Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], result, "Исходная функция");
            }
            else
            {
                var result = Analyser.PerfectFilterNoise(x, ppl, alpha);
                Plotter.Draw(_controlZgcList[(int)numericUpDownGraphNo.Value - 1], result, "Исходная функция");
            }
        }
All Usage Examples Of Plotter::Draw