Plotting in VB.NET

Aug 20, 2008 at 4:41 AM

Basically, I'm trying to get the "HelloWorldSample" going in a WPF form. I have everything converted except for the id mappings:

yDataSource.SetYMapping(y => y)

xDataSource.SetXMapping(x => x)

The " => " is not valid in VB.NET, does anyone know how to handle this? All other references are in place, I even loaded the controls ino the designer toolbox and have drug a ChartPlotter onto the form.

Here is the complete code for my plot call:



' Prepare data in arrays




Const N As Integer = 100



Dim x As Double() = New Double(N - 1) {}



Dim y As Double() = New Double(N - 1) {}



For i As Integer = 0 To N - 1


x(i) = i * 0.1

y(i) = Math.Sin(x(i))






'Add data sources




Dim yDataSource As Object = New EnumerableDataSource(Of Double)(y)


yDataSource.SetYMapping(y => y)


Dim xDataSource As Object = New EnumerableDataSource(Of Double)(x)


xDataSource.SetXMapping(x => x)


Dim compDataSource As New CompositeDataSource(xDataSource, yDataSource)


Plotter.AddLineGraph(compDataSource, Colors.Goldenrod, 3,




'Force evertyhing plotted to be visible




As I said the "=>" is not valid in VB.NET, any ideas???


Sep 4, 2008 at 3:25 AM
Edited Sep 4, 2008 at 3:26 AM
Problem solved.

I justed added the DynamicDataDisplay project to may solution (the C# flavor) and added a new public method to the CompositeDataSource class that takes simple double arrays and handled the mappings there.

Then I simply called the new method in my VB code and passed the arrays.