Graphing Tools for .NET
Not so long ago I had to face a trivial task - to find a solution that will allow us to render graphical drawings for .NET. Immediately make a reservation that I was only interested in linear graphs. The stumbling block, which prompted to redo the already existing solution (these were graphs built into rdlc reports), was speed. In general, the following requirements were made to the desired solution:
- It is necessary to leave this optimization unnoticed by the end user, therefore, the solution must be widely customizable in order to ultimately look the same as its predecessor.
- Work fast (well, of course, users do not like to wait).
- It is advisable to be free or open source. Buying would not be a big problem, if I had found a great paid solution, but it’s better to start with open source.
What was done?
Googling, it turned out that there are quite a few options for solving this problem, and all of them are quite different in many respects (community size, speed, convenience). In the process of choosing a solution, 8 free options were tested:
- DisLin . Cross-platform library (UNIX, Linux, FreeBSD, OpenVMS, Windows, Mac OSX and MS-DOS). Extremely powerful, flexible, it is really worth it to write a separate article only about her. It may be slightly inferior to its competitors in terms of code readability (it uses the classic functional approach), but due to this, it can be easily ported to almost any language. It has vanilla
cakesports in C, C ++, Fortran 77, Fortran 90, Perl, Python, Ruby, Tgl, GCL (port in C # - a regular library with imported functions). Free for non-commercial use.
- Google Chart Sharp . Wrap over the Google Chart API for C #. There were already articles about him on the hub, so in a nutshell: free (with a limit of 50,000 thousand calls per day), it works very smartly, there are basic parameters for customization. Among the pluses: the ability to use wherever there is an Internet connection, independence from the language / OS used. The main minus is, of course, an additional round-trip data over the network (if you need a schedule on the server), which slows down the process.
- Chart Circle Diagram Controls' microsoft . Native functionality from Microsoft, which was introduced to the public back in 2008. By that time, a number of solutions from third-party developers already existed, but this did not prevent Ms Chart Controls from quickly gaining popularity among developers. And not surprisingly, they came with the .NET framework, had a good architecture, were easily customizable and attractive in appearance. They are inferior in speed to the others, but, nevertheless, they also work pretty well.
- NPlot . Another open source library. True, not the fastest and most popular - information on it can be found on the Internet, although not as much as, for example, Microsoft Chart Controls. Nevertheless, after playing with her, I had a rather pleasant aftertaste.
- OxyPlot . A “live” cross-platform open source, where you can even report a bug that you are likely to respond to. Also available on NuGet. There are appropriate controls for WPF / Silverligth, WinForms, Metro. Goodies, like exporting directly to OpenXml and Pdf. If you need a non-“minute” solution and the ability to correct it for yourself, this solution is for you.
- ZedGraph . Also a “live” open source, a direct competitor to OxyPlot. In terms of the number of supported platforms (only Windows) and technologies (only WinForms and ASP .NET) it is inferior to it, but it is very cute and one of the fastest. An excellent choice if you need “just a beautiful schedule” and nothing more.
- WebChart . Free predecessor of Microsoft Chart Controls. As far as I see, dead since 2004. It has slightly more miserable functionality compared to other solutions, but, since it has some external differences from the rest, it can be quite useful.
- OpenMinded . Free version from the OpenMinded user . Looks beautiful. It’s hard to judge the performance, since I did not find the ability to render the resulting image other than on the hard drive. But since the project is open, anyone can finish it for themselves, I'm sure this is not a problem.
At the very beginning, I decided that it was necessary to collect as many options as possible in one place and test them for speed, and after that it was very unfortunate to throw the work done into the basket. Therefore, it was decided to draw up this little article and post what happened on GitHub . Thus, if there is a need, you can configure each solution for yourself and immediately check it. Personally, I really missed such an article at the beginning. Maybe the source code will bring a smile to the guru, but for beginners who only delve into .NET and ASP, they will definitely be very useful.
To compare the speed of work, the default settings of the chart are taken, the resolution of the output picture is indicated and a fixed number of points are fed to it. Each solution is run several times, and the average is taken as the real speed. Again, this is subjective enough, and if you can offer a more beautiful approach, I will listen with interest.
On my PC (Intel Core I5 3.10 GHz, 8gb RAM, Windows 7 x64) the following distribution of speed was released:
|No.||Decision||Number of iterations||Total time (sec)||Average time per iteration (sec)|
| 1|| Dislin charts|| 5|| 1.9071907|| 0.38143814|
| 2|| Zed graph|| 5|| 2.750275|| 0.550055|
| 3|| NPlot|| 5|| 3.1833183|| 0.63666366|
| 4|| Web chart control|| 5|| 5.130513|| 1.0261026|
| 5|| Microsoft chart controls|| 5|| 6.8456845|| 1.3691369|
| 6|| Oxy plot|| 5|| 7.0067006|| 1.40134012|
| 7|| Open minded plot|| 5|| 8.257|| 1.6514|
| 8|| Google sharp charting|| 5|| 9.8049804|| 1.96099608|
For various input parameters (image resolution, the number of points on the graph, PC settings, Internet speed, moon phase, etc.), the results are slightly different, so you can test the performance at home.
I specifically did not make a deep comparison of features and customization capabilities, as this is rather subjective information, which is highly dependent on a specific task. If necessary, everyone can spend half an hour, take a break, look at the architecture of solutions, figure out how easy it is to customize them to specific requirements.
If someone knows more free .NET graphics solutions that are missing in the article, write in the comments and I will try to add them.
upd - (added solution from OpenMinded )
upd2 - (included DevExpress in the poll)
Only registered users can participate in the survey. Please come in.
What graphing tools for .NET did you use in your projects?
- 1.9% DisLin 8
- 29.2% Microsoft Chart Controls 120
- 2.9% NPlot 12
- 7% OxyPlot 29
- 32.1% ZedGraph 132
- 2.9% WebChart 12
- 9.7% Telerik 40
- 1.4% Chart Fx 6
- 22.9% Ready-made solutions for wimps, I wrote my graphics with card games and dancers 94
- 11.9% DevExpress 49
Is it worth adding paid solutions to the article and project?
- 28.1% Yes 54
- 23.9% No 46
- 47.9% By separate publication 92