Passing Database Query Results To Jquery Sparkline Charts Using Php
I've created a PIE chart using jquery-sparline. Pie Chart : $('.sparkline').sparkline([2,1], { type: 'pie', width: '100', height:
Solution 1:
I'm not sure but i think you will have to print you value in html balise (hidden filed for exemple) and retrieve it using javascript : document.getElementById
exemple :
<inputtype="hidden"id="valueForJs"value="244-125"><script>var obj = document.getElementById("valueForJs").value;
var array = obj.split("-");
alert('value = ' + array[0] + ' ' + array[1]);
// now you have your 2 value and you can use it in your script below...</script>
You can also put the value in a span
and hide
this span for exemple, but i think input will be cleaner.
Solution 2:
suppose we have result in $result array. So, you can replace 2 with echo $result['Label'] and 1 with echo $result['Count'] but in single inverted comma like below
'<?php echo $result['Label'] ?>'
Post a Comment for "Passing Database Query Results To Jquery Sparkline Charts Using Php"