Skip to content

Instantly share code, notes, and snippets.

@gnardecky
Last active November 15, 2016 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnardecky/d22dee51818e50ff97e8241efea6655c to your computer and use it in GitHub Desktop.
Save gnardecky/d22dee51818e50ff97e8241efea6655c to your computer and use it in GitHub Desktop.
PHP file used to return a JSON with fake data representing 12 months.
{
"id":"months",
"width":"100%",
"x":"0%",
"y":"40%",
"height":"30%",
"type":"bar",
"plotarea":{
"margin-top":30,
"margin-right":30,
"margin-bottom":40,
"margin-left":50
},
"plot":{
"bars-overlap":"100%",
},
"scale-x":{
"values":[
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
"guide":{
"visible":false
}
},
"scale-y":{
"values":"0:100:25",
"item":{
"padding":"4px"
},
"guide":{
"visible":false
}
},
"tooltip":{
"text":"%v",
},
"series":[
{
"values":[
<?php
$s = '';
for ($i=0;$i<12;$i++){
$s .= intval(50 + rand(-20,40)) . ',';
}
echo substr($s, 0, -1);
?>
],
"url" : "<?php echo $_GET['filepath'];?>/kitchen_data_days.php?monthindex=%node-index&monthname=%scale-key-value&year=<?php echo $_GET['year'];?>",
"z-index":1,
"target":"graph=days"
},
{
"values":[
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100,
100
],
"background-color":"#E8E7E8",
"maxTrackers":0,
"z-index":0
}
],
"labels":[
{
"x":50,
"y":0,
"color":"black",
"background-color":"white",
"alpha":0.8,
"border-radius-bottom-left":5,
"border-radius-bottom-right":5,
"border-right":"1px solid #ddd",
"border-left":"1px solid #ddd",
"border-bottom":"1px solid #ddd",
"text":"Monthly stats for <?php echo $_GET['year']; ?>"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment