My scatter chart keep pushing double values, I am using onchange="" and doing per user input to update the x-value in my HTML. Here is the screenshots. User input x-values here is my chart problem, the 2nd and 3rd data keeps plotting on my first onchange value. Scatter chart photo. Here is my function.
function interactiveChart() {
let test1 = document.getElementById('bzvaqxnufhyd1').value;
let test2 = document.getElementById('bzvaqxnufhyd2').value;
let test3 = document.getElementById('bzvaqxnufhyd3').value;
nineChart2.data.datasets[0].data.push({x: test1,y: 0});
nineChart2.data.datasets[0].data.push({x: test2,y: 1385.27});
nineChart2.data.datasets[0].data.push({x: test3,y: 1959.07});
console.log(nineChart2data1)
nineChart2.update();
nineChart2.render();
}
It push my y value after I inputted x-value #1 that is my problem. This is my chart setup
var nineChart2data1 = [];
data: {
datasets: [{
type: 'scatter',
stacked: true,
fill: false,
showLine: true,
label: ["MODEL 20T"],
backgroundColor: 'red',
borderColor: 'red',
data: [{
dataPoints: nineChart2data1
}]
}