Regression
Type classSince 4.2.2
A module which automatically calculates data for for trend lines using various regression algorithms.
By pushing an instance of Regression into plugin list of any XYSeries, it automatically recalculates and overrides its data to show regression trend line, inestead of the source values.
Example:
let regseries = chart.series.push(new am4charts.LineSeries());
regseries.dataFields.valueY = "value";
regseries.dataFields.dateX = "date";
let reg = regseries.plugins.push(new am4plugins_regression.Regression());
reg.method = "polynomial";
var regseries = chart.series.push(new am4charts.LineSeries());
regseries.dataFields.valueY = "value";
regseries.dataFields.dateX = "date";
var reg = regseries.plugins.push(new am4plugins_regression.Regression());
reg.method = "polynomial";
{
// ...
"series": [{
// ...
}, {
"type": "LineSeries",
"dataFields": {
"valueY": "value",
"dateX": "date"
},
"plugins": [{
"type": "Regression",
"method": "polynomial"
}]
}]
}
Sources
This information about Regression is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.
Inheritance
Regression extends Plugin.
Regression is not extended by any other symbol.
Properties
eventsType
EventDispatcher<AMEvent<this,IRegressionEvents>>Defaultnew EventDispatcher()Since 4.3.14An
EventDispatcherinstance.methodType
"linear"|"polynomial"DefaultlinearMethod to calculate regression.
Supported values: "linear" (default), "polynomial".
optionsType
objectRegression output options.
Below are default values.
{ order: 2, precision: 2, }More info: https://github.com/Tom-Alexander/regression-js#configuration-options About options
reorderType
booleanDefaultfalseSince 4.2.3Orders data points after calculation. This can make sense in scatter plot scenarios where data points can come in non-linear fashion.
resultType
Optional<any>Since 4.3.14An object containing results of the calculation.
simplifyType
booleanDefaultfalseSince 4.2.3Simplify regression line data? If set to
trueit will use only two result data points: first and last.NOTE: this does make sense with "linear" method only.
targetType
Optional<XYSeries>A series object that will be used for the trend line.
Methods
constructor()Returns
RegressionConstructor
init()Returns
void
2 inherited items
Events
processedParam { type:
"processed", target:Regression}Invoked when regression finishes calculating data.