Charting: Fast and Efficient

To keep his ASP.NET 1.1 and 2.0 applications at the cutting edge, Grady took a second look at the charting components his company was using.


April 05, 2007
URL:http://www.drdobbs.com/windows/charting-fast-and-efficient/198800552

Grady is a Senior Project Manager for SmarterTools Inc. He can be contacted at [email protected].


As a senior project manager for SmarterTools (www.smartertools.com), one of my roles is to constantly evaluate our integration with new technologies and third-party components to keep our distributable ASP.NET 1.1 and 2.0 applications at the cutting edge of technology and design. Recently, I had the opportunity to reevaluate our use of charting components to see if we had the right fit for our applications and to look for opportunities to make our products better, faster, and more agile.

Our software requirements are different than other companies. Unlike most software development, which starts with the needs of small businesses and individual customers in mind, our software is designed from the onset with a focus on high-stress environments (such as hosting companies and ISPs), and then adjusted to make a good fit in smaller installations. We favor this approach because it makes the end product inherently more stable and scalable.

The Problem

Most Windows-based business software these days comes in one of two flavors—installable Windows applications and hosted services. Our software differs in that our interfaces are completely web based, but the web application is installed on the customers' servers rather than hosted at our facility. Designing our software this way has led to several key advantages, such as easy maintenance and remote management for administrators.

It has also led to a few disadvantages. One of which is that component vendors typically target one or two of the "typical" flavors of development (Windows services or hosted web applications, for instance), and very few support the hybrid model that has made our products catch on so quickly.

Several years ago, during the initial development of SmarterStats (our website traffic-analysis package), we evaluated many vendors. At the time, most of the popular charting components only supported the per-website or per-server licensing model. Some were willing to bend and operate on a per-installation royalty, but even this did not meet our needs because it increased the cost of our products by up to $100 and sometimes more. Because of our commitment to a value-pricing structure and a free product distribution model, royalties are a huge roadblock.

Our management is intent on maintaining a free version of all of our products and we believe that charging royalties would not only hurt product distribution, but would negatively affect our small-business and hosting-industry purchase rates where the environment is very competitive and the margins are rather small.

Again, the need to support very large-scale environments leads us to another difficulty—the performance needs of the components we use. Our software (especially SmarterStats, see Figure 1) needs to be capable of generating up to several hundred thousand charts per day (a requirement in the larger hosting company environments). These charts also need to be generated in the web interface as well as through automated e-mail reports that run in a background thread. Needless to say, issues of performance came up very quickly.

[Click image to view at full size]

Figure 1: SmarterStats.

Some charting packages generated extremely nice-looking charts, but took up to five seconds per chart. Others worked quickly, but looked terrible or required controls to be embedded on an ASP.NET page to work.

The Evaluation

Our search led us to evaluate many charting tools, and the one that fit the bill was Nevron Chart for .Net from Nevron LLC (www.nevron.com). It has outstanding performance, professional charts, and flexibility in use and licensing terms that works well in our business model.

Recently, we had the opportunity to review our decision to go with Nevron in light of changes in the component space and the development of our recently released SmarterMail 4.x product (Figure 2). We entered the evaluation with several needs and wants for our products.

[Click image to view at full size]

Figure 2: SmarterMail.

Our needs include:

While not absolutely required, our wants included:

The Results

With the review complete and our software successfully released, Nevron Chart for .Net satisfied all of our needs and wants with flying colors.

// Portions of this code were obtained from Nevron LLC 

public string GenerateFunnelChart()
{
 Size imageDimensions = new Size(640, 480);
 string filename = Guid.NewGuid().ToString("n") + ".jpg";
 string relativeFilename = "~/App_Data/Temp/" + filename;
 string physicalFilename = 
    Server.MapPath(relativeFilename);

 NLicense license = new NLicense(NEVRON_LICENSE_KEY);
 NLicenseManager.Instance.SetLicense(license);
 NLicenseManager.Instance.LockLicense = true;

 using (NChartControl chartControl = new NChartControl())
 {
     chartControl.Settings.RenderDevice = 
        RenderDevice.OpenGL;

     // Add a Header
     NLabel header = chartControl.Labels.AddHeader
        ("Sample Funnel Chart");
     header.TextStyle.FontStyle =
        new NFontStyle("Verdana", 20, FontStyle.Italic);

     // Add a legend
     NLegend legend = chartControl.Legends[0];
     legend.SetPredefinedLegendStyle
        (PredefinedLegendStyle.BottomRight);

     // Setup chart 
     NFunnelChart chart = new NFunnelChart();
     chart.LightModel.SetPredefinedLightModel
        (PredefinedLightModel.SoftFrontal);
     chart.Projection.SetPredefinedProjection
        (PredefinedProjection.Orthogonal);
     chart.Projection.Elevation = 4;
     chartControl.Charts.Clear();
     chartControl.Charts.Add(chart);
// Add a new Funnel Series to chart
     NFunnelSeries funnel = 
        (NFunnelSeries)chart.Series.Add(SeriesType.Funnel);
     funnel.BorderStyle.Color = Color.LemonChiffon;
     funnel.Legend.DisplayOnLegend = legend;
     funnel.Legend.Mode = SeriesLegendMode.DataPoints;
     funnel.DataLabelStyle.Format = "<percent>";

     funnel.Values.Add(20.0);
     funnel.Values.Add(10.0);
     funnel.Values.Add(15.0);
     funnel.Values.Add(7.0);
     funnel.Values.Add(28.0);

     funnel.Labels.Add("Awareness");
     funnel.Labels.Add("First Hear");
     funnel.Labels.Add("Further Learn");
     funnel.Labels.Add("Liking");
     funnel.Labels.Add("Decision");

     funnel.FillStyles[0] =
        new NColorFillStyle(Color.FromArgb(169, 121, 11));
     funnel.FillStyles[1] =
        new NColorFillStyle(Color.FromArgb(157, 157, 92));
     funnel.FillStyles[2] =
        new NColorFillStyle(Color.FromArgb(98, 152, 92));
     funnel.FillStyles[3] =
        new NColorFillStyle(Color.FromArgb(111, 134, 181));
     funnel.FillStyles[4] =
        new NColorFillStyle(Color.FromArgb(179, 63, 92));

     chartControl.ImageExporter.SaveToFile(physicalFilename,
        new NSize(imageDimensions), 
           NResolution.ScreenResolution,
              new NJpegImageFormat());
   }
   return physicalFilename;
}
Listing One

Sources at Nevron also inform me that they will be coming out with a gauge component soon. Assuming they use similar licensing terms to what they currently have, it should fill yet another void for software development.

While negatives are few and far between, two are worth mentioning.

During the last three years, Nevron's object model has undergone substantial change, and we sometimes found ourselves upgrading only to find that there were several breaking changes. That said, every change has been an improvement and that trend appears to have stabilized over the course of the last year. This is most likely due to growing pains as their product has become more broadly adopted by the marketplace.

Another possible negative is that user forum participation is pretty scarce. This could be due to the responsiveness of the Nevron staff because it's sometimes easier to just ask them directly and get answers than to post. They have never been anything but extremely helpful in our communications with them. Still, an active and communicative user base is a valuable resource for developers and a sign of healthy growth.

Conclusion

Nevron Chart for .Net continues to meet our needs. The evaluation process gave me the opportunity to talk to Nevron about some new things they have coming down the pipe as well.

Features such as the new gauge component and coming enhancements to Nevron Chart for .Net are exciting to us and give us reason to trust Nevron's commitment to build upon and improve its products.

We look forward to seeing how these new developments can help us make SmarterMail and SmarterStats even better.

Terms of Service | Privacy Statement | Copyright © 2024 UBM Tech, All rights reserved.