Friday, April 8, 2011

Can any one recommend a vector graphics engine for reporting purposes?

Need to develop a .NET solution to graphically represent seats in sections, plotted in a stadium layout view, and output as a report... the seats would have different colours displaying sales status...

From stackoverflow
  • seems simple enough that regular old GDI+ might do the trick.

    You would of course have to set up a GUI in which each stadiums seating plan can be "mapped" by point and click.

  • Indeed, it might look scary at first sight, but 2D drawing in .NET Framework is actually easy to use.

    Here is a small example that draws a couple of color filled circles with antialised margin:

    using System.Drawing;
    
    ...
    
    Font font = new Font(FontFamily.GenericMonospace, 8);
    Image reportImage = new Bitmap(270, 45);
    using (Graphics graphics = Graphics.FromImage(reportImage))
    {
        graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
    
        graphics.FillRectangle(Brushes.White, 
            new Rectangle(new Point(0, 0), reportImage.Size));
    
        for (int i = 0; i != 6; i++)
        {
            Rectangle r = new Rectangle(20 + i * 40, 15, 25, 15);
            graphics.FillEllipse(
                i % 2 == 0 ? Brushes.DarkOrange : Brushes.DarkKhaki, r);
            graphics.DrawEllipse(Pens.Black, r);
    
            r.Offset(2, 0);
    
            graphics.DrawString(i.ToString(), font, Brushes.Black, r);
        }
    }
    reportImage.Save("C:\\test.bmp");
    
  • Cairo looks like a great tool. Haven't tested it myself...yet. But it seems very competent and supports a bunch of output formats

0 comments:

Post a Comment