public function Ajax::json3 in Flot 8
Function realtime.
1 string reference to 'Ajax::json3'
- flot_examples.routing.yml in flot_examples/
flot_examples.routing.yml - flot_examples/flot_examples.routing.yml
File
- flot_examples/
src/ Controller/ Ajax.php, line 127
Class
- Ajax
- Displays a graph to demonstrate the AJAX capabilities of FLOT.
Namespace
Drupal\flot_examples\ControllerCode
public function json3($id) {
$data_set = [
[
1999,
4.4,
],
[
2000,
3.7,
],
[
2001,
0.8,
],
[
2002,
1.6,
],
[
2003,
2.5,
],
[
2004,
3.6,
],
[
2005,
2.9,
],
[
2006,
2.8,
],
[
2007,
2.0,
],
[
2008,
1.1,
],
];
$data_slice = array_slice($data_set, 0, $id);
$data = array(
'label' => 'USA',
'data' => $data_slice,
);
return new JsonResponse($data);
}