Overview
Trendlines help visualize the overall direction and pattern of a dataset.
This example demonstrates adding a trendline to the S&P 500 index data
to highlight long-term market growth using the ChartTrendlines and ChartTrendline components.
TrendLine Types
Choose from multiple regression types to best fit your data pattern. The Type property determines which mathematical model is applied to calculate the trend line.
Linear
A linear trendline is a straight, best‑fit line that shows a constant
rate of increase or decrease. This example demonstrates adding a
linear trendline by setting the Type property to TrendlineTypes.Linear to S&P 500 index data to visualize the overall
market direction.
Exponential
An exponential trendline is best suited for datasets that grow at an
accelerating rate. This example demonstrates an exponential trendline by setting the Type property to TrendlineTypes.Exponential
applied to global internet users data to highlight long-term adoption
growth patterns.
Logarithmic
A logarithmic trendline is used when data increases rapidly at the beginning
and then gradually slows down. This example demonstrates a logarithmic trendline
by setting the Type property to TrendlineTypes.Logarithmic applied to global mobile subscription growth data.
Polynomial
A polynomial trendline fits a curved line through the data points based
on a polynomial equation. This example demonstrates a third‑order polynomial trendline
by setting the Type property to TrendlineTypes.Polynomial and defining the PolynomialOrder property applied to global life expectancy data to reveal
long‑term nonlinear trends.
Power
A power trendline models data that follows a power-law relationship,
where the rate of change is proportional to the magnitude of the values.
This example demonstrates a power trendline by setting the Type property to TrendlineTypes.Power applied to the historical
decline in solar panel costs.
Moving Average
A moving average trendline smooths out short-term fluctuations in data
by averaging values over a specified period. This example demonstrates a 3-month moving average
by setting the Type property to TrendlineTypes.MovingAverage and specifying the Period property applied to Bitcoin price data to better visualize
overall market trends.
Data Labels
Data labels for trendlines allow you to display predicted or calculated
values directly on the trendline. This example demonstrates enabling data labels
using the ChartDataLabel component inside ChartTrendlineMarker for an exponential trendline used to visualize the rapid
growth of global electric vehicle sales.
Customization
Trendline customization options allow you to control visual aspects such
as line width, dash patterns, colors, and intercept values. This example demonstrates a customized linear trendline
using properties like DashArray, Width, Fill, and Intercept applied to global forest area
data to emphasize long-term deforestation trends.