I'm trying to implement a FLOT chart from database, but I'm having a few problems...
I have a database with 2 rows: Data, Pcr
My files .php:
Datas.php
$dates=array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$date=$row['Date'];
$pcrs=(float)$row['Pcr'];
$dates[] = array(strtotime($date)*1000,$pcrs);
}
echo json_encode($dates);
I get the array:
[[1434240000000,7.2],[1434758400000,4.83],[1443052800000,4.85],[1445817600000,4.56],[1446163200000,4.5]]
I would like to get a chart from this array, but I don't know how to do that...
I have this file, and I know that it is incomplete...
Flot.php
<script>
$(document).ready(function(){
$.ajax({
type:’post’,
dataType:'json',
url:'datas.php',
success:function(data){
var datasets = {
"pcr": {
label: "Pcr",
data: dates
}
};
Could someone help me to do this chart?
Thank you very much