'How to predict the y based on past data

I have a data array like this

{x: 0, y: 7.9}
{x: 1, y: 7.5}
{x: 2, y: 7.0}
{x: 3, y: 7.4}
{x: 4, y: 7.3}
{x: 5, y: 7.2}
{x: 6, y: 7.5}
{x: 7, y: 7.6}
{x: 8, y: 7.7}
{x: 9, y: 7.2}

Based on this data, how can I find out the following y? For example, I used a library to find out this data but how could I predict based on this data the following data eg for the next 30 indexes now I have this

const cleanData = helpers.cleanData(this.data.datasets[0].data);
            const ordersRegression = regression.linear(cleanData);
            const regressionPoints = ordersRegression.points.map(([x, y]) => {
                return {x, y};    
            });

            this.data.datasets[1].data = regressionPoints;

But now I would like to do something with the data that I have to predict the following It's possible ? Is there a genuine formula?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source