SharpPlot Tutorials > General Tutorials

General Tutorials

This section explores the main concepts that will be useful to the SharpPlot user.

Topics covered

Visual Glossary
Most of the basic chart terms are illustrated here.
Creating a Business graphic
SharpPlot is shipped with sample.cs which illustrates many of the capabilities you need to generate effective business graphics. This short tutorial takes the chart step by step and explains the various properties and methods used to construct it.
Working with Multiple series
There are many strategies for showing multiple data series in the same charting space. This tutorial explores the ways SharpPlot allows you to approach the issue of arranging several series on the same page.
The CMYK color model
On top of the standard ARGB color model (Alpha Red Green Blue – for monitor display), SharpPlot supports and the CMYK color model (Cyan Magenta Yellow Black – for ink mixing). CMYK colors are encoded are ARGB colors with an alpha channel (opacity) between 0 and 8. This is why, when using ARGB colors (which is standard .Net approach), you shouldn’t use opacity smaller than 9, otherwise the colors will appear “random”.
Using the Gradient fills
The way gradients (both linear and radial) are defined varies greatly between output formats, so SharpPlot defines a reasonable set of standard FillStyles for you, and where necessary (surface-filled linegraphs and piecharts) enforces a reasonable bounding rectangle on the fill definition.
Using Date and Time axes
Timeseries data from Excel or from a database query is often held internally as floating-point numbers where the integer part represents the date (the number of days elapsed since 30 December 1899) and the decimal part the time of day. This scheme is accurate to around 2 sec with normal floating-point precision and is equivalent to the OLE date format, and can be obtained by the System.DateTime.ToOADate method.
Using Picture Formatters
You may apply a ‘picture’ format to numeric values, and also to text labels to enforce truncation or wrapping into a given width.
Formatting text with simple HTML tags
SharpPlot allows a limited subset of HTML tags to be included in all text elements, typically headings or axis labels.
Adding Links & Handlers
SharpPlot makes it particularly easy to add hyperlinks and other JavaScript handlers to your charts. This tutorial shows how you can associate links and some simple handlers with each sector of a piechart. Try clicking on the sectors of the piechart for a simple popup message.
Active charts in GUI Applications
The PageMap class allows the programmer to explore hotspot data contained in any chart, so that the application can interact with chart items and data.
The Barley experiment
Many of the examples in the manual use a dataset collected in the 1930s from an experiment to investigate barley yields. Ten varieties of seed were planted at 6 farms over 2 years and the yields from each plot measured to give 120 data points.
Grouping and Splitting database data
Many aggregations can be done very easily in SQL, and SharpPlot simply used to plot the group totals. The methods explored in this tutorial show you how to make more complex summaries and cross-tabs directly from the raw data series.
Sample datasets supplied as XML
Several simple databases are included with the SharpPlot distribution to allow you to experiment with grouping and splitting data. The smallest of these is an invented Sales Information database with two products and some monthly figures:

There is also a full set of tutorials specific to each type of chart.


Send comments on this topic
© Dyalog Ltd 2021