| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Introducing SharpPlot Your First Chart Recent Updates Sample Charts Tutorials General Tutorials Chart Tutorials SharpPlot Class Properties Methods Enumerations Style examples Glossaries Active Charts VectorMath Class DBUtil Class Get SharpPlot Download SharpPlot Buying SharpPlot SharpPlot Support Upgrading from GraPL Release notes |
Reference > Structures > FillStyle Struct FillStyle StructFill-styles (built-in and user-defined tilings). SharpPlot offers a good range of pre-defined shading patterns, but the majority of output formats allow you to add your own custom fills. for SVG, these would typically be more sophisticated gradients, or 3D-effect filters to give the effect of extrusion and lighting on the completed graphic. For raster output, you can use any standard .Net Brush object here. See Gradients for more background on how the fills may be customised. public struct FillStyle Public Static Properties
Creating Fills for Vector OutputCreates a custom shading from an existing gradient or URI to a file. public FillStyle( string sourceName // Brush is also accepted here ); sp.SetBackground(Color.Bisque,FillStyle.GradientBottomRight); FillStyle fs = new FillStyle("#gentlelight"); // SVG filter sp.SetBackground(new FillStyle("tartan.png")); Bitmap fills are currently only supported in output rendered as VML, XAML and raster. Customised gradients may be used with any of the formats, and arbitrary filters are specific to SVG. A typical filter could look like: <defs> <desc>Background wash (light colour)</desc> <linearGradient id="wash" gradientTransform="rotate(35)" > <stop offset="15%" style="stop-color:#D7E1E3"/> <stop offset="90%" style="stop-color:#9CDCEE"/> </linearGradient> </defs> You refer to this as “#wash” in the source name for the fill style. Remember to Include the source for the filter in the chart so that it is added at the beginning of the SVG output. Creating Fills for Raster OutputTo create a custom shading from an existing Brush: public FillStyle( Brush brush ); bg = new TextureBrush(new Bitmap("marble.jpg")); sp.SetChartBackground(new FillStyle(bg)); You can use the WrapMode setting of the Brush to determine how the texture is tiled. It may be convenient to combine both methods to create a chart which can render either to vector or raster outout. In this case you may pass the Brush object and the URL to the image when you create the custom fill: bg = new TextureBrush(new Bitmap("marble.jpg")); sp.SetChartBackground(new FillStyle(bg,"http://serverpath/marble.jpg")); Clearly, the vector output may require a full http path to the image, and you may choose a completely different image here. RequirementsNamespace: Causeway Assembly: SharpPlot (in sharpplot.dll) See also ...SharpPlot | SetBackground | SetChartBackground | SetFillStyles | SetFrameBackground | SetKeyBackground | SetNoteBackground | Using |