SVG : The W3C Definition
If you fail to see a pie chart above, then you don't have a client system equipped to view SVG content (or alternately you're using one of the platforms on which the Adobe SVG viewer is stupid in regards to the OBJECT element. In that case go to the SVG directly). For IE or Netscape you can find an appropriate content handler at http://www.adobe.com/svg/viewer/install/main.html
Graphs are a very important business element that allows you to convey information to your users in a format that they can comprehend and absorb extremely quickly and accurately. Graphs add an element of "zing" to documentation, and can make even the most boring presentation come alive. Indeed, when someone uses their expert abilities to formulate how to present information in a graph that makes sense, it improves the transfer of knowledge, and helps everyone involved understand the data better. In a nutshell: Graphs are fantastic!
However, many in the computer world have long shunned graphs: Either they were incredibly processor intensive to generate, or they required expensive, proprietary, unwiedly tools with countless formatting flaws, and even then they often looked horrible when printed (a raster graph with 30 dpi doesn't measure up to the truetype 1200dpi font). Raster graphs have long been a nuisance in the computer world, and have caused endless trouble for content creators and web developers. Even in the .NET world, many are advocating creating static bitmap based graphs on the server side: Not only is this wasteful of transport resources, but it's extremely demanding on the server as well, and gives the user a graph which is completely static, and prints very poorly.
yaflaSVG to the rescue! Well, sort of. At this point this project is mostly a "getting acquainted with .NET and SVG" project for myself (nothing beats a good destination to dictate how to take the first steps), so my primary motivation is self-training (in SVG, the .NET Framework which I've had limited exposure to to this point, and C#), and will remain so as I build this project. Additionally, I am trying to build this in a object-oriented, best practices manner that will utilize the best aspects of reusability and encapsability, however, like all software, this is organic: Rather than building one and throwing it away, I am building and refactoring as I go (learning things such as the commonality of legend drawing code between various graph types, for instance, so the bound legend drawing code will merge with the base class eventually), hopefully ending up with what is a very usable and powerful destination.
However, version 0.5 is my first stab at it, and currently represents about 5 hours of development, a lot of which was scouring over the SVG specs trying to find an efficient method of making arcs. Version 0.5 builds the base class (yaflaSVGEngine), as well as a 2-dimensional pie chart engine (yaflaSVG2DPie), and over the next little while I will add and improve on the basics, while adding other graph types such as a 2D line chart, and a 2D bar chart, perhaps moving on to 3D charts if time (and need) permits. Usage of this component could not be easier: In a minimal scenario you assign a DataTable and then retrieve the SVG from the public string property SVGXML in the form of an XmlDocument, which you can then feed verbatim to the end user via a stream, a string, etc, or even more powerfully can be modified after retrieval. More realistically you'll set features such as the title, the columns to use as the source for the values and caption (by default it looks for the columns Caption and Value) the width and height (in cm), whether to display the legend, and whether or not you want it to be a dynamic graph.
SVGs are a fantastic way of conveying graphs, along with any other form of vector graphic style information: Not only do they look great and print perfectly, but they additionally are an international standard (while currently you require plug-ins to view SVGs in most clients, such as the superb Adobe plug-in, all of the major browser vendors are working at native SVG interpreting) supported by the W3C.
An example middleware ASPX page that calls a stored procedure (GET_COMPUTER_PARTS) and streams an SVG can be found in the download ZIP (example_sql.aspx), as well as a version that builds a DataTable manually and generates a graph based on that (example_static.aspx). At some point (as the component evolves) I plan on actually making documentation (though note that the component has all methods and properties prefaced by XML Documentation, so you can create an XML document by add the csc parameter /doc:filename.xml when compiling) detailing what each of the properties does, however the examples should give you a good start.
In version 0.6 I'm going to continue to add features to the pie chart (including more formatting attributes), and then in version 0.7 I'll add a basic line chart. Feel free to use this in any way you'd like, including deriving from it (for any reason whatsoever, including commercial) assuming that the copyright statement remains intact as is the nature of the BSD-style license.
Areas That Need To Be Improved
Note: This component lets most exceptions propagate out, so if you don't correctly set the CaptionField and ValueField, for instance, or you pass in an invalid DataTable, etc, then an exception will find its way out. This is expected and desired.
Several people have asked me why I'm putting this out for free, and the honest answer is simply that it was easy for me to make, and it's far from a perfect implementation at this point: While I'm a expert developer in many other areas, a lot of what is entailed in this project is new to me, so I make no claims or guarantees of veracity for any purpose, etc. Perhaps at some point in the future, after I've heavily refactored and added features, there'll be a "Pro" commercial version.
UPDATE 0.55 : I've refactored a bit and pulled some of the common SVG generating code out into a separate, abstract (with static members) class called yaflaSVG. This current includes inserting text and rectanges, as well as groups. Furthermore I've added each unique element as members of a group, with style application being done to the group rather than to each element. Additionally I've moved labels behind the pie, and set a mild opacity on the pie elements to let them show through, and this works perfectly. Again, any feedback is greatly appreciated.