Add() public method

Adds a drawable object to the plot surface with z-order 0. If the object is an IPlot, the PlotSurface2D axes will also be updated.
public Add ( IDrawable p ) : void
p IDrawable The IDrawable object to add to the plot surface.
return void
Esempio n. 1
0
        public Gdk.Pixbuf CreateIcon2D(Table2D table)
        {
            if (table.Ymin == table.Ymax)
            {
                return(GetNoDataPixBuf);
            }

            plotSurface.Clear();
            // needs to be set each time after Clear()
            plotSurface.Padding       = padding;
            plotSurface.SmoothingMode = SmoothingMode;

            float[] valuesY = table.GetValuesYasFloats();

            // y-values, x-values (!)
            LinePlot lp = new LinePlot(valuesY, table.ValuesX);

            lp.Pen = pen;

            plotSurface.Add(lp);

            plotSurface.XAxis1.Hidden = true;
            plotSurface.YAxis1.Hidden = true;

            using (System.Drawing.Graphics g = Graphics.FromImage(bitmap_cache)) {
                plotSurface.Draw(g, bounds);
            }

            if (memoryStream == null)
            {
                memoryStream = new System.IO.MemoryStream(MemoryStreamCapacity);
            }
            memoryStream.Position = 0;
            bitmap_cache.Save(memoryStream, imageFormat);
            memoryStream.Position = 0;
            // TODO create Pixbuf directly from bitmap if possible, avoiding MemoryStream
            return(new Gdk.Pixbuf(memoryStream));
        }