In my code there is a text input that lets the user type in their own text, this text is then turned into a variable;
var title = document.getElementById("chartTitle");
var xaxis = document.getElementsByName('xaxis')[0];
var yaxis = document.getElementsByName('yaxis')[0];
Now that the variables contain the text, I need to change two parts within this code to make it so the predefined "text" is replaced with the text within the variable. The two parts are "title text" must changed to be the var title and the "yaxis text" must be changed to the var yaxis.
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "title text"
},
axisY: {
title: "yaxis text"
},
data: [{
type: "column",
dataPoints: []
}]
});
chart.render();
}
title.textetc. to the .textContent of those elements (you can usethisinside the function).title: { text: title }, axisY: { title: yaxis }?