Hey I actually have one more question, I've been playing around with Chart.js in my module. It's displaying fine but the data used right now is hardcoded in the javascript, I was wondering if anyone knows how to pass data from example the view.ascx.cs Page_Load into the Javascript in View.ascx. An example of what I have right now below:
View.ascx.cs (Page_Load)
var avgAge = QueryController.GetAgeAvg(UserId).QueryValue;;
var numFollowers = QueryController.GetNumberFollowers(UserId).QueryValue;
var numFriends = QueryController.GetNumberFriends(UserId).QueryValue;
var numUsers = QueryController.GetNumberUsers().QueryValue;
txtAgeAvg.Text = avgAge.ToString();
txtNumberFollowers.Text = numFollowers.ToString();
txtNumberFriends.Text = numFriends.ToString();
txtNumberUsers.Text = numUsers.ToString();
View.ascx (Javascript)
<script>
var relationshipData = {
labels: ["Users", "Friends", "Followers"],
datasets: [
{
label: 'Over 18 #',
fillColor: '#382765',
data: [2500, 1902, 1041]
},
{
label: 'Under 18 #',
fillColor: '#7BC225',
data: [3104, 1689, 1318]
}
]
}
var relationships = document.getElementById('relationship').getContext('2d');
new Chart(relationships).Bar(relationshipData);
</script>
Sorry for the mess I don't see an option for inserting code snippets. Anyway I'm basically trying to get those vars in Page_Load (all ints) passed into the data arrays in relationship data javascript instead of using the hardcoded values that are currently there.
Thanks,
Kevin