A trendline is a line superimposed on a chart revealing the overall direction of the data.

Google Charts can automatically generate trendlines for Scatter Charts, Bar Charts, Column Charts, and Line Charts.

Google Charts supports three types of trendlines:

• linear
• exponential
• polynomial

## Linear Trendlines

A linear trendline is the straight line that most closely approximates the data in the chart.

To draw a trendline on a chart, use the `trendlines` option and specify which data series to use:

var options = { title: 'Age vs. Weight comparison', hAxis: {title: 'Age', minValue: 0, maxValue: 15}, vAxis: {title: 'Weight', minValue: 0, maxValue: 15}, legend: 'none', trendlines: { 0: {} } // Draw a trendline for data series 0 };

## Exponential Trendlines

If your data is best explained by an exponential of the form eax+b, you can use the `type` attribute to specify an exponential trendline, as shown below.

For this chart, we also use `visibleInLegend: true` to display the exponential curve in the legend:

var options = { title: 'Age vs. Weight comparison', hAxis: {title: 'Age', minValue: 0, maxValue: 15}, vAxis: {title: 'Weight', minValue: 0, maxValue: 15}, legend: 'none', trendlines: { 0: { type: 'exponential', visibleInLegend: true, } } };

## Polynomial Trendlines

To generate a polynomial trendline, specify type `polynomial` and a `degree`.

var options = { title: 'Age vs. Weight comparison', hAxis: {title: 'Age', minValue: 0, maxValue: 15}, vAxis: {title: 'Weight', minValue: 0, maxValue: 15}, legend: 'none', trendlines: { 0: { type: 'polynomial', degree: 3, visibleInLegend: true, } } };