SharpPlot Reference > SharpPlot Class

SharpPlot Class

SharpPlot is a comprehensive library of business and scientific charts.

public class SharpPlot

Example

A simple SharpPlot chart is created in four steps:

  1. Set up the drawing area
  2. Set up any properties (like headings and labels)
  3. Call one of the many Draw methods to build the chart
  4. Render or Save the result to your chosen format.

SharpPlot sp = new SharpPlot(180,120); // paper size in points
sp.SetMargins(12,12,18,4); // reduce default margins
data = new int[] {18,27,31,12,19,23};
sp.DrawBarChart(data);     // draw chart
Bitmap bmp = sp.RenderBitmap(72); // render at one pixel per point

The first three step can be iterated to create more complex charts. There are many more example charts in the SharpPlot Tutorials section of this guide.

Constructors

SharpPlot Methods

AddAttributesInsert arbitrary content in the XML output for known text items
AddBookmarkBookmark this page with name, level, openflag and weblink
AddCommentInsert a note with optional id and compression switch
AddEffectAllow user to associate arbitrary SVG/XAML with any standard text item or subitem
AddHintsApply an array of hints to a set of text items
AddHyperlinksApply an array of links to a set of text items
AddJavaPrologueInclude the definition of a JavaScript function in the output chart
AddTableShadingAdd a combination of Color and Fill to an individual table cell
AddTipsApply an array of tips to a set of text items
DefineFontCreate a definition for a font, including CSS details and PostScript name
DrawBarChart

Draws a grouped or stacked barchart from an array of arrays of values

DrawBoxPlot

Construct compound box-whisker plot from a data array and two integer category arrays

DrawBubbleChart

Scatterplot from 2 arrays of data with markers scaled by 3rd array

DrawCloudChart

3D Scatter from x,y and multiple z values

DrawContourPlot

Contour plot from 3 arrays of double values

DrawDialChart

Draw a dial or gauge from data and pointer radii

DrawFrame

Draw current frame, with any fixed text such as headings and footnotes

DrawGanttChart

Gantt chart from 3 double arrays of Y-values, X-start and X-end values

DrawHistogram

Construct a histogram from a floating-point vector

DrawImage

Add an image to a chart

DrawKey

This will draw and clear any pending keys, using the current setting of key text.

DrawLineGraph

Construct plot from array of arrays of y values and x-values

DrawMinMaxChart

Create hi-lo plot from arrays of max,min and optional axis values

DrawMultiple

Multiple plot from double array of arrays of y-values versus double x-values

DrawNetworkMap

Draw a network of nodes and their link strengths

DrawNote

Write text note given text, position, angle and maximum width

DrawPieChart

Piechart from data and sector explosions

DrawPolarChart

Polar plot from multiple series and times or angles

DrawPolygon

Draw polygon from x and y coordinates, with optional Color, FillStyle, line width and LineStyle

DrawResponsePlot

Draw 3D grid, and construct surface from multiple vectors of zValues giving rows and columns

DrawScatterPlot

Make a scatter plot from x and y data

DrawStepChart

Stepped line from arrays of height data and step-start values

DrawTable

Build a table from an array of arrays of strings, giving cells in columns

DrawTowerChart

Tower chart from an array of arrays of height values

DrawTraceChart

Draw a set of parallel traces from an array of arrays of Y-values and an array of X-values

DrawTreeMap

Draw a treemap of a vector of items (may be paired with depth vector or a triplet of value,depth,altitude)

DrawTriangle

Construct triangle chart from data (3 series giving proportions or counts)

DrawVectors

Vector plot from 4 series of x y x y

DrawVennDiagram

Draw a Venn diagram using supplied membership data

DrawXBarChart

XBarchart from multiple data series and x-values

