In today’s fast-paced economy, organizations must continuously make informed business decisions and develop data-driven strategies. To do this, you must leverage existing data to predict possible future trends. This is where trend lines, a charting tool used to represent prevailing data trends, play a crucial role. Additionally, you can use trend lines to draw viewers’ attention to a particular section of your chart. In this article, we’ll discuss the main types of trend lines and how you can add them to your charts.
Here’s how:
“trendlines”: [
{
“line”: [
{
“startvalue”: “428.61”,
“endvalue”: “”,
“color”: “#29C3BE”,
“displayvalue”: “Avg yearly sales”, “valueonright”: “1”,
“dashed”: “1”,
“thickness”: “2”
} ] } ]
};
FusionCharts.ready(function() {
const myChart = new FusionCharts({
type: “line”,
renderAt: “chart-container”,
width: “100%”,
height: “500”,
dataFormat: “json”,
dataSource
}).render();
}
The code above adds the trend line to the chart above. You can get the complete code for the chart here.
Table of Contents
What Are Linear Trend Lines?
Linear trend lines, also known as best-fit lines, are straight lines used to represent the patterns in simple linear data sets. Your data is linear if most data points fall on or very close to the line of best fit. You’ll typically use a linear trend line to determine if something is trending steadily in a positive or negative direction. For example, the chart below plots the percentage of passengers on board (Y-axis) against the distance traveled (X-axis). The linear trend line here illustrates that the number of passengers on board the train reduces with distance.
What Are Logarithmic Trend Lines?
The logarithmic trend line is basically a linear trend line with a curve. It is also known as the best-fit curved line. Typically, the curve represents quick increases or decreases in the data’s rate of change. In other words, logarithmic trend lines are great for analyzing plots where data values increase or decrease rapidly before flattening out. The following example uses a logarithmic trend line where the rate of change increases before flattening out.
What Are Polynomial Trend Lines?
These types of trend lines are best suited for representing or analyzing fluctuating data sets: For example, gains and losses over a particular trading window. These trend lines are often represented by parabolic curves or curved lines, depending on your data sets. Polynomial trend lines are categorized based on their orders, which you can deduce from the number of hills and valleys (fluctuations) in the plot. For example, Order 2, Order 3, and Order 4 polynomial trend lines generally have only one hill or valley, two hills or valleys, and three hills or valleys, respectively. The example below uses an Order 2 polynomial trend line to illustrate the profit fluctuations for each year.
What Is A Power Trend Line?
These types of trend lines are curved lines used to plot data sets that increase at a constant rate. For example, a chemical reaction plot that represents changes in state or composition every n seconds. The example below shows a power trend line on a chart that illustrates a chemical reaction that changes every 10 seconds.
What Is An Exponential Trend Line?
The exponential trend line is similar to the power trend line. It is a curved line that illustrates the rise and fall of data points at an increasing rate. The following example shows the use of an exponential trend line on a tiger population that falls with time.
What Are Moving Average Trend Lines?
A moving average trend line smooths out the nearest possible pattern amidst numerous fluctuating data values. Each point in a moving average trend line is the average value of specific data points, set by the period option. For example, a “period 3” means the average of the first 3 data values would be the first point. The example below uses the moving average trend line to illustrate a clear pattern in fluctuating stock prices.
How Can You Add Trendlines To Your Chart?
You need the right charting library to add trend lines to your charts — one with limitless possibilities when it comes to trend lines. FusionCharts is a JavaScript chart library that offers numerous ways of customizing trend lines into your chart. Regardless of your chart type, FusionCharts provides easy-to-implement methods for adding trend lines to your charts. Check out the best JavaScript chart libraries for more information on what’s right for your project. To show you how you can add trend lines to your chart using FusionCharts, let’s look at the example below: Suppose you intend to add a trend line to a plot of yearly revenues earned by a company over the last 10 years — the years on the X-axis and the revenues on the Y-axis. You want the trend line to attract your viewers to a specific section of the chart, for example, the average of the yearly revenues. With FusionCharts, you can calculate the average and add a trend line to the Y-axis as follows: