Introduction
After long years passed releasing ASP .NET, community amassed a whole banch of various solutions for data visualization for any taste and budget: free, commecial, self-developed etc. They all work in different way, have no interoperable interfaces, use different architecture. performance and layout. So looking for the best choise developer often stops on first more or less suitable, because he has not enough time for complete investigation.
This article tries to collect all available solutions in one place, compare their performance, provide short summary and supply simplest usage examples. Also, it introduces quick guide which explains technical implementation of test application, since it may be interesting for beginners.
Background
Some time ago I had been assigned to the task - re-work existing chart solution for RDLC report, because it worked too slow on a large amount of data. It was expected, that newly introduced solution should be separated from RDLC, and just render image to file or stream, so it can be used elsewhere. I needed to investigate existing solutions and examine them for speed, flexibility, customization etc. Most of these properties are immeasurable, except of speed. So working on the task, I compared performance of most popular free/commercial solutions and want to share results with public
Quick overview
Technically I run each solution on fixed amount of data with random values. To minimize inaccuracy it had been done in several iterations. Default settings for each chart weren't changed. I agree that it may not be completelly reliable approach, but I saw no alternative way.
Here is the list of chart solutions that were included to the overview:
Not to waste your time, I bring performance test results right here:
№ |
Solution |
License |
Iteration amount |
Total time(sec) |
Averege time(sec) |
1 |
Zed Graph |
Free |
10 |
2.281 |
0.2281 |
2 |
Dislin |
Free |
10 |
2.591 |
0.2591 |
3 |
ChartDirector |
Commercial |
10 |
3.604 |
0.3604 |
4 |
NPlot |
Free |
10 |
3.846 |
0.3846 |
5 |
Oxy Plot |
Free |
10 |
4.091 |
0.4091 |
6 |
Web Chart |
Free |
10 |
4.305 |
0.4305 |
7 |
Microsoft Chart Controls |
Free |
10 |
4.353 |
0.4353 |
8 |
Chart FX |
Commercial |
10 |
5.3 |
0.53 |
9 |
ILNumerics |
Commercial |
10 |
6.079 |
0.6079 |
10 |
DevExpress |
Commercial |
10 |
7.614 |
0.7614 |
11 |
dotnetCharting |
Commercial |
10 |
7.684 |
0.7684 |
12 |
Tee charts |
Commercial |
10 |
10.004 |
1.0004 |
13 |
Telerik charts |
Commercial |
10 |
11.496 |
1.1496 |
14 |
Infragistic |
Commercial |
10 |
12.113 |
1.2113 |
15 |
Open minded plot |
Free |
10 |
13.034 |
1.3034 |
16 |
Google Sharp charting |
Free |
10 |
14.12 |
1.412 |
Testing was conducted on PC with next configurations: Intel Core I5 3.10 GHz, 8gb ОЗУ, NVIDIA GeForce GT 520, Windows 7 x64. Results may be different on your PC.
I try not to give my own opinion about each particular solution, cause it may be nonobjective or I just lack experience in using it. Only general information:
- DisLin - cross-platform (UNIX, Linux, FreeBSD, OpenVMS, Windows, Mac OSX и MS-DOS), fast, has ports to numerous languages (C, C++, Fortran 77, Fortran 90, Perl, Python, Ruby, Tgl, GCL, C#).
- Google Chart Sharp - C# wrapper on Google Chart API. Has limitation on 50000 calls per day. May work slow due to network bandwidth.
- Microsoft Chart Controls - official native chart solution from Microsoft. As plus - widely used, and well-documented.
- NPlot - open-source. Works pretty fast comparing to other solutions.
- OxyPlot - cross-platform, open-source. Widely used comparing to other free some. Has controls for WPF, Silverlight, Windows Phone, Windows 8 Metro, Xamarin.
- ZedGraph - fastest solution (on default installation). Open-source. Has controls for ASP .NET and Windows Forms.
- WebChart - old and closed (as far as I can see) solution. But still stable and may be helpfull for someone.
- OpenMinded - 'dark horse' of my classification. Slow and little-known, but looks pretty.
- Chart Fx - commecial solution. According to documentation supports .NET, Java, HTML5, COM, WPF, Silverligth, Sql Reporting Services.
- DevExpress - widely-spread commercial solution. Hold huge amount of controls. Supports WinForms, ASP.NET, ASP MVC, WPF, Windows Forms, Silverlight, Windows 8. The only thing - I did not manage to render web chart to the image, so I used WinForms control. Works slower than biggest part of other solutions.
- Telerik - another widely-spread commercial solution that has whole banch of various controls for cross-platform development. Use different technologies, one of the slowest solution.
- Chart director - fast commercial solution. Has ports to .NET, Java, ASP, COM, VB, PHP, Perl, Python, Ruby, ColdFusion, C++.
- ILNumerics - mathematic library developed exclusiverly for .NET. Commercial. Medium performance.
- Tee chart - commercial solution. Has ports to Java, ActiveX / COM, PHP and Delphi VCL / FireMonkey. Less than average performance.
- dotnetCharting - commercial solution. Has easy programming interface and rich functionality.
- Infragistics - commercial solution. Nice and easy-to-use, but relatively slow.
As you see, free solutions often works faster than their commercial contenders, but may have less customization parameteres and of cource no official support.
Implementation details
My goal was to hide implementation of each chart solution under some abstract entity, so I could measure performance programmatically. Also, since I can't ship commercial solutions because of license, I needed some architechture that let me include them in project dinamically.
This goal was achieved by taking out each 'adapter' for chart solution into separate assembly. Generally, component diagramm looks like on the image bellow:
All base classes and interfaces introduced in ChartingCore.dll assembly, to let web application and particular adapters to share code. It contains definitions for next interfaces (and appropriate base classes):
public interface IChartFactory
{
IChartAdapter GenerateChart(ChartParameters parameters);
string ChartTypeName { get; }
string DownloadLink { get; }
SolutionType SolutionType { get; }
Guid Id { get; }
}
public interface IChartAdapter
{
Image CreateChartImage();
IChartFactory Owner { get; set; }
}
public enum SolutionType
{
Free,
Commercial,
Any
}
Than, each assembly for every solution must impelement this interfaces. E.g., as it was done for Google Chart Sharp:
public class GoogleSharpAdapter : BaseChartAdapter
{
public GoogleSharpAdapter(ChartParameters parameters)
: base(parameters)
{
}
protected override Image DoCreateChartImage()
{
var chart = new LineChart(Parameters.ChartWidth, Parameters.ChartHeight);
chart.SetData(Parameters.SeriaData.Select(t => new float[]{t.Key, t.Value}).ToList());
var webClient = new WebClient();
byte[] imageBytes = webClient.DownloadData(chart.GetUrl());
return new Bitmap(new MemoryStream(imageBytes));
}
}
public class GoogleSharpChartFactory: BaseChartFactory
{
protected override IChartAdapter DoGenerateChart(ChartParameters parameters)
{
return new GoogleSharpAdapter(parameters);
}
public override string ChartTypeName
{
get { return "Google Sharp charting"; }
}
public override string DownloadLink
{
get { return "https://code.google.com/p/googlechartsharp/"; }
}
public override SolutionType SolutionType
{
get { return SolutionType.Free; }
}
}
Then I used Spring Framework for .NET to load assemblies to the web application dinamically. In this application, information about required assemblies and classes located at SpringContext.xml file:
="1.0" ="utf-8"
<objects xmlns="http://www.springframework.net">
<object name="CurrentFactoriesCollection" type="FreeChartTools.FactoriesCollection, FreeChartTools, Version=1.0.0.0, Culture=neutral">
<constructor-arg>
<list element-type="ChartingCore.IChartFactory, ChartingCore, Version=1.0.0.0, Culture=neutral">
-->
<ref object="DisLinChartingFactory"/>
<ref object="GoogleSharpChartingFactory"/>
<ref object="MsChartingFactory"/>
<ref object="NPlotChartFactory"/>
<ref object="OxyPlotChartFactory"/>
<ref object="WebChartControlFactory"/>
<ref object="ZedGraphChartFactory"/>
<ref object="OpenMindedPlotFactory"/>
-->
<ref object="ChartFxFactory"/>
<ref object="DevExpressFactory"/>
<ref object="TelerikFactory"/>
<ref object="TeeChartFactory"/>
<ref object="ChartDirectorFactory"/>
<ref object="ILNumericsFactory"/>
<ref object="DotnetChartFactory"/>
</list>
</constructor-arg>
</object>
-->
<object name="DisLinChartingFactory" type="FreeChartTools.FreeCharting.DisLinCharting.DislinChartFactory, FreeChartTools, Version=1.0.0.0, Culture=neutral" singleton="false" />
.............................................
-->
<object name="ChartFxFactory" type="ChartFXCharting.ChartFxFactory, ChartFXCharting, Version=1.0.0.0, Culture=neutral" singleton="false" />
..............................................
As I mentioned before all free assemblies included to solution. But since I can't do the same to commercial solutions, you may see next image on UI for some, that are not installed on your PC once you try to render it:
If you wanna test commercial you must download them from appropriate link (i've provided links for each solution and showed them right on the UI).
You can test each solution on your PC, or compare performance for all charts. User interface is quite simple:
- You can run test for one selected solution (for example, you want to perform test-drive for some attracting solution right on fly, modifying existing code). Select solution and press 'Check'.
- You can configure each solution for your needs, and compare performance with parameters that you are interested in. Select amount of iterations for testing and press 'Compare all solutions'.
If I missed some interesting chart solution, that can be used in .NET - just let me know, and I'll try to include it as soon as possible. Or, since this project also available at GitHub (https://github.com/perevernihata/DotNetChartingOverview), you can make these changes by yourself.
History
30.07.14 - introduced dotnetCharting solution to the article and sources.
04.08.14 - introduced Infragistics solution to the article and sources. All images hosted on CodeProject servers.