Type class
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" }] }] }
@since 4.2.2
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
events # |
Type Default An @since 4.3.14 |
---|---|
method # |
Type Default Method to calculate regression. Supported values: "linear" (default), "polynomial". |
options # |
Type Regression output options. Below are default values. { order: 2, precision: 2, } Click here About options |
reorder # |
Type Default Orders data points after calculation. This can make sense in scatter plot scenarios where data points can come in non-linear fashion. @since 4.2.3 |
result # |
Type An object containing results of the calculation. @since 4.3.14 |
simplify # |
Type Default Simplify regression line data? If set to NOTE: this does make sense with "linear" method only. @since 4.2.3 |
target # |
A series object that will be used for the trend line. |
Methods
constructor() |
Returns Constructor |
---|---|
dispose() |
Returns Inherited from Disposes this object and related stuff. |
init() |
Returns |
isDisposed() |
Returns Inherited from Returns if this element is already disposed. |
There are 2 inherited items currently hidden from this list. |
Events
#processed |
Param { type: Invoked when regression finishes calculating data. |
---|
Adapters
Regression does not have any adapters.