drawing 3d graphs in sas
This commodity deals with how elaborate graphs can be fatigued in C# with the help of the ILNumerics class libraries – if requested the graphs can fifty-fifty be blithe besides.
Like to all of my articles on this weblog, I will briefly introduce the library start, then I will obtain the necessary bases which are needed for the coding afterwards and finally I will show you pace by step how to get at that place. Permit'southward kickoff!
What is ILNumerics?
ILNumerics is a .Internet grade library that includes a number of components. The two core components are the Compute Engine and the Visualization Engine. ILNumerics expands the .NET-Framework by complex numbers, scalars and vector calculations, matrices and matrix operations, multi-dimensional data structures and much more than.
Another advantage of ILNumerics is the Visualization Engine that makes plotting of ii or 3-dimensional graphs possible. This will be the focus of this article.
What does ILNumerics cost?
If you have dealt with ILNumerics before, you might think that ILNumerics is completely free. That was the case between 2007 and 2011 when ILNumerics was offered past LGPL for complimentary.
Since 2011 ILNumerics has been sold under a proprietary license which starts at 89€ (monthly payment) or one.300€ (annual payment). Contrary to the annual payment model, the subscription model (with monthly payments) includes updates, upgrades and support.
So, in that location is still the possibility of a free trial which can exist used to evaluate the libraries for your own purposes.
Project idea and information footing
Allow's offset with the do project which nosotros desire to implement. The aim is to plot several chiliad points into a 3D system. The three coordinates correspond information about download numbers, rating and costs of every WordPress plugin on CodeCanyon.
If you desire to reconstruct the problem with updated daily data, you may use my pocket-sized Python crawler that I accept written only for the purpose of obtaining these data.
The problem should be clear now and the data should be obtained past the crawler. Let's motility on to the implementation in C#.
Creating a 3D diagram in C#
First, we need a new project in Visual Studio – for the sake of simplicity a WinForms Project is sufficient. Now, we get to the form designer and pull the component ILPanel from the toolbox to the course. (The component should exist located in the "ILNumerics"-tab in the toolbox after the installation of ILNumerics. If this is not the case, you lot may correct-click in the toolbox, then choose "Add controls" to search for ILNumerics controls and finally add it.)
The code is quite clear, and so you may take the function principle of the code direct from the comments in the source code.
//When form loads... private void Form1_Load(object sender, EventArgs e) { //Open a filestream and read the data points into an comma-seperated cord StreamReader sr = new StreamReader(Application.StartupPath + "\\stats_plugins.csv"); cord dataLines = string.Empty; while (sr.Peek() != -1) dataLines += sr.ReadLine().Replace(";",",") + "\northward"; sr.Shut(); dataLines = dataLines.Trim('\n'); //Convert the information-cord into an ILArray ILArray<int> AN = ILMath.csvread<int>(dataLines); //Create a new scene, which is the base for our graph var scene = new ILScene(); using (ILScope.Enter()) { //Convert all data points to bladder ILArray<float> A = ILMath.tosingle(AN); //Add a plot to the scene and configure it scene.Add(new ILPlotCube { //Render in 3D TwoDMode = simulated, //Add together 3 axes Axes = { XAxis = { Characterization = { Text = "Cost in $" }, GridMajor = { DashStyle = DashStyle.Dashed, Color = Color.DarkGray, Width = i } }, YAxis = { Label = { Text = "Rating count" }, GridMajor = { DashStyle = DashStyle.Dashed, Color = Color.DarkGray, Width = 1 } }, ZAxis = { Characterization = { Text = "Download count" } } }, //Add the data points Children = { new ILPoints { Positions = A }, }, //Set start rotation for 3D rendered graph Rotation = Matrix4.Rotation(new Vector3(i, 1, 1), 0.5f) }); } //Add together the scene to the ILPanel ilPanel1.Scene = scene; }
This code volition suffice to obtain the result which you see next to this text. Past using the ILPanel, yous not simply receive a decent 3D-plot but y'all tin also rotate, zoom and move it.
By the way, the ILPanel is only one possibility to illustrate a scene. So, it is also possible to create a SVG from the scene which gives yous the possibility to bear witness the illustration in web projects. For further information you may read Scott Hanselman'southward article on his blog.
Conclusion
The results shown at the finish of this paragraph are serenity respectable. Even circuitous graphs can exist plotted without much effort. Though I have to admit that ILNumerics can behave out many more than tasks but this exceeds by far my mathematical capacities.
However, the price is high. I definitely don't have 89€ left every month. Nevertheless compared to the offered perfomance the price seems to exist fair and if you get a high book order, information technology shouldn't be an obstacle at all.
Finally, here are three links that may help you in the get-go and with whatever issues.
- Official documentation and tutorials
- Official Visualization Engine documentation
- ILNumerics on Stackoverflow
Source: https://en.code-bude.net/2015/08/12/drawing-3d-graphs-in-csharp-with-ilnumerics/
0 Response to "drawing 3d graphs in sas"
Post a Comment