Version

Adding a Trend Line

Purpose

This topic explains, with code examples, how to add a trend line over a UltraSparkline™ control.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic Purpose

This topic provides an overview of the UltraSparkline control, its benefits, and the supported chart types.

This topic provides an overview of the possible ways to configure the UltraSparkline control. Links to the detailed configurations (available in separate topics) are provided as well.

Adding a Trend Line

Overview

The trend line displays in the UltraSparkline control as another layer on top of the Sparkline layer. To display a trend line, use the TrendLineType property.

The trend lines are calculated according to the algorithm specified by the TrendLineType property using the values of the data that the chart is bound to. The supported trend lines are listed and explained in the UltraSparkline Overview topic.

Trend line types can be displayed only one at a time. (No multiple trend lines can be displayed simultaneously.)

By default, the trend line is not displayed.

Specifying the trend line type

The following table maps the UltraSparkline trend line types to the TrendLineType property settings that deliver them.

Trend line type TrendLineType property setting

Qubic Fit

QubicFit

Cumulative Average

CumulativeAverage

Exponential Average

ExponentialAverage

Exponential Fit

ExponentialFit

Linear Fit

LinearFit

Logarithmic Fit

LogarithmicFit

Modified Average

ModifiedAverage

Power Low Fit

PowerLawFit

Quadratic Fit

QuadraticFit

Quartic Fit

QuarticFit

Quintic Fit

QuinticFit

Simple Average

SimpleAverage

Weighted Average

WeightedAverage

Example

The screenshot below demonstrates how the Sparkline looks as a result of the following settings:

Property Value

QuinticFit

sparkline visual elements 26.png

Code Example

The following code demonstrates setting of the TrendLineType property to QuinticFit.

In C#:

this.UltraSparkline1.TrendLineType = TrendLineType.QuinticFit;

In Visual Basic:

Me.UltraSparkline1.TrendLineType = TrendLineType.QuinticFit

Configuring the Trend Line

The Trend Line can be configured in the following aspects:

  • Trend line type

  • Trend line period

  • Trend line color

  • Trend line thickness

For details on how to configure the trend lines, refer to the Configuring the Trend Line topic.

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic provides an overview of the UltraSparkline control, its benefits, and the supported chart types.

This topic provides an overview of the possible ways to configure the UltraSparkline control. Links to the detailed configurations (available in separate topics) are provided as well.

This topic explains, with code examples, how to configure the trend line of UltraSparkline for custom appearance and color.

This topic explains the featured properties of the UltraSparkline control.