hi i have been trying to use data from MYSQL database and use them to create graphical chart with chart.js. i encoded data into JSON data( through a php file name data1.php), no
So this a JSON data example,
var data = '{"name":"tom","Second":"smith","age":"20","height":"180"}'
Create a Variable to Parse the data
var obj9 = JSON.parse(data);
Then make another Variable to store your specific data. (.age, this is relative to your data set, eg .name, .height)
var cat = obj9.age;
Then you can use the the variable cat in your graph data.
data : [cat9,randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()]
Hope that helps.
Find out more about JSON http://www.w3schools.com/json/default.asp
I am not quite sure if you mean this:
var chartjsData = [];
for (var i = 0; i < json.length; i++) {
chartjsData.push(json[i].present_worth);
}
http://jsfiddle.net/rnX2Z/1/
Otherwise comment ;)