$this->src('DB')
->query($query4)
->params($q_params)
->pipe(new Cube(array(
'row' => 'date',
'column' => 'server',
'sum' => 'averageInvoicePerGuest'
)))
->pipe(new Sort(array(
'date' => 'asc'
)))
->pipe(new DateTimeFormat(array(
'date' => array(
'from' => 'Y-m-d H:i:s',
'to' => 'd/m/Y',
)
)))
->pipe(new ColumnMeta(array(
'{{all}}' => array(
'label' => 'Total',
),
)))
->pipe($this->dataStore('averageInvoicePerGuestByWaiterGraph'));
view file
<?php
LineChart::create(array(
'title' => 'Average invoice by waiter',
'dataSource' => $this->dataStore('averageInvoicePerGuestByWaiterGraph'),
'columns' => array(
'date',
'averageInvoicePerGuest' => array(
'label' => 'Average Invoice Amount',
'type' => 'number',
))
));
?>