Plotting with ILNumerics.Net - Getting Started
Libraries to be referenced
The main assembly to be referenced in your project is named 'ILNumerics.Drawing.dll'. After downloading the Core Module and ILNumerics.Drawing Module, it resides in the main ILNumerics.Net bin/ folder. All files further needed are also included in the runtime distributable zip-package and should get distributed with your application. All library dependencies are listed in the following table. Some of them should already be installed on your system, some are distributed with ILNumerics.Net. All libraries marked as 'necessary' should exist in the same folder as ILNumerics.Drawing.dll. Only the main libraries (ILNumerics.Net.dll and ILNumerics.Drawing.dll) must be referenced in your projects.
| Library | purpose | necessary/ optional | get from... |
|---|---|---|---|
| ILNumerics.Net.dll | ILNumerics.Net main core module | necessary | Core Module |
| ILNumerics.Drawing.dll | main plotting assembly | necessary | ILNumerics.Drawing Modules |
| OpenTK.dll | OpenGL bindings | necessary | ILNumerics.Drawing Modules |
| OpenTK.Utilities.dll | OpenGL helper | necessary | ILNumerics.Drawing Modules |
| ILNumerics.DrawingD3D.dll | DirectX classes (alpha state, deprecated) | optional on windows | ILNumerics.Drawing Modules |
| OpenGL driver | OpenGL driver (platform dependent) | necessary, installed with OS | preinstalled with OS/ vendor driver |
Namespaces to include
All visual objects are found in the ILNumerics.Drawings
namespace and its subnamespaces. The most important namespaces are:
ILNumerics.Drawings | main plotting namespace, contains all basic classes and definitions (enums) handling and configuring plotting objects |
ILNumerics.Drawings.Controls | Contains all controls directly and indirectly used by ILNumerics.Net plot controls. |
ILNumerics.Drawings.Graphs | Defines all graph types. Currently 2D and 3D graphs are available. This is needed, to access and configure the graph objects returned from any plot controls. |
ILNumerics.Drawings.TextRenderer | Defines classes capable of drawing text into graphical output. |
Availability on mono
The plot controls have been tested and confirmed to run on mono 1.2.6. (Windows and Linux). Earlier versions of mono are unlikely to work correctly.
Simple plotting example
In this example we will create a very simple 2D plotting window. It will demonstrate how to setup the environment and to instantiate a simple ILFigure window to draw numeric data contained as columns in a matrix. Like most examples (if not all) on this website, it is expected, to use Microsoft Visual Studio 2005 and C# as programming language. On later versions the steps to reproduce the examples may differ. At the end of each example a link provides the example's source code and a built ready VS2005 solution.
- Open VS2005 and create a new "Windows Application" project. A new System.Windows.Forms formular 'Form1' will be created by default.
- On your filesystem, place the following ILNumerics.Net libraries
into the auto-generated
bin/Debugfolder below your project path. The files should have been obtained from the latest runtime distributable package of ILNumerics.Net from the download section of our website.- ILNumerics.Net.dll
- ILNumerics.Drawing.dll
- OpenTK.dll
- OpenTK.Utilites.dll
- In VS2005 include references to ILNumerics.Net.dll and ILNumerics.Drawing.dll to your project. Browse these libraries in your 'bin/Debug/ folder'.
- Double click on the newly created form. The form designer auto generated code pops up showing the Form1_Load event handler.
- At the beginning of the Form1 code file, include references to
necessary namespaces:
using ILNumerics; using ILNumerics.Algorithms; using ILNumerics.Drawing.Controls; - Insert the following code snippet into the function body of the Form1_Load event handler stub:
// create sine and cosine test data: 61 samples, 2 periods ILArray<double> data = ILSpecialData.sincos1D(61,2.0); // create an ILFigure plot dialog ILFigure ilfigure1 = new ILFigure(); // add the data as Plot2D graph ilfigure1.ActiveSubfigure.Panel.Graphs.AddPlot2DGraph(data); // set the size ilfigure1.Size = new Size(740,500); // set the title ilfigure1.ActiveSubfigure.Title.Text = "Example1 - simple ILFigure"; ilfigure1.ShowDialog(); - Compile and run the solution. You should see a form similar to this one:
Download this example as VS2005 solution package (no binaries)
The next chapters will examine the graphical controls in more detail. The class hirarchy will be presented along with the possibilities to create and configure different graph types.
