Document Layout Tutorials
Text Flow Tutorials
PageElement Abstract Class
Frame : PageElement Class
TextBlock : PageElement Class
ImageBlock : PageElement Class
Box : PageElement Class
Rule : PageElement Class
Getting Started > Rendering Images
SharpPlot can generate the finished chart in any of five common vector formats (SVG, PDF, EPS, XAML, EMF, VML) and any raster image format supported by the .net Bitmap class (PNG, JPEG, BMP, GIF, TIF).
Vector vs Raster graphics
Raster graphics have a fixed resolution, so that the graphics are stored as a big matrix of monochrome cells – pixels – possibly with some compression. This forces the choice of a resolution (size in pixels of the whole image) at rendering time.
Vectorial graphics instead are stored as instructions to draw the graphics on an arbitrary XY plane. This means that they can be arbitrarily scaled on the output device. At rendering time, all you have to consider is how to scale it (Fixed size, Fixed Aspect, Stretch...)
In general, any vector format will be smaller (in byte count) than the corresponding raster image by a factor of between 5 and 10, excepted for charts which have a dense matrix of points, such as a contour plot with altitude shading, where the altitude shading is fundamentally a matrix of pixels.
.Net supports the following raster formats : PNG, BMP, GIF, JPEG, TIF (see System.Drawing.Imaging.ImageFormat). These enumerations are passed as arguments to SaveImage and RenderBitmap functions which respectively save the completed chart on disk, and return it as a Bitmap object, which may for example be returned to the browser via http.
Most output functions takes the DPI (resolution in Dots Per Inch) to create the image at. To have the bounding box of the paper in pixels match the required height and width of the image in points, use 72 for the DPI setting (because there are 72 points per inch, and that SharpPlot use the point at its default unit).
Generally, for web publication, the default DPI setting of 96 – the pseudo-standard computer screen resolution – will be more appropriate. Remember to adjust the parameters in the image tag to match, if embedding the picture in a web page.
Here is an image tag suitable for a chart created with
<img src="mychart.png" height=432 width=576 border=0 >
If you are creating charts to be printed at 300DPI, you should use RenderImage(300) which will generate a much larger picture, at the real size of the chart, in 72th of inches.
The Document class also offers the ability to aggregate multiple SharpPlot/SharpLeaf documents into a single one, possibly reordering the pages.
It also provides fine control over the output of multi-page document in formats that do not natively support multiple pages, such as
See also ...