| Contents > Structures | Index |
Marker Struct
Markers (built-in and user-defined symbols). The 21 preset markers are listed below (these can be scaled to any size using the SetMarkerScales method) or you may create your own markers from suitable image files (typically GIF images on disk), SVG symbols, or any text character in a suitable font (e.g. WingDings).
public struct Marker
Public Constructor
Creates a custom dashed marker from a character, or URI to an included symbol or image file.
public Marker( string newDefinition );
Example
sp.SetMarkers(new Marker[]{Marker.Cross,Marker.Lozenge});
Marker ms = new Marker("wingdings,9,#146");
Public Static Properties
| Ball | |
| Bar | |
| Block | |
| Bullet | |
| Circle | |
| Cross | |
| Del | |
| Diamond | |
| Dot | |
| DownTick | |
| Hyphen | |
| Invisible | |
| LeftTick | |
| Lozenge | |
| Node | |
| Plus | |
| RightTick | |
| Ring | |
| SmallBullet | |
| Triangle | |
| UpTick |
Creating Custom Markers
The WingDings font is an excellent source of extra marker symbols, and SharpPlot makes it very easy to create markers from any character in any available font. Note that character markers may not work on your users browser in the VML or SVG formats unless the correct font is installed. For image formats, the font only needs to be installed on the server.
The string argument to Marker takes three elements, separated by commas. These give:
- the font name, with optional capitalisation but containing any embedded spaces.
- the character size to form markers for markerscale=1 (they will be scaled as required).
- the character or short string that forms the marker. This will be horizontally and vertically centered at each data point. Characters may be given literally (for example in the definition Arial,10,pH) or as the decimal code following a # symbol.
It is also possible to use small image files as markers (VML and SVG output only) in which case you simply give the URL of the marker file, with an optional natural size to scale it:
sp.SetMarkers(new Marker("apple.gif=12,12"));
By default, the image will have its normal size where the marker scale = 1. It is obviously important to keep the width and height of the included image in the same ratio as the actual width and height of the referenced file.
For SVG output, it is possible to include the code for any SVG symbol inline in the output stream, then refer to the included symbol by its id:
sp.IncludeSource(myDuck);
sp.SetMarkers(new Marker[]{Marker.Lozenge,new Marker("#duck=32,24")});
where the first few lines of the duck might be:
<symbol id="duck" viewBox="0 0 3200 2400">
<path d="
M 424 1424 ...
The proportions given in the viewbox should normally match the width and height given for the symbol in the definition.
Requirements
Namespace: Causeway
Assembly: SharpPlot (in sharpplot.dll)
