Skip to content

Linear regression fails on Date format #39

Open
@dvago

Description

@dvago

Hi there,

I'm currently looking into an implementation of the default available regressions, it seems like the chart does not draw regression models (just the Linear function) when the input data (source) is containing either a Date object or a timestamp.

Given a source input as dataset with the following structure:

source: [
    [
        Mon Dec 07 2020 00:00:00 GMT+0000 (Greenwich Mean Time),  // This is a valid Date object,
        50.90
    ],
    [
        Wed Oct 30 2019 00:00:00 GMT+0000 (Greenwich Mean Time),  // This is a valid Date object,
        97.90
    ],
]

When I push into the dataset a new transform with the type as ecStat:regression and method as linear no line gets drawn.

note:
The same behaviour happens when the Date object gets converted into a timestamp using the standard Date getTime() method.

note 2:
Regression models like exponential, logarithmic and polynomial draw perfectly fine using both Date object or timestamp, so I believe there must be something wrong within the linear function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions