I'm trying to reference a value which stores a model's property from the session.
var value = '${foo.property}';
Now using chartjs I try to reference the value as one of the data for the graph
myChart = document.getElementById('myChart').getContext('2d');
massPopChart = new Chart(myChart, {
type: 'bar' ,
data: {
labels:['Sample Column' , '2nd Low Value Column'],
datasets:[{
label: 'Sample Value Column',
data:[
//------REFERENCE OVER HERE
value,
3000
],
backgroundColor:[
'rgba(255,99,132,0.6)',
'rgba(54,162,235,0.6)'
]
}]
},
options:{}
});
From inspecting elements the value I get is not the value of the model property but the word value itself
I've read up on javascript tutorials none of their lessons about variables help me with this issue
I learned that referencing variables in javascript is different so can someone enlighten me on this
EDIT: I've also tried directly referencing '${foo.property}' in the data segment and I get the value but it returns as a String, I have tried using parseInt and Number to try to convert but to no avail