I need to visualize some scientific calculations. I generally prefer reusing code if there is already a good available instead of inventing wheels each time, that's why I am asking. I need a C# code to draw charts (just outputting a bitmap is ok) of 2d (y=f(x))
and 3d (z=f(x,y))
digital data sets (where any axis can be float, int or datetime), sometimes combined.
If I go here and click 3D in the navigation bar on the left, there I can see what I need. But the cheapest version costs $759 there, looks scary for a hobby project of an east-european student :-(
The Microsoft Chart Controls are free and very powerful. Microsoft bought the rights to the Dundas chart control and repackaged it. Is it simple? No, it's a very powerful control. But Microsoft also has good documentation and samples for it. The samples make it appear to be just bar/pie/etc type charts, but it can handle math oriented charting as well.
Opensource tool :
http://plplot.sourceforge.net/index.php
However, the code is in C.
ILNumerics is quite easy to learn (unfortunately, seems current version is not free). It combines a mathematical engine with visualization capabilities (providing Windows Forms Controls). Here is an example of a 3D scatter plot:
var colors
= new[] { Color.Red, Color.Black, Color.Blue, Color.Green /*...*/ };
ILArray<float> data = ILMath.zeros<float>(
3,
colors.Length);
ILArray<float> colorData = ILMath.zeros<float>(
3,
colors.Length);
int index = 0;
foreach (var p in colors)
{
data[0, index] = p.GetHue();
data[1, index] = p.GetSaturation();
data[2, index] = p.GetBrightness();
colorData [0, index] = p.R / 255.0f;
colorData [1, index] = p.G / 255.0f;
colorData [2, index] = p.B / 255.0f;
index++;
}
var points = new ILPoints()
{
Positions = data,
Colors = colorData
};
points.Color = null;
var plot = new ILPlotCube(twoDMode: false)
{
Rotation = Matrix4.Rotation(new Vector3(1, 1, 0.1f), 0.4f),
Projection = Projection.Orthographic,
Children = { points }
};
plot.Axes[0].Label.Text = "Hue";
plot.Axes[1].Label.Text = "Saturation";
plot.Axes[2].Label.Text = "Brightness";
this.ilPanel1.Scene = new ILScene { plot };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With