/**
  * @param string $income
  * @param string $expense
  * @param int    $count
  *
  * @return array
  */
 public function yearInOutSummarized($income, $expense, $count)
 {
     $chart = new GChart();
     $chart->addColumn(trans('firefly.summary'), 'string');
     $chart->addColumn(trans('firefly.income'), 'number');
     $chart->addColumn(trans('firefly.expenses'), 'number');
     $chart->addRow(trans('firefly.sum'), $income, $expense);
     $chart->addRow(trans('firefly.average'), $income / $count, $expense / $count);
     $chart->generate();
     return $chart->getData();
 }
 /**
  * @param Collection $categories
  * @param Collection $entries
  *
  * @return array
  */
 public function year(Collection $categories, Collection $entries)
 {
     $chart = new GChart();
     $chart->addColumn(trans('firefly.month'), 'date');
     foreach ($categories as $category) {
         $chart->addColumn($category->name, 'number');
     }
     /** @var array $entry */
     foreach ($entries as $entry) {
         $chart->addRowArray($entry);
     }
     $chart->generate();
     return $chart->getData();
 }
 /**
  * @param Collection $set
  *
  * @return array
  */
 public function history(Collection $set)
 {
     $chart = new GChart();
     $chart->addColumn(trans('firefly.date'), 'date');
     $chart->addColumn(trans('firefly.balance'), 'number');
     $sum = '0';
     bcscale(2);
     foreach ($set as $entry) {
         $sum = bcadd($sum, $entry->sum);
         $chart->addRow(new Carbon($entry->date), $sum);
     }
     $chart->generate();
     return $chart->getData();
 }
 /**
  * @param Bill       $bill
  * @param Collection $entries
  *
  * @return mixed
  */
 public function single(Bill $bill, Collection $entries)
 {
     // make chart:
     $chart = new GChart();
     $chart->addColumn(trans('firefly.date'), 'date');
     $chart->addColumn(trans('firefly.maxAmount'), 'number');
     $chart->addColumn(trans('firefly.minAmount'), 'number');
     $chart->addColumn(trans('firefly.billEntry'), 'number');
     /** @var TransactionJournal $result */
     foreach ($entries as $result) {
         $chart->addRow(clone $result->date, floatval($bill->amount_max), floatval($bill->amount_min), floatval($result->amount));
     }
     $chart->generate();
     return $chart->getData();
 }
 /**
  * @param Account $account
  * @param Carbon  $start
  * @param Carbon  $end
  *
  * @return array
  */
 public function single(Account $account, Carbon $start, Carbon $end)
 {
     $current = clone $start;
     $today = new Carbon();
     $chart = new GChart();
     $chart->addColumn(trans('firefly.dayOfMonth'), 'date');
     $chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
     $chart->addCertainty(1);
     while ($end >= $current) {
         $certain = $current < $today;
         $chart->addRow(clone $current, Steam::balance($account, $current), $certain);
         $current->addDay();
     }
     $chart->generate();
     return $chart->getData();
 }