FindExtremesDetermines the extreme values from an array of data, allowing for the ‘Curves’ style
GetAltitudeColorsGet the array of colors used in Altitude Colors
GetCharsetsReturn the list of used characters for each used font
GetCoefficientsCoefficients of model fit
GetColorsGet the array of colors used by upcoming series
GetFillStylesGet an array of fill-styles used by upcoming series
GetFittedValuesFitted values from model
GetITickPositionsCalculated Inner ticks
GetKeyBoxesGet bounding boxes of the latest round of drawn Keys
GetKeyIndicesGet int[] setting for Key indices
GetLabelMaskLabel mask
GetLineStylesGet the array of line-styles to be used by upcoming series.
GetMarkerColorsGet the array of colors used in Marker Colors
GetMarkersGet the array of markers for upcoming series
GetNetworkMapLinkArcNetworkMap Link Arc
GetNetworkMapSelfArcNetworkMap Self Arc
GetPaperSizeGet paper size as a 2-item double vector (width height)
GetPenWidthsGet the array of line-widths for upcoming series
GetResidualsResiduals from modelfit
GetTextSizeGet text width and height in points
GetTrellisBoxesGet the current trellis boxes as a list of (x y x y) coordinates
GetViewpointGet 3D viewpoint given a set of roll,pitch,yaw values in degrees
GetXTickPositionsCalculated X tickmarks
GetYTickPositionsCalculated Y tickmarks
GetZTickPositionsCalculated Z tickmarks
GroupByGroup by unique values
IncludeSourceAdd arbitrary (SVG/EPS) content to beginning or end of output stream
MapCoordsMaps a matched pair of (x,y) co-ordinate arrays to points
NewCellMove to the next cell in the current trellis.
NewFrameClear the area for a new chart with new frame size and position.
NewPageMove on to next page
NewYAxisPartial reset to allow independent secondary Y-axis
NextNoteReturns the correct position for the next note text allowing given extra space in pts
ReadCommentRecover comments saved to file in any output format or passed as a string
ReadPdfStreamRecover any page from an encoded PDF
RedrawAxesOverdraws the axes with optional framing
RenderAnimatedSvgReturn chart rendered as animated SVG, with one frame per page
RenderBitmapReturn completed chart rendered through raster engine as a Bitmap object
RenderChartLogReturn completed chart as a readable log
RenderDocumentReturn completed chart as a Document instance
RenderEpsReturn completed chart rendered as Encapsulated PostScript
RenderImageMapReturn tags to make an HTML imagemap for completed chart
RenderJsonChartMapReturn JSON arrays to make a map for entire chart
RenderMetafileReturn or stream completed chart as one of the Extended Metafile formats
RenderPSReturn completed chart rendered as raw PostScript
RenderPageMapReturn an instance of the PageMap class to allow active graphics applications with completed chart
RenderPdfReturn completed chart as a PDF stream
RenderSvgReturn completed chart rendered as SVG
RenderVmlReturn completed chart as a VML string
RenderXamlReturn completed chart rendered as a XAML Canvas
ResetClear SharpPlot taking optional paper size (width,height in pts)
ResetKeyRemoves any accumulated key definitions
ResetPropertiesAll properties except trellis definitions are returned to default values.
SaveAnimatedGifSave chart rendered through raster engine as an animated GIF file, one frame per page.
SaveAnimatedSvgSave chart to named file as animated SVG, with one frame per page
SaveChartLogSave completed chart as a readable log file
SaveEpsSave completed chart to named file as Encapsulated PostScript
SaveImageSave completed chart rendered through raster engine as an image file
SavePSSave completed chart to named file as raw PostScript
SavePdfSave completed chart to named file as PDF
SaveSvgSave completed chart to named file as SVG
SaveVmlSave chart to named file as VML, optionally wrapped into HTML
SaveXamlSave completed chart to named file as a XAML Canvas
SetAltitudeColorsSet Altitude Colors
SetArrowStyleSet Arrow format from Arrow size, with optional sweep angle and fill pattern
SetAxesScalesSet Axes scales given an array of numbers or a single value
SetAxisStyleSet Axis format from any reasonable combination of lineColor, lineStyle and lineWidth
SetBackgroundSet Paper from any reasonable combination of fillColor, fillStyle and edgeWidth
SetBarWidthsSet Bar widths given an array of numbers or a single value
SetBaselineStyleSet Baseline format from any reasonable combination of lineColor, lineStyle and lineWidth
SetCaptionFontSet Caption font from a combination of fontname, size, style, colour
SetCellSizeSet Cellsize (width,height) from a single value or X value and Y value pair
SetChartBackgroundSet Chart background from any reasonable combination of fillColor, fillStyle and edgeWidth
SetChartNameAssign a non-default name to the current chart
SetColorsSet a color or an array of colors to be used by upcoming series
SetContourStyleSet Contour format from any reasonable combination of lineColor, lineStyle and lineWidth
SetContourTagFontSet ContourTag font from a combination of fontname, size, style, colour
SetDataWindowSet Window for data given an array of values or a single value
SetDatumLineStyleSet DatumLine style from any reasonable combination of lineColor, lineStyle and lineWidth
SetDatumLineTagsSet Datumline tags from a delimited string or a string array
SetDatumTagFontSet DatumTag font from a combination of fontname, size, style, colour
SetEdgeStyleSet Edge format from any reasonable combination of lineColor, lineStyle and lineWidth
SetEffectsSet Effect cycle – string or string array
SetEquationNumericFormatSet Equation numeric format from a simple string or an array of strings
SetEquationPositionSet Equation position from a single value or X value and Y value pair
SetFillStylesSet a fill-style or an array of fill-styles for use by upcoming series Set an array of fill-styles for use by upcoming series
SetFootnoteFontSet Footnote font from a combination of fontname, size, style, colour
SetFrameBackgroundSet Frame background from any reasonable combination of fillColor, fillStyle and edgeWidth
SetGridLineStyleSet Gridline format from any reasonable combination of lineColor, lineStyle and lineWidth
SetHeadingFontSet Heading font from a combination of fontname, size, style, colour
SetHeadingNudgeSet Heading nudge(x,y) from given displacements
SetIDataRangeSet Inner data range given an array of numbers or a single value
SetILabelFontSet Inner label font from a combination of fontname, size, style, colour
SetILabelsSet Inner axis labels from a simple string or an array of strings
SetIRangeSet Inner axis range range given maximum and optional minimum values
SetITickMarksSet Inner axis tick marks given an array of numbers or a single value
SetIZonesSet Inner axis zones given one or more Zone definitions
SetKeyBackgroundSet Key background fill from any reasonable combination of fillColor, fillStyle and edgeWidth
SetKeyFontSet Key font from a combination of fontname, size, style, colour
SetKeyFrameKey frame (ltwh in pts) Frame given top corner and size
SetKeyIndicesSet Key indices given an array of values or a single value
SetKeyNudgeSet Key box nudge from given displacements
SetKeyTextSet Legend texts for key from a delimited string or a string array
SetLabelFontSet Label font from a combination of fontname, size, style, colour
SetLabelMaskSet Label mask from a mask (always treated as flags)
SetLineStylesSet a Line-style or an array of line-styles to be used by upcoming series.
SetMarginsSet chart margins individually or as a group
SetMarkerColorsSet Marker Colors
SetMarkerScalesSet Marker scales given an array of numbers or a single value
SetMarkersSet up a marker or an array of markers for upcoming series
SetModelSpanSet Modelfit span range given maximum and optional minimum values
SetNetworkMapLinkArcSet NetworkMap Link Arc given an array of numbers or a single value
SetNetworkMapSelfArcSet NetworkMap Self Arc given an array of numbers or a single value
SetNewlineSet Newline to any single character
SetNoteBackgroundSet Note background from any reasonable combination of fillColor, fillStyle and edgeWidth
SetNoteFontSet Note font from a combination of fontname, size, style, colour
SetNoteNudgeSet Note nudge from given displacements
SetOrderOfFitOrder of fit for x and y axes (3D charts or contour plots)
SetPageLabelsSet Page-labels from a simple string or an array of strings
SetParityLimitStyleSet Parity limit style from any reasonable combination of lineColor, lineStyle and lineWidth
SetParityLineStyleSet Parity axis style from any reasonable combination of lineColor, lineStyle and lineWidth
SetParityZoneStyleSet Parity zone style from any reasonable combination of fillColor, fillStyle and edgeWidth
SetPenWidthsSet a line-width or an array of line-widths for use by upcoming data series
SetPieCenterSet Pie centre (xy) from a single value or X value and Y value pair
SetSelectionSet Selection mask for data from a mask (always treated as flags)
SetSeriesNamesAssign a list of names to the upcoming data series
SetSubheadingFontSet Subheading font from a combination of fontname, size, style, colour
SetTablePositionSet Table position and size from x,y and optional width and height
SetTowerFillStylesTower ptns (top,face,edge) for Walls and towers (single value sets all three)
SetTrellisMakes a trellis specification from a cell count or cell layout
SetValueFontSet Value tag font from a combination of fontname, size, style, colour
SetValueNudgeSet Value nudge from a pair of displacements or matching arrays
SetValueTagsSet Value tags from a delimited string or a string array
SetViewpointSet 3D viewpoint given a set of roll,pitch,yaw values in degrees
SetWallFillStylesWall patterns (YZ,XZ,XY) for Walls and towers (single value sets all three)
SetWeightingsSet Weights for modelfit given an array of numbers or a single value
SetXCaptionFontSet X Caption font from a combination of fontname, size, style, colour
SetXDataRangeSet X data range given an array of numbers or a single value
SetXDatumLinesSet X datum line(s) given an array of numbers or a single value
SetXGridLinesSet X gridline(s) given an array of numbers or a single value
SetXLabelFontSet X label font from a combination of fontname, size, style, colour
SetXLabelNudgeSet X-label nudge from given displacements
SetXLabelsSet X labels from a delimited string or a string array
SetXRangeSet X axis range range given maximum and optional minimum values
SetXTickLengthsSet X tick lengths given an array of numbers or a single value
SetXTickMarksDefine X tick marks as intervals or an explicit array giving irregular settings
SetXZonesSet X zone given one or more Zone definitions
SetYCaptionFontSet Y Caption font from a combination of fontname, size, style, colour
SetYDataRangeSet Y data range given an array of numbers or a single value
SetYDatumLinesSet Y datum line(s) given an array of numbers or a single value
SetYGridLinesSet Y gridline(s) given an array of numbers or a single value
SetYLabelFontSet Y label font from a combination of fontname, size, style, colour
SetYLabelNudgeSet Y-label nudge from given displacements
SetYLabelsSet Y labels from a delimited string or a string array
SetYRangeSet Y axis range range given maximum and optional minimum values
SetYTickLengthsSet Y-tick lengths given an array of numbers or a single value
SetYTickMarksDefine Y tick marks as intervals or an explicit array giving irregular settings
SetYZonesSet Y zone given one or more Zone definitions
SetZCaptionFontSet Z Caption font from a combination of fontname, size, style, colour
SetZDataRangeSet Z data range given an array of numbers or a single value
SetZDatumLinesSet Z datum line(s) given an array of numbers or a single value
SetZLabelFontSet Z label font from a combination of fontname, size, style, colour
SetZLabelsSet Z labels from a simple string or an array of strings
SetZRangeSet Z axis range range given maximum and optional minimum values
SetZTickMarksDefine Z tick marks as intervals or an explicit array giving irregular settings
SetZZonesSet Z zone given one or more Zone definitions
SplitBySplit by unique values
UseCmykUse a color defined by 4 inks (Cyan, Magenta, Yellow, Black) rather than RGB intensities (Red, Green, Blue)

SharpPlot Instance Properties

AltitudeMatrixStyleAltitudeMatrix style
BacklogLogging of API calls
BarChartStyleBarchart style
BarEdgeNibBar edge line-width
BarLimitMaximum bars allowed (deprecated – use TileLimit instead)
BaselineBaseline for shading
BoxPlotStyleBoxplot style
BubbleChartStyleBubblechart style
CaptionLineSpacingCaption linespacing
CaptionStyleCaption style
ChartChangedChart changed delegate
ClassIntervalClass interval
CloudChartStyleCloudchart style
ContourPlotStyleContourplot style
CorrelationGet Correlation of model fit (ReadOnly)
DataStyleData style
DatumTagFormatDatum tag format
DatumTagStyleDatum tag style
DialChartStyleDialchart style
EquationGet Equation text (ReadOnly)
EquationFormatEquation format
EquationIndexEquation index
EquationStyleEquation style
FlexibilityFlexibility
FootnoteFootnote text
FootnoteLineSpacingFootnote linespacing
FootnoteStyleFootnote style
FrameStyleFrame style
GanttChartStyleGanttchart style
GapInter-bar gap
GroupGapInter-group gap
GutterGutter
HeadingHeading text
HeadingLineSpacingHeading linespacing
HeadingStyleHeading style
HistogramStyleHistogram style
IAllowanceInner axis allowance
IAxisStyleInner axis style
IInterceptInner axis intercept
ILabelFormatInner axis picture format
ITickStyleInner axis tickmark style
IndexOriginIndex origin
InnerGapGet Interbar spacing (ReadOnly)
JitterJitter
KeyFormatKey picture format
KeyGapKey gap
KeyLimitKeys used in this legend
KeyLineSpacingKey linespacing
KeyStyleKey style
LabelLineSpacingLabel linespacing
LabelStyleLabel style
LineGraphStyleLinegraph style
LineLimitMaximum lines allowed
MarginBottomBottom margin (pts)
MarginLeftLeft margin (pts)
MarginRightRight margin (pts)
MarginTopTop margin (pts)
MarkerLimitMaximum markers allowed
MeshDensityDensity of mesh
MinMaxChartStyleMinMax style
MissingColorColor for MissingValue
MissingValueMissing value indicator
ModelFitKeyModelfit gets a key
NetworkMapStartAngleNetworkMap Start Angle
NetworkMapStyleNetworkMap style
NotApplicableText"Not Applicable" Filler
NoteLineSpacingNote linespacing
NoteStyleNote style
PageNumber of current page, starting at 1 (ReadOnly)
PagesNumber of non-empty pages of the report so far (ReadOnly)
ParityStyleParity style
ParityToleranceParity limit as percentage
Perspective3D perspective
PieChartStylePiechart style
PieRadiusPie radius
PieStartAnglePie start angle
PixelLimitMaximum pixels allowed
PolarChartStylePolarchart style
ResetOptionReset options
ResponsePlotStyleResponse style
ScalebarStyleScalebar style
ScatterPlotStyleScatterplot style
SeriesKeySeries gets a key
SoftHyphenSoft hyphen
StepChartStyleStepchart style
SubheadingSubheading text
TableStyleTablechart style
TeaseTease
TextLimitMaximum text items allowed
TickMarkWidthTickmark width
TileLimitMaximum tiles allowed
TitleBarTitle bar text
TowerAspectTower aspect
TowerChartStyleTowerchart style
TowerLimitTower limit (deprecated – use TileLimit instead)
TraceChartStyleTraceplot style
TreeMapStyleTreeMap style
TrellisStyleTrellis style
TrendLineKeyTrendline gets a key
TriangleStyleTriangle style
ValueLineSpacingValue linespacing
ValueTagAngleValue tag angle (degrees)
ValueTagFormatValue picture format
ValueTagStyleValue tag style
VectorStyleVector style
VennDiagramStyleVennDiagram style
VersionGet SharpPlot Version
VmlHeaderStandard header code for VML webpage
WalkSortGet Walksort for trees (ReadOnly)
XAxisLengthGet Calculated X Axis length (ReadOnly)
XAxisStyleX axis style
XBarChartStyleX-Bar style (shared)
XCaptionX captions (left,right)
XCaptionFormatX Caption format
XDateFormatDate picture (X axis)
XDatumThresholdX datum threshold
XFactorX labelling factor
XGridThresholdX grid threshold
XInterceptX intercept (Y target)
XLabelAngleX label angle (degrees)
XLabelFormatX picture format
XTickStyleX tickmark style
XTimeFormatTime fmt (X-axis) HH:MM
XTrackFormatX-tracker format
YAxisLengthGet Calculated Y axis length (ReadOnly)
YAxisStyleY axis style
YCaptionY captions (bottom,top)
YCaptionFormatY Caption format
YDateFormatDate picture (Y axis)
YDatumThresholdY datum threshold
YFactorY labelling factor
YGridThresholdY grid threshold
YInterceptY intercept (X target)
YLabelFormatY picture format
YTickStyleY tickmark style
YTimeFormatTime fmt (Y-axis) HH:MM
YTrackFormatY-tracker format
ZAxisStyleZ axis style
ZCaptionZ caption (top only)
ZCaptionFormatZ Caption format
ZFactorZ labelling factor
ZLabelFormatZ picture format
ZTickStyleZ tickmark style

Requirements

Namespace: Causeway

Assembly: SharpPlot (in sharpplot.dll)


Send comments on this topic
© Dyalog Ltd 2021