ctx = document.getElementById('regressionChart');
var mixedChart = new Chart(ctx, {
data: {
datasets: [{
type: 'line',
label: 'Line of Best Fit (r2: '+String(r2)+')',
data: y_hat,
borderColor: 'rgb(255, 99, 132)',
backgroundColor: 'rgba(255, 99, 132, 0.2)'
}, {
type: 'scatter',
label: 'True Values',
data: y_values,
backgroundColor: 'rgb(0, 0, 0)',
}],
labels: x_values
}
});
//Write the regression equation to the screen
document.getElementById('regressionEquation').innerHTML = "<b>Regression Equation: </b> "+String(regressor['slope'])+"*x + "+String(regressor['intercept']);