Graphics Server Technologies: Graphs and Charts for the World
 

About Us
Press
Column Articles
Newsletter
Contact
Privacy
Site Map

Home / Column Articles/ April 2003 Column Article

April 2003 Column Article

Graphics Server .NET Trend and Statical Lines

One of the many areas Graphics Server has always excelled in is it's statistical function capabilities. In this month's article you'll learn more about the trend lines and styles available to to measure trends within a given data set.

by Matt Berry

Graphics Server .NET allows for different trend lines to represent a single set of data. As new sets or series of data are added each new set can have its own trend lines. Graphics Server .NET statistical functions and capabilities include, exponential, inverse, logarthimic, mean, min/max, moving average, power, spline, standard deviation and variable order polynomial. Each of these trend types can be implemented in a chart one by one or simultaneously if desired.

Standard deviation

To add a trend line to Graphics Server, access the current chart drawing set and call its AddTrend method to add a new trend line:

(using VB.NET code like GSNetChartControl.Chart.GetSeriesDrawing(0).AddTrend(trend1)

Each trend created must be done in code, and some trends require multiple parameters:

(using VB.NET code like Dim trend1 as TrendExponentialOne = new TrendExponentialOne(SeriesComponent.Y))

Most trends require at least one parameter specifying the data to use when drawing the trend line. The code for trend1 (above) uses the Y data values to calculate the trend line (passing SeriesComponent.Y as a parameter). Some trend lines require extra parameters specific the trend type.

For example, a variable order polynomial trend requires two parameters, a Series Component parameter and a second parameter to specificy the polynomial order. The moving average trend line requires that the second parameter specify the moving average group size. (All parameter expectations are specified in the Graphics Server documentation. Access the documentation integrated into Visual Studio .NET or the documentation in the Graphics Server .NET Resource Center for more information.)

Moving averages


Once a trend line has been created with a "new" call in the code, the attibutes of the trend line can be set. Use the LineProperties member to change individual trend line properties. The LineProperties member allows the line thickness, style (dashes, solid, dots, etc), color, etc. to be changed. Depending on what is being represented, the trends could be the same color as the original data set or they could be different to distinguish the trend line from the original data set.

Another useful feature is the ability to retrieve the equations of these newly created trend lines for other uses within an application. Each trend line has a coefficients member that stores the trend equation coefficients after the line has been drawn. Refer to the Graphics Server documentation to get the format of the trend line equation, plug the coefficient values into the equation and determine if the trend line can have a variable number of coefficients. The result of combining the coefficient equation information will be the chart's trend line equation.


Logarithmic


One thing to note, by default the legend does not automatically add a legend icon for a trend line. In order to do this a new (empty) series must be added to the chart with the same line color and style as the trend. Name the series according to the trend line. Add the series to the chart and this will show and additional legend icon for the trend line.

    About Us      Contact      Privacy      Sitemap