When you're working with data there is nothing like a nice chart to bring the message home. Programs that simplify chart creation have always been popular. Some of you may be old enough to remember the original Lotus 1-2-3 spreadsheet program with its simple (yet at the time very impressive) charting features—it was the first "killer app" for the PC and the charts were the main reason why. People demand much more sophisticated charts nowadays, and if you want your application to be a success, you had better provide them. If you are programming a web-based application using the .NET platform—in other words, ASP.NET—I do not think you can do better than ChartDirector for .NET version 3.1, from Advanced Software Engineering Limited.
ADVERTISEMENT
ChartDirector is a server-based charting tool that lets you display sophisticated charts on web pages. It is available in versions for ASP/COM, PHP, Perl, Python, C++ and JSP/Java, but for this review I will concentrate on the .NET version.
The way that ChartDirector works is simple in concept. After installing it on the server, you write code that calls the ChartDirector API to create the desired chart. The chart is created as a graphic, such as a PNG file, which is then downloaded and displayed in the user's browser in a special container called a WebChartViewer. The other output image formats supported are BMP, JPG, and GIF.
Simple in concept indeed, but what about the execution? Here's where ChartDirector shines. I first encountered the product when a client asked me to use it in a project. Thanks to its excellent API design and excellent documentation, I had my first chart on-screen in about 20 minutes. It didn't take much longer before I was customizing axes, adding legends, and other tasks that I had feared would be a lot more difficult. I was impressed!
What kinds of charts can ChartDirector create? The full list is quite long and includes all the standard charts you would expect. Some less standard types are included too, such as bubble charts, polar/radar charts, various specialized financial charts, and box/whisker charts. Scatter charts have the option to include linear regression and confidence intervals. The figure shows an example of a relatively complex financial chart created with ChartDirector.
ChartDirector's flexibility is further enhanced by its layers capability. That's right, you can create a chart with multiple layers and, by controlling the transparency of individual layers, create custom charts that combine two or more chart types.
You say that you want intereactive charts? No problemo! ChartDirector makes it simple to create charts that are also image maps so a click on the chart can bring up tool-tips, data details, even completely new charts.
ChartDirector's support for colors falls into the "icing on the cake" category. In addition to full ARGB support (RGB colors with transparency) you can use what are called "magic colors." These colors depend on position are are terrific for effects such as gradients and colors that change depending on the data value.
ChartDirector's API is completely object-oriented, in keeping with the spirit of .NET programming. Each fundamental chart type is represented by a class as are all the individual elements of a chart such as data series, legends, axes, and annotations. ChartDirector has its own markup language for text that provides great flexibility in formatting text including embedding icons and images. This markup can be used anywhere text appears in a chart. ChartDirector also provides a rich series of classes for graphic primitives such as lines, shapes, and text that you can use to customize and decorate your charts. You can even use the graphics tools apart from a chart to create various kinds of diagrams — not exactly what the product was designed for, but possibly a nice bonus for some developers.
To give you an idea of how easy it is to create charts with ChartDirector, here's an example of creating an XY or scatter chart. I'll walk through it line by line. First, create a basic chart object; the arguments passed to the constructor specify the chart's size, background color, edge color, and 3-D effect:
Dim c As XYChart = New XYChart(750, 350, &HFFFFFF, 0, 0)
Next, set the area within the chart that will contain the actual plot. The arguments determine the plot position, size, two background colors, and horizontal and vertical grid color:
Now add a line layer to the chart and set its line width to 2:
Dim l As LineLayer = c.addLineLayer2()
l.setLineWidth(2)
Add a data series. This specifies that the data in the array RentData be plotted
using color &HFF (blue) with the legend "Renting":
l.addDataSet(RentData, &HFF, "Renting")
Add a second data series to be plotted using green:
l.addDataSet(BuyData, &HFF00, "Buying")
Finally, create the chart and display it in the browser:
WebChartViewer1.Image = c.makeWebImage(Chart.PNG)
The result is a simple yet very attractive line chart, all created with 12 lines of code. To me that is efficiency! More complex charts require correspondingly more effort, of course, but most of life's like that, isn’t it?
ChartDirector is a powerful and easy to use charting tool. Coupled with its excellent documentation and sample programs, it's a package that you really must consider for your server-side charting needs